Merge branch 'master' into templateallthemarkup
authorJason Skomorowski <jason@indexdata.com>
Mon, 7 Jul 2014 23:30:04 +0000 (19:30 -0400)
committerJason Skomorowski <jason@indexdata.com>
Mon, 7 Jul 2014 23:30:04 +0000 (19:30 -0400)
Conflicts:
src/.gitignore
src/mkws-core.js
src/mkws-team.js
src/mkws-widget-termlists.js
tools/htdocs/Makefile

1  2 
README
src/mkws-core.js
src/mkws-team.js
src/mkws-templates.js
src/mkws-widget-main.js
tools/htdocs/Makefile

diff --combined README
--- 1/README
--- 2/README
+++ b/README
@@@ -21,7 -21,7 +21,7 @@@ Required devel tool
  ====================
  
  On debian, you will need:
- $ sudo apt-get install curl git-core pandoc yui-compressor node-js
+ $ sudo apt-get install curl git-core pandoc yui-compressor node-js libbsd-resource-perl
  
  On Debian 7 (wheezy), you do not need git-core, plain git will do, but
  you probably have that on a development box already. Unfortunately, node-js
@@@ -30,11 -30,6 +30,11 @@@ or you can download the source from htt
  it yourself. Looks like you need node and npm, make install puts them
  into /usr/local/bin.
  
 +To compile the default templates you'll need to install the stable version
 +of Handlebars. Currently it's at 1.3.0 and available by npm:
 +
 +  npm install handlebars@1.3.0 -g
 +
  For apache setup, see tools/apache2/README
  
  NEWS
diff --combined src/mkws-core.js
@@@ -16,7 -16,6 +16,7 @@@ var mkws = 
                  // initial value allows jQuery popup to use logging.
    teams: {},
    widgetType2function: {},
 +  defaultTemplates: {},
  
    locale_lang: {
      "de": {
    }
  };
  
+ // We may be using a separate copy
+ if (typeof(mkws_jQuery) !== "undefined") {
+   mkws.$ = mkws_jQuery;
+ } else {
+   mkws.$ = jQuery;
+ }
  
  mkws.log = function(string) {
    if (!mkws.log_level)
  };
  
  
+ // 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;
@@@ -140,7 -163,7 +164,7 @@@ mkws.setMkwsConfig = function(overrides
  
    var config_default = {
      use_service_proxy: true,
-     pazpar2_url: "//mkws.indexdata.com/service-proxy/",
+     pazpar2_url:        "//mkws.indexdata.com/service-proxy/",
      service_proxy_auth: "//mkws.indexdata.com/service-proxy-auth",
      lang: "",
      sort_options: [["relevance"], ["title:1", "title"], ["date:0", "newest"], ["date:1", "oldest"]],
      facets: ["xtargets", "subject", "author"], /* display facets, in this order, [] for none */
      responsive_design_width: undefined, /* a page with less pixel width considered as narrow */
      log_level: 1,     /* log level for development: 0..2 */
 +    template_vars: {}, /* values that may be exposed to templates */
  
      dummy: "dummy"
    };
@@@ -180,6 -202,110 +204,6 @@@ mkws.objectInheritingFrom = function(o
  }
  
  
 -mkws.defaultTemplate = function(name) {
 -  if (name === 'Record') {
 -    return '\
 -<table>\
 -  <tr>\
 -    <th>{{mkws-translate "Title"}}</th>\
 -    <td>\
 -      {{md-title}}\
 -      {{#if md-title-remainder}}\
 -        ({{md-title-remainder}})\
 -      {{/if}}\
 -      {{#if md-title-responsibility}}\
 -        <i>{{md-title-responsibility}}</i>\
 -      {{/if}}\
 -    </td>\
 -  </tr>\
 -  {{#if md-date}}\
 -  <tr>\
 -    <th>{{mkws-translate "Date"}}</th>\
 -    <td>{{md-date}}</td>\
 -  </tr>\
 -  {{/if}}\
 -  {{#if md-author}}\
 -  <tr>\
 -    <th>{{mkws-translate "Author"}}</th>\
 -    <td>{{md-author}}</td>\
 -  </tr>\
 -  {{/if}}\
 -  {{#if md-electronic-url}}\
 -  <tr>\
 -    <th>{{mkws-translate "Links"}}</th>\
 -    <td>\
 -      {{#each md-electronic-url}}\
 -        <a href="{{this}}">Link{{mkws-index1}}</a>\
 -      {{/each}}\
 -    </td>\
 -  </tr>\
 -  {{/if}}\
 -  {{#mkws-if-any location having="md-subject"}}\
 -  <tr>\
 -    <th>{{mkws-translate "Subject"}}</th>\
 -    <td>\
 -      {{#mkws-first location having="md-subject"}}\
 -        {{#if md-subject}}\
 -          {{#mkws-commaList md-subject}}\
 -            {{this}}{{/mkws-commaList}}\
 -        {{/if}}\
 -      {{/mkws-first}}\
 -    </td>\
 -  </tr>\
 -  {{/mkws-if-any}}\
 -  <tr>\
 -    <th>{{mkws-translate "Locations"}}</th>\
 -    <td>\
 -      {{#mkws-commaList location}}\
 -        {{mkws-attr "@name"}}{{/mkws-commaList}}\
 -    </td>\
 -  </tr>\
 -</table>\
 -';
 -  } else if (name === "Summary") {
 -    return '\
 -<a href="#" id="{{_id}}" onclick="{{_onclick}}">\
 -  <b>{{md-title}}</b>\
 -</a>\
 -{{#if md-title-remainder}}\
 -  <span>{{md-title-remainder}}</span>\
 -{{/if}}\
 -{{#if md-title-responsibility}}\
 -  <span><i>{{md-title-responsibility}}</i></span>\
 -{{/if}}\
 -{{#if md-date}}, {{md-date}}\
 -{{#if location}}\
 -, {{#mkws-first location}}{{mkws-attr "@name"}}{{/mkws-first}}\
 -{{/if}}\
 -{{#if md-medium}}\
 -<span>, {{md-medium}}</span>\
 -{{/if}}\
 -{{/if}}\
 -';
 -  } else if (name === "Image") {
 -    return '\
 -      <a href="#" id="{{_id}}" onclick="{{_onclick}}">\
 -        {{#mkws-first md-thumburl}}\
 -          <img src="{{this}}" alt="{{../md-title}}"/>\
 -        {{/mkws-first}}\
 -        <br/>\
 -      </a>\
 -';
 -  } else if (name === 'Facet') {
 -    return '\
 -<a href="#"\
 -{{#if fn}}\
 -onclick="mkws.{{fn}}(\'{{team}}\', \'{{field}}\', \'{{term}}\');return false;"\
 -{{/if}}\
 ->{{term}}</a>\
 -<span>{{count}}</span>\
 -';
 -  }
 -
 -  return null;
 -};
 -
 -
  // The following functions are dispatchers for team methods that
  // are called from the UI using a team-name rather than implicit
  // context.
@@@ -311,12 -437,13 +335,13 @@@ mkws.pagerNext = function(tname) 
  
      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;
        }
  
      var widgetSelector = selectorForAllWidgets();
      if (widgetSelector && $(widgetSelector).length !== 0) init();
    });
