1 [%- USE money = format(l('$%.2f'));
6 SET DATE_FORMAT = l('%m/%d/%Y');
7 PROCESS "opac/parts/config.tt2";
9 # Don't wrap in l() here; do that where this format string is actually used.
10 SET HUMAN_NAME_FORMAT = '[_1] [_2] [_3] [_4] [_5]';
12 is_advanced = CGI.param("_adv").size;
13 is_special = CGI.param("_special").size;
15 # -----------------------------------------------------------------------------
16 # mkurl( destination_page, params_to_set, params_to_clear )
18 # Current page, updated params:
19 # mkurl('', {foo => 'bar', boo => 'baz'});
21 # New page, one param is a list:
22 # mkurl('http://flarg.baz/squz', {foo => 'bar', boo => ['baz', 'faz']});
24 # New page, clear all existing params before applying new ones:
25 # mkurl('/fuz/buster', {foo => 'bar', boo => 'baz'}, 1);
27 # Current page, clear 'some_param' from the existing params:
28 # mkurl('', {foo => 'bar', boo => 'baz'}, ['some_param']);
30 # Current page to a named anchor 'copies'
31 # mkurl('', {}, [], 'copies');
32 MACRO mkurl(page, params, clear_params, named_anchor) BLOCK;
34 # clone the query string to avoid clobberation
35 cgi = CGI.new(CGI.query_string);
37 # remove requested params
38 IF clear_params.0; # array
39 FOR p IN clear_params; cgi.delete(p); END;
44 # x and y are artifacts of using <input type="image" /> tags
45 # instead of true submit buttons, and their values are never used.
53 # The following commented-out line can be fooled. Its replacement
54 # below is what you really mean.
55 # list = (params.$k.0 OR max == -1) ? params.$k : [params.$k];
56 list = params.$k.list;
58 IF list.size == 0; NEXT; END;
59 # CGI croaks on already-decoded strings. force-encode to be safe.
60 FOR p IN list; encoded.push(ctx.encode_utf8(p)); END;
61 foo = cgi.param("-name", k, "-values", encoded);
64 # for url brevity, remove any params that have no value
67 IF val == ''; cgi.delete(p); END;
69 # Delete POST vars unless we asked for them
70 UNLESS CGI.url_param(p).defined OR params.defined(p);
75 final = named_anchor ? '#' _ named_anchor : '';
79 page _ '?' _ cgi.query_string _ final;
84 # staying on the current page
85 cgi.url("-path" => 1, "-query" => 1) _ final;
89 # Whether we want Dojo or not may one day be a wholly distinct
90 # concern from whether we want autosuggest, so let's get used to
91 # defining that separately.
94 use_autosuggest = ctx.get_cgf("opac.use_autosuggest");
96 IF use_autosuggest.enabled == "t";