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 #variables to use to remove parameters via mkurk
16 expert_search_parms = ['tag','subfield','term','_special'];
17 general_search_parms = ['page','sort','query'];
19 # -----------------------------------------------------------------------------
20 # mkurl( destination_page, params_to_set, params_to_clear )
22 # Current page, updated params:
23 # mkurl('', {foo => 'bar', boo => 'baz'});
25 # New page, one param is a list:
26 # mkurl('http://flarg.baz/squz', {foo => 'bar', boo => ['baz', 'faz']});
28 # New page, clear all existing params before applying new ones:
29 # mkurl('/fuz/buster', {foo => 'bar', boo => 'baz'}, 1);
31 # Current page, clear 'some_param' from the existing params:
32 # mkurl('', {foo => 'bar', boo => 'baz'}, ['some_param']);
34 # Current page to a named anchor 'copies'
35 # mkurl('', {}, [], 'copies');
36 MACRO mkurl(page, params, clear_params, named_anchor) BLOCK;
38 # clone the query string to avoid clobberation
39 cgi = CGI.new(CGI.query_string);
41 # remove requested params
42 IF clear_params.0; # array
43 FOR p IN clear_params; cgi.delete(p); END;
48 # x and y are artifacts of using <input type="image" /> tags
49 # instead of true submit buttons, and their values are never used.
57 # The following commented-out line can be fooled. Its replacement
58 # below is what you really mean.
59 # list = (params.$k.0 OR max == -1) ? params.$k : [params.$k];
60 list = params.$k.list;
62 IF list.size == 0; NEXT; END;
63 # CGI croaks on already-decoded strings. force-encode to be safe.
64 FOR p IN list; encoded.push(ctx.encode_utf8(p)); END;
65 foo = cgi.param("-name", k, "-values", encoded);
68 # for url brevity, remove any params that have no value
71 IF val == ''; cgi.delete(p); END;
73 # Delete POST vars unless we asked for them
74 UNLESS CGI.url_param(p).defined OR params.defined(p);
79 final = named_anchor ? '#' _ named_anchor : '';
83 page _ '?' _ cgi.query_string _ final;
88 # staying on the current page
89 cgi.url("-absolute" => 1, "-path" => 1, "-query" => 1) _ final;
93 # Dojo is required to use the copy locations advanced search filter,
94 # therefore, it should always be enabled.
97 use_autosuggest = ctx.get_cgf("opac.use_autosuggest");
99 IF use_autosuggest.enabled == "t";
103 IF ctx.google_books_preview;
107 IF ENV.OILS_NOVELIST_URL;
111 # Especially useful for image 'alt' tags and link title tags,
112 # where the content may need to be unique (making it longer)
113 # but should not exceed 75 chars for ideal screen reader support.
114 # usage: html_text_attr('title', 'Link to item I Have A Super Long Title')
115 # the full HTML attribute key="value" is produced
116 MACRO html_text_attr(name, value) BLOCK;
117 IF value.length >= 75;
118 value = value.substr(71, value.length, '...');
120 value = value.replace('\s*$', ''); # remove trailing whitespace
121 HTML.attributes($name => value);
124 MACRO img_alt(text) BLOCK;
125 html_text_attr('alt', text);