- })(jQuery);
+ })(mkws.$);
diff --combined src/mkws-team.js
@@@ -386,36 -386,41 +386,36 @@@ function team($, teamName) 
    };
  
  
-   function loadTemplate(name) {
+   function loadTemplate(name, fallbackString) {
      var template = m_template[name];
 -
 -    if (template === undefined) {
 -      // Fall back to generic template if there is no team-specific one
 +    if (template === undefined && Handlebars.compile) {
        var source;
        var node = $(".mkwsTemplate_" + name + " .mkwsTeam_" + that.name());
        if (node && node.length < 1) {
          node = $(".mkwsTemplate_" + name);
        }
 -      if (node) {
 -        source = node.html();
 -      }
 -
 -      // If the template is not defined in HTML, check the following
 -      // in order: template registered in the team by a widget;
 -      // fallback string provided on this invocation; global default.
 -      if (!source) {
 -        source = m_templateText[name];
 -      }
 -      if (!source) {
 -        source = fallbackString;
 -      }
 -      if (!source) {
 -        source = mkws.defaultTemplate(name);
 +      if (node) source = node.html();
 +      if (!source) source = m_templateText[name];
 +      if (source) {
 +        template = Handlebars.compile(source);
 +        log("compiled template '" + name + "'");
        }
 -
 -      if (!source) return null;
 -      template = Handlebars.compile(source);
 -      log("compiled template '" + name + "'");
 +    }
 +    //if (template === undefined) template = mkws_templatesbyteam[m_teamName][name];
 +    if (template === undefined && Handlebars.templates) {
 +      template = Handlebars.templates[name];
 +    }
 +    if (template === undefined && mkws.defaultTemplates) {
 +      template = mkws.defaultTemplates[name];
 +    }
 +    if (template) {
        m_template[name] = template;
 +      return template;
      }
 -
 -    return template;
 +    else {
 +      alert("Missing MKWS template for " + name);
 +    }  
-     }
+   }
    that.loadTemplate = loadTemplate;
  
  
diff --combined src/mkws-templates.js
index 0000000,0000000..86150aa
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,388 @@@
++(function() {
++  var template = Handlebars.template, templates = mkws.defaultTemplates = mkws.defaultTemplates || {};
++templates['Image'] = template(function (Handlebars,depth0,helpers,partials,data) {
++  this.compilerInfo = [4,'>= 1.0.0'];
++helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
++  var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this, helperMissing=helpers.helperMissing;
++
++function program1(depth0,data) {
++  
++  var buffer = "", stack1, helper, options;
++  buffer += "\n  <a href=\"#\" id=\"";
++  if (helper = helpers.detailLinkId) { stack1 = helper.call(depth0, {hash:{},data:data}); }
++  else { helper = (depth0 && depth0.detailLinkId); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
++  buffer += escapeExpression(stack1)
++    + "\" onclick=\"";
++  if (helper = helpers.detailClick) { stack1 = helper.call(depth0, {hash:{},data:data}); }
++  else { helper = (depth0 && depth0.detailClick); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
++  buffer += escapeExpression(stack1)
++    + "\">\n    ";
++  stack1 = (helper = helpers['mkws-first'] || (depth0 && depth0['mkws-first']),options={hash:{},inverse:self.noop,fn:self.programWithDepth(2, program2, data, depth0),data:data},helper ? helper.call(depth0, (depth0 && depth0['md-thumburl']), options) : helperMissing.call(depth0, "mkws-first", (depth0 && depth0['md-thumburl']), options));
++  if(stack1 || stack1 === 0) { buffer += stack1; }
++  buffer += "\n    <br/>\n  </a>\n";
++  return buffer;
++  }
++function program2(depth0,data,depth1) {
++  
++  var buffer = "", stack1;
++  buffer += "\n      <img src=\""
++    + escapeExpression((typeof depth0 === functionType ? depth0.apply(depth0) : depth0))
++    + "\" alt=\""
++    + escapeExpression(((stack1 = (depth1 && depth1['md-title'])),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
++    + "\"/>\n    ";
++  return buffer;
++  }
++
++  buffer += "\n";
++  stack1 = helpers.each.call(depth0, (depth0 && depth0.hits), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
++  if(stack1 || stack1 === 0) { buffer += stack1; }
++  buffer += "\n";
++  return buffer;
++  });
++templates['Record'] = template(function (Handlebars,depth0,helpers,partials,data) {
++  this.compilerInfo = [4,'>= 1.0.0'];
++helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
++  var buffer = "", stack1, helper, options, functionType="function", escapeExpression=this.escapeExpression, helperMissing=helpers.helperMissing, self=this;
++
++function program1(depth0,data) {
++  
++  var buffer = "", stack1, helper;
++  buffer += "\n        (";
++  if (helper = helpers['md-title-remainder']) { stack1 = helper.call(depth0, {hash:{},data:data}); }
++  else { helper = (depth0 && depth0['md-title-remainder']); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
++  buffer += escapeExpression(stack1)
++    + ")\n      ";
++  return buffer;
++  }
++
++function program3(depth0,data) {
++  
++  var buffer = "", stack1, helper;
++  buffer += "\n        <i>";
++  if (helper = helpers['md-title-responsibility']) { stack1 = helper.call(depth0, {hash:{},data:data}); }
++  else { helper = (depth0 && depth0['md-title-responsibility']); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
++  buffer += escapeExpression(stack1)
++    + "</i>\n      ";
++  return buffer;
++  }
++
++function program5(depth0,data) {
++  
++  var buffer = "", stack1, helper, options;
++  buffer += "\n  <tr>\n    <th>"
++    + escapeExpression((helper = helpers['mkws-translate'] || (depth0 && depth0['mkws-translate']),options={hash:{},data:data},helper ? helper.call(depth0, "Date", options) : helperMissing.call(depth0, "mkws-translate", "Date", options)))
++    + "</th>\n    <td>";
++  if (helper = helpers['md-date']) { stack1 = helper.call(depth0, {hash:{},data:data}); }
++  else { helper = (depth0 && depth0['md-date']); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
++  buffer += escapeExpression(stack1)
++    + "</td>\n  </tr>\n  ";
++  return buffer;
++  }
++
++function program7(depth0,data) {
++  
++  var buffer = "", stack1, helper, options;
++  buffer += "\n  <tr>\n    <th>"
++    + escapeExpression((helper = helpers['mkws-translate'] || (depth0 && depth0['mkws-translate']),options={hash:{},data:data},helper ? helper.call(depth0, "Author", options) : helperMissing.call(depth0, "mkws-translate", "Author", options)))
++    + "</th>\n    <td>";
++  if (helper = helpers['md-author']) { stack1 = helper.call(depth0, {hash:{},data:data}); }
++  else { helper = (depth0 && depth0['md-author']); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
++  buffer += escapeExpression(stack1)
++    + "</td>\n  </tr>\n  ";
++  return buffer;
++  }
++
++function program9(depth0,data) {
++  
++  var buffer = "", stack1, helper, options;
++  buffer += "\n  <tr>\n    <th>"
++    + escapeExpression((helper = helpers['mkws-translate'] || (depth0 && depth0['mkws-translate']),options={hash:{},data:data},helper ? helper.call(depth0, "Links", options) : helperMissing.call(depth0, "mkws-translate", "Links", options)))
++    + "</th>\n    <td>\n      ";
++  stack1 = helpers.each.call(depth0, (depth0 && depth0['md-electronic-url']), {hash:{},inverse:self.noop,fn:self.program(10, program10, data),data:data});
++  if(stack1 || stack1 === 0) { buffer += stack1; }
++  buffer += "\n    </td>\n  </tr>\n  ";
++  return buffer;
++  }
++function program10(depth0,data) {
++  
++  var buffer = "", stack1, helper;
++  buffer += "\n        <a href=\""
++    + escapeExpression((typeof depth0 === functionType ? depth0.apply(depth0) : depth0))
++    + "\">Link";
++  if (helper = helpers['mkws-index1']) { stack1 = helper.call(depth0, {hash:{},data:data}); }
++  else { helper = (depth0 && depth0['mkws-index1']); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
++  buffer += escapeExpression(stack1)
++    + "</a>\n      ";
++  return buffer;
++  }
++
++function program12(depth0,data) {
++  
++  var buffer = "", stack1, helper, options;
++  buffer += "\n  <tr>\n    <th>"
++    + escapeExpression((helper = helpers['mkws-translate'] || (depth0 && depth0['mkws-translate']),options={hash:{},data:data},helper ? helper.call(depth0, "Subject", options) : helperMissing.call(depth0, "mkws-translate", "Subject", options)))
++    + "</th>\n    <td>\n      ";
++  stack1 = (helper = helpers['mkws-first'] || (depth0 && depth0['mkws-first']),options={hash:{
++    'having': ("md-subject")
++  },inverse:self.noop,fn:self.program(13, program13, data),data:data},helper ? helper.call(depth0, (depth0 && depth0.location), options) : helperMissing.call(depth0, "mkws-first", (depth0 && depth0.location), options));
++  if(stack1 || stack1 === 0) { buffer += stack1; }
++  buffer += "\n    </td>\n  </tr>\n  ";
++  return buffer;
++  }
++function program13(depth0,data) {
++  
++  var buffer = "", stack1;
++  buffer += "\n        ";
++  stack1 = helpers['if'].call(depth0, (depth0 && depth0['md-subject']), {hash:{},inverse:self.noop,fn:self.program(14, program14, data),data:data});
++  if(stack1 || stack1 === 0) { buffer += stack1; }
++  buffer += "\n      ";
++  return buffer;
++  }
++function program14(depth0,data) {
++  
++  var buffer = "", stack1, helper, options;
++  buffer += "\n          ";
++  stack1 = (helper = helpers['mkws-commaList'] || (depth0 && depth0['mkws-commaList']),options={hash:{},inverse:self.noop,fn:self.program(15, program15, data),data:data},helper ? helper.call(depth0, (depth0 && depth0['md-subject']), options) : helperMissing.call(depth0, "mkws-commaList", (depth0 && depth0['md-subject']), options));
++  if(stack1 || stack1 === 0) { buffer += stack1; }
++  buffer += "\n        ";
++  return buffer;
++  }
++function program15(depth0,data) {
++  
++  var buffer = "";
++  buffer += "\n            "
++    + escapeExpression((typeof depth0 === functionType ? depth0.apply(depth0) : depth0));
++  return buffer;
++  }
++
++function program17(depth0,data) {
++  
++  var buffer = "", helper, options;
++  buffer += "\n        "
++    + escapeExpression((helper = helpers['mkws-attr'] || (depth0 && depth0['mkws-attr']),options={hash:{},data:data},helper ? helper.call(depth0, "@name", options) : helperMissing.call(depth0, "mkws-attr", "@name", options)));
++  return buffer;
++  }
++
++  buffer += "\n<table>\n  <tr>\n    <th>"
++    + escapeExpression((helper = helpers['mkws-translate'] || (depth0 && depth0['mkws-translate']),options={hash:{},data:data},helper ? helper.call(depth0, "Title", options) : helperMissing.call(depth0, "mkws-translate", "Title", options)))
++    + "</th>\n    <td>\n      ";
++  if (helper = helpers['md-title']) { stack1 = helper.call(depth0, {hash:{},data:data}); }
++  else { helper = (depth0 && depth0['md-title']); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
++  buffer += escapeExpression(stack1)
++    + "\n      ";
++  stack1 = helpers['if'].call(depth0, (depth0 && depth0['md-title-remainder']), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
++  if(stack1 || stack1 === 0) { buffer += stack1; }
++  buffer += "\n      ";
++  stack1 = helpers['if'].call(depth0, (depth0 && depth0['md-title-responsibility']), {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data});
++  if(stack1 || stack1 === 0) { buffer += stack1; }
++  buffer += "\n    </td>\n  </tr>\n  ";
++  stack1 = helpers['if'].call(depth0, (depth0 && depth0['md-date']), {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data});
++  if(stack1 || stack1 === 0) { buffer += stack1; }
++  buffer += "\n  ";
++  stack1 = helpers['if'].call(depth0, (depth0 && depth0['md-author']), {hash:{},inverse:self.noop,fn:self.program(7, program7, data),data:data});
++  if(stack1 || stack1 === 0) { buffer += stack1; }
++  buffer += "\n  ";
++  stack1 = helpers['if'].call(depth0, (depth0 && depth0['md-electronic-url']), {hash:{},inverse:self.noop,fn:self.program(9, program9, data),data:data});
++  if(stack1 || stack1 === 0) { buffer += stack1; }
++  buffer += "\n  ";
++  stack1 = (helper = helpers['mkws-if-any'] || (depth0 && depth0['mkws-if-any']),options={hash:{
++    'having': ("md-subject")
++  },inverse:self.noop,fn:self.program(12, program12, data),data:data},helper ? helper.call(depth0, (depth0 && depth0.location), options) : helperMissing.call(depth0, "mkws-if-any", (depth0 && depth0.location), options));
++  if(stack1 || stack1 === 0) { buffer += stack1; }
++  buffer += "\n  <tr>\n    <th>"
++    + escapeExpression((helper = helpers['mkws-translate'] || (depth0 && depth0['mkws-translate']),options={hash:{},data:data},helper ? helper.call(depth0, "Locations", options) : helperMissing.call(depth0, "mkws-translate", "Locations", options)))
++    + "</th>\n    <td>\n      ";
++  stack1 = (helper = helpers['mkws-commaList'] || (depth0 && depth0['mkws-commaList']),options={hash:{},inverse:self.noop,fn:self.program(17, program17, data),data:data},helper ? helper.call(depth0, (depth0 && depth0.location), options) : helperMissing.call(depth0, "mkws-commaList", (depth0 && depth0.location), options));
++  if(stack1 || stack1 === 0) { buffer += stack1; }
++  buffer += "\n    </td>\n  </tr>\n</table>\n";
++  return buffer;
++  });
++templates['Records'] = template(function (Handlebars,depth0,helpers,partials,data) {
++  this.compilerInfo = [4,'>= 1.0.0'];
++helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
++  var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
++
++function program1(depth0,data) {
++  
++  var buffer = "", stack1, helper;
++  buffer += "\n  <div class=\"";
++  if (helper = helpers.containerClass) { stack1 = helper.call(depth0, {hash:{},data:data}); }
++  else { helper = (depth0 && depth0.containerClass); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
++  buffer += escapeExpression(stack1)
++    + "\">\n    <a href=\"#\" id=\"";
++  if (helper = helpers.detailLinkId) { stack1 = helper.call(depth0, {hash:{},data:data}); }
++  else { helper = (depth0 && depth0.detailLinkId); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
++  buffer += escapeExpression(stack1)
++    + "\" onclick=\"";
++  if (helper = helpers.detailClick) { stack1 = helper.call(depth0, {hash:{},data:data}); }
++  else { helper = (depth0 && depth0.detailClick); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
++  buffer += escapeExpression(stack1)
++    + "\">\n      <b>";
++  if (helper = helpers['md-title']) { stack1 = helper.call(depth0, {hash:{},data:data}); }
++  else { helper = (depth0 && depth0['md-title']); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
++  buffer += escapeExpression(stack1)
++    + "</b>\n    </a>\n    ";
++  stack1 = helpers['if'].call(depth0, (depth0 && depth0['md-title-remainder']), {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
++  if(stack1 || stack1 === 0) { buffer += stack1; }
++  buffer += "\n    ";
++  stack1 = helpers['if'].call(depth0, (depth0 && depth0['md-title-responsibility']), {hash:{},inverse:self.noop,fn:self.program(4, program4, data),data:data});
++  if(stack1 || stack1 === 0) { buffer += stack1; }
++  buffer += "\n    ";
++  stack1 = helpers['if'].call(depth0, (depth0 && depth0.renderedDetails), {hash:{},inverse:self.noop,fn:self.program(6, program6, data),data:data});
++  if(stack1 || stack1 === 0) { buffer += stack1; }
++  buffer += "\n  </div>\n";
++  return buffer;
++  }
++function program2(depth0,data) {
++  
++  var buffer = "", stack1, helper;
++  buffer += "\n      <span>";
++  if (helper = helpers['md-title-remainder']) { stack1 = helper.call(depth0, {hash:{},data:data}); }
++  else { helper = (depth0 && depth0['md-title-remainder']); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
++  buffer += escapeExpression(stack1)
++    + "</span>\n    ";
++  return buffer;
++  }
++
++function program4(depth0,data) {
++  
++  var buffer = "", stack1, helper;
++  buffer += "\n      <span><i>";
++  if (helper = helpers['md-title-responsibility']) { stack1 = helper.call(depth0, {hash:{},data:data}); }
++  else { helper = (depth0 && depth0['md-title-responsibility']); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
++  buffer += escapeExpression(stack1)
++    + "</i></span>\n    ";
++  return buffer;
++  }
++
++function program6(depth0,data) {
++  
++  var buffer = "", stack1, helper;
++  buffer += "\n      ";
++  if (helper = helpers.renderedDetails) { stack1 = helper.call(depth0, {hash:{},data:data}); }
++  else { helper = (depth0 && depth0.renderedDetails); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
++  if(stack1 || stack1 === 0) { buffer += stack1; }
++  buffer += "\n    ";
++  return buffer;
++  }
++
++  buffer += "\n";
++  stack1 = helpers.each.call(depth0, (depth0 && depth0.hits), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
++  if(stack1 || stack1 === 0) { buffer += stack1; }
++  buffer += "\n";
++  return buffer;
++  });
++templates['Reference'] = template(function (Handlebars,depth0,helpers,partials,data) {
++  this.compilerInfo = [4,'>= 1.0.0'];
++helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
++  var buffer = "", stack1, helper, options, functionType="function", escapeExpression=this.escapeExpression, self=this, helperMissing=helpers.helperMissing;
++
++function program1(depth0,data) {
++  
++  var buffer = "", stack1, helper;
++  buffer += "\n<b>";
++  if (helper = helpers['md-title-remainder']) { stack1 = helper.call(depth0, {hash:{},data:data}); }
++  else { helper = (depth0 && depth0['md-title-remainder']); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
++  buffer += escapeExpression(stack1)
++    + "</b>\n";
++  return buffer;
++  }
++
++function program3(depth0,data) {
++  
++  var buffer = "", stack1, helper;
++  buffer += "\n<i>";
++  if (helper = helpers['md-title-responsibility']) { stack1 = helper.call(depth0, {hash:{},data:data}); }
++  else { helper = (depth0 && depth0['md-title-responsibility']); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
++  buffer += escapeExpression(stack1)
++    + "</i>\n";
++  return buffer;
++  }
++
++  buffer += "\n<img src=\"";
++  if (helper = helpers['md-thumburl']) { stack1 = helper.call(depth0, {hash:{},data:data}); }
++  else { helper = (depth0 && depth0['md-thumburl']); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
++  buffer += escapeExpression(stack1)
++    + "\" alt=\"";
++  if (helper = helpers['md-title']) { stack1 = helper.call(depth0, {hash:{},data:data}); }
++  else { helper = (depth0 && depth0['md-title']); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
++  buffer += escapeExpression(stack1)
++    + "\">\n<h1><a href=\"";
++  if (helper = helpers['md-electronic-url']) { stack1 = helper.call(depth0, {hash:{},data:data}); }
++  else { helper = (depth0 && depth0['md-electronic-url']); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
++  buffer += escapeExpression(stack1)
++    + "\">";
++  if (helper = helpers['md-title']) { stack1 = helper.call(depth0, {hash:{},data:data}); }
++  else { helper = (depth0 && depth0['md-title']); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
++  buffer += escapeExpression(stack1)
++    + "</a></h1>\n";
++  stack1 = helpers['if'].call(depth0, (depth0 && depth0['md-title-remainder']), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
++  if(stack1 || stack1 === 0) { buffer += stack1; }
++  buffer += "\n";
++  stack1 = helpers['if'].call(depth0, (depth0 && depth0['md-title-responsibility']), {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data});
++  if(stack1 || stack1 === 0) { buffer += stack1; }
++  buffer += "\n";
++  stack1 = (helper = helpers['mkws-paragraphs'] || (depth0 && depth0['mkws-paragraphs']),options={hash:{},data:data},helper ? helper.call(depth0, (depth0 && depth0['md-description']), (depth0 && depth0.paragraphs), (depth0 && depth0.sentences), options) : helperMissing.call(depth0, "mkws-paragraphs", (depth0 && depth0['md-description']), (depth0 && depth0.paragraphs), (depth0 && depth0.sentences), options));
++  if(stack1 || stack1 === 0) { buffer += stack1; }
++  buffer += "\n<p class=\"mkwsCredit\">Wikipedia</p>\n";
++  return buffer;
++  });
++templates['Facet'] = template(function (Handlebars,depth0,helpers,partials,data) {
++  this.compilerInfo = [4,'>= 1.0.0'];
++helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
++  var buffer = "", stack1, helper, functionType="function", escapeExpression=this.escapeExpression, self=this;
++
++function program1(depth0,data) {
++  
++  var buffer = "", stack1, helper;
++  buffer += "\n  <div class=\"mkwsTerm\">\n    <a href=\"#\" ";
++  if (helper = helpers.linkdata) { stack1 = helper.call(depth0, {hash:{},data:data}); }
++  else { helper = (depth0 && depth0.linkdata); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
++  buffer += escapeExpression(stack1)
++    + ">";
++  if (helper = helpers.term) { stack1 = helper.call(depth0, {hash:{},data:data}); }
++  else { helper = (depth0 && depth0.term); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
++  buffer += escapeExpression(stack1)
++    + "</a> <span>";
++  if (helper = helpers.count) { stack1 = helper.call(depth0, {hash:{},data:data}); }
++  else { helper = (depth0 && depth0.count); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
++  buffer += escapeExpression(stack1)
++    + "</span>\n  </div>\n";
++  return buffer;
++  }
++
++  buffer += "\n\n<div class=\"mkwsFacetTitle\">";
++  if (helper = helpers.caption) { stack1 = helper.call(depth0, {hash:{},data:data}); }
++  else { helper = (depth0 && depth0.caption); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
++  buffer += escapeExpression(stack1)
++    + "</div>\n";
++  stack1 = helpers.each.call(depth0, (depth0 && depth0.terms), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
++  if(stack1 || stack1 === 0) { buffer += stack1; }
++  buffer += "\n";
++  return buffer;
++  });
++templates['Termlists'] = template(function (Handlebars,depth0,helpers,partials,data) {
++  this.compilerInfo = [4,'>= 1.0.0'];
++helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
++  var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
++
++function program1(depth0,data,depth1) {
++  
++  var buffer = "", stack1, helper;
++  buffer += "\n  <div class=\"mkwsFacet mkwsTeam_"
++    + escapeExpression(((stack1 = (depth1 && depth1.team)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
++    + "\" data-mkws-facet=\"";
++  if (helper = helpers.name) { stack1 = helper.call(depth0, {hash:{},data:data}); }
++  else { helper = (depth0 && depth0.name); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
++  buffer += escapeExpression(stack1)
++    + "\"></div>\n";
++  return buffer;
++  }
++
++  buffer += "\n\n<div class=\"mkwsTermlistsTitle\">Termlists</div>\n";
++  stack1 = helpers.each.call(depth0, (depth0 && depth0.facets), {hash:{},inverse:self.noop,fn:self.programWithDepth(1, program1, data, depth0),data:data});
++  if(stack1 || stack1 === 0) { buffer += stack1; }
++  buffer += "\n";
++  return buffer;
++  });
++})();
diff --combined src/mkws-widget-main.js
@@@ -116,26 -116,28 +116,26 @@@ mkws.registerWidgetType('Records', func
    var team = this.team;
  
    this.team.queue("records").subscribe(function(data) {
      for (var i = 0; i < data.hits.length; i++) {
        var hit = data.hits[i];
        that.team.queue("record").publish(hit);
 -      var divId = team.recordElementId(hit.recid[0]);
 -      html.push('<div class="mkwsSummary mkwsTeam_' + team.name() + ' ' + divId + '">', renderSummary(hit), '</div>');
 +      hit.detailLinkId = team.recordElementId(hit.recid[0]);
 +      hit.detailClick = "mkws.showDetails('" + team.name() + "', '" + hit.recid[0] + "');return false;"
 +      hit.containerClass = "mkwsSummary mkwsTeam_" + team.name();
 +      hit.containerClass += " " + hit.detailLinkId;
        // ### At some point, we may be able to move the
        // m_currentRecordId and m_currentRecordData members
        // from the team object into this widget.
        if (hit.recid == team.currentRecordId()) {
 -        if (team.currentRecordData())
 -          html.push(team.renderDetails(team.currentRecordData()));
 +        if (team.currentRecordData()) {
 +          hit.renderedDetails = team.renderDetails(team.currentRecordData());
 +          console.log(hit.renderedDetails); 
 +        } 
        }
      }
 -    that.node.html(html.join(''));
 -
 -    function renderSummary(hit) {
 -      var template = team.loadTemplate(that.config.template || "Summary");
 -      hit._id = team.recordElementId(hit.recid[0]);
 -      hit._onclick = "mkws.showDetails('" + team.name() + "', '" + hit.recid[0] + "');return false;"
 -      return template(hit);
 -    }
 +    var template = team.loadTemplate(that.config.template || "Records");
 +    var targs = $.extend({}, {"hits": data.hits}, that.config.template_vars);
 +    that.node.html(template(targs));
    });
  
    that.autosearch();
@@@ -429,7 -431,7 +429,7 @@@ mkws.registerWidgetType('Progress', fun
          s += '</span>';
          s += '<span class="mkwsWaiting">';
        }
-       s += '&#x2588';
+       s += '&#x2588;';
      }
      s += '</span>';
      that.node.html(s);
diff --combined tools/htdocs/Makefile
index 0000000,388a4b8..02d64f8
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,98 +1,102 @@@
+ # Copyright (c) 2013-2014 IndexData ApS. http://indexdata.com
+ SRC=   ../../src
+ HANDLEBARS_FILE = handlebars-v1.1.2.js
+ JQUERY_FILE = jquery-1.10.0.min.js
+ JQUERY_JSON_FILE = jquery.json-2.4.js
+ PP2_FILE = pz2.js
+ HANDLEBARS_URL = http://builds.handlebarsjs.com.s3.amazonaws.com/${HANDLEBARS_FILE}
+ JQUERY_URL = http://code.jquery.com/${JQUERY_FILE}
+ JQUERY_JSON_URL = https://jquery-json.googlecode.com/files/${JQUERY_JSON_FILE}
+ PP2_URL = http://git.indexdata.com/?p=pazpar2.git;a=blob_plain;f=js/${PP2_FILE};hb=HEAD
+ JQUERY_UI_URL =       http://code.jquery.com/ui/1.10.3/jquery-ui.js
+ VERSION = $(shell tr -d '\012' < ${SRC}/VERSION)
+ COMPONENTS = ${SRC}/mkws-handlebars.js \
+       ${SRC}/mkws-core.js ${SRC}/mkws-team.js ${SRC}/mkws-filter.js \
++      ${SRC}/mkws-templates.js \
+       ${SRC}/mkws-widget.js ${SRC}/mkws-widget-main.js ${SRC}/mkws-widget-termlists.js \
+       ${SRC}/mkws-widget-authname.js ${SRC}/mkws-widget-categories.js ${SRC}/mkws-widget-log.js \
+       ${SRC}/mkws-widget-record.js ${SRC}/mkws-widget-reference.js ${SRC}/mkws-widget-builder.js
+ GENERATED = ${HANDLEBARS_FILE} ${JQUERY_FILE} ${JQUERY_JSON_FILE} ${PP2_FILE} \
 -      mkws.js mkws.min.js mkws-complete.js mkws-complete.min.js
++      mkws.js mkws.min.js mkws-complete.js mkws-complete.min.js mkws-templates.js
+ **make-default**: all
+ all: mkws.min.js mkws-complete.min.js
+ mkws-js mkws-complete.js: Makefile mkws.js ${SRC}/mkws-jquery.js ${HANDLEBARS_FILE} ${JQUERY_FILE} ${JQUERY_JSON_FILE} ${PP2_FILE}
+       ( set -e; \
+         echo "/*! Copyright (c) 2013-2014 IndexData ApS. http://indexdata.com"; \
+         echo "   Licence: GPL, http://www.indexdata.com/licences/gpl"; \
+         echo "   created at: $$(date)"; \
+         echo "   MKWS GIT id: $$(git show | head -n 1 | perl -npe 's,\S+\s+,,')"; \
+         echo "   pz2.js GIT id: $$(curl -sSf 'http://git.indexdata.com/?p=pazpar2.git;a=rss' | egrep '<guid' | head -1 | perl -ne 'print "$$1\n" if m,.*=([0-9a-f]+)</guid>,')"; \
+         echo "*/"; \
+         cat ${JQUERY_FILE}; \
+         cat ${JQUERY_JSON_FILE}; \
+         echo 'mkws_jQuery = jQuery.noConflict(true);'; \
+         cat ${HANDLEBARS_FILE}; \
+         cat ${PP2_FILE}; \
+         cat  mkws.js; \
+         cat  ${SRC}/mkws-jquery.js; \
+       ) > mkws-complete.js.tmp
+       mv -f mkws-complete.js.tmp mkws-complete.js
+ %.min.js: %.js
+       yui-compressor $? > $@.tmp
+       mv -f $@.tmp $@
+ mkws-syntax-check:
+       yui-compressor mkws.js >/dev/null
+ ${HANDLEBARS_FILE}:
+       curl -sSf ${HANDLEBARS_URL} -o $@.tmp
+       mv -f $@.tmp $@
+ ${JQUERY_FILE}:
+       curl -sSf ${JQUERY_URL} -o $@.tmp
+       perl -npe 's,sourceMappingURL=jquery.*map,,' $@.tmp > $@
+       rm -f $@.tmp
+ ${JQUERY_JSON_FILE}:
+       curl -sSf ${JQUERY_JSON_URL} -o $@.tmp
+       mv -f $@.tmp $@
+ ${PP2_FILE}:
+       curl -sSf "${PP2_URL}" -o $@.tmp
+       mv -f $@.tmp $@
+ release: mkws.js mkws-complete.js mkws.min.js mkws-complete.min.js
+       @if [ -f ${SRC}/releases/mkws-$(VERSION).js ]; then \
+               echo "*** There is already a release $(VERSION)"; \
+       else \
+               cp -p mkws.js ${SRC}/releases/mkws-$(VERSION).js; \
+               cp -p mkws.min.js ${SRC}/releases/mkws-$(VERSION).min.js; \
+               cp -p mkws-complete.js ${SRC}/releases/mkws-complete-$(VERSION).js; \
+               cp -p mkws-complete.min.js ${SRC}/releases/mkws-complete-$(VERSION).min.js; \
+               echo "Made release $(VERSION)"; \
+       fi
 -mkws.js: $(COMPONENTS) Makefile
++mkws.js: mkws-templates.js $(COMPONENTS) Makefile
+       rm -f $@
+       cat ${COMPONENTS} > $@.tmp
+       mv -f $@.tmp $@
+       chmod 444 $@
++mkws-templates.js:
++      handlebars -n mkws.defaultTemplates ${SRC}/*.templates/*.handlebars -f ${SRC}/mkws-templates.js
++
+ distclean: clean
+       @echo "(No need for distclean, 'make clean' is fine)"
+ clean:
+       rm -f ${GENERATED}
+ help:
+       @echo "make [ all | release | clean | distclean ]"
+       @echo "     [ mkws-syntax-check ]"