X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=tools%2Fhtdocs%2Fmkws.js;h=cacc8d0825eb4b4c0a69b439d4c8b7736107903e;hb=eefc46271d6bb1c57317f657be87eaa6b5b08857;hp=3c43d505e8f6cdc84a37e46d62c1e6ffc936ceea;hpb=94e3edddd6843de38e900c53cb507aa442885b64;p=mkws-moved-to-github.git diff --git a/tools/htdocs/mkws.js b/tools/htdocs/mkws.js index 3c43d50..cacc8d0 100644 --- a/tools/htdocs/mkws.js +++ b/tools/htdocs/mkws.js @@ -108,6 +108,12 @@ Handlebars.registerHelper('json', function(obj) { }); +Handlebars.registerHelper('translate', function(s) { + debug("translating '" + s + "'"); + return M(s); +}); + + // We need {{attr '@name'}} because Handlebars can't parse {{@name}} Handlebars.registerHelper('attr', function(attrName) { return this[attrName]; @@ -495,8 +501,16 @@ function triggerSearch (query, sort, targets, windowid) } } - debug("triggerSearch(" + mkws.query + "): filters = " + $.toJSON(mkws.filters) + ", pp2filter = " + pp2filter + ", pp2limit = " + pp2limit); - my_paz.search(mkws.query, recPerPage, mkws.sort, pp2filter, undefined, { limit: pp2limit }); + var params = {}; + if (pp2limit) { + params.limit = pp2limit; + } + if (windowid) { + params.windowid = windowid; + } + debug("triggerSearch(" + mkws.query + "): filters = " + $.toJSON(mkws.filters) + ", pp2filter = " + pp2filter + ", params = " + $.toJSON(params)); + + my_paz.search(mkws.query, recPerPage, mkws.sort, pp2filter, undefined, params); } function loadSelect () @@ -774,7 +788,7 @@ function defaultTemplate(name) return '\ \ \ - \ + \ \ {{#if md-date}}\ \ - \ + \ \ \ {{/if}}\ {{#if md-author}}\ \ - \ + \ \ \ {{/if}}\ {{#if md-electronic-url}}\ \ - \ + \ \ - \ + \ \ {{/if-any}}\ \ - \ + \
Title{{translate "Title"}}\ {{md-title}}\ {{#if md-title-remainder}}\ @@ -787,19 +801,19 @@ function defaultTemplate(name)
Date{{translate "Date"}}{{md-date}}
Author{{translate "Author"}}{{md-author}}
URL{{translate "URL"}}\ {{#each md-electronic-url}}\ {{this}}
\ @@ -809,7 +823,7 @@ function defaultTemplate(name) {{/if}}\ {{#if-any location having="md-subject"}}\
Subject{{translate "Subject"}}\ {{#first location having="md-subject"}}\ {{#if md-subject}}\ @@ -820,7 +834,7 @@ function defaultTemplate(name)
Locations{{translate "Locations"}}\ {{#commaList location}}\ {{attr "@name"}}{{/commaList}}\