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','bool','contains','pubdate'];
18 browse_search_parms = ['fi:has_browse_entry','bterm','blimit','bpivot'];
19 facet_search_parms = ['facet'];
22 # -----------------------------------------------------------------------------
23 # mkurl( destination_page, params_to_set, params_to_clear )
25 # Current page, updated params:
26 # mkurl('', {foo => 'bar', boo => 'baz'});
28 # New page, one param is a list:
29 # mkurl('http://flarg.baz/squz', {foo => 'bar', boo => ['baz', 'faz']});
31 # New page, clear all existing params before applying new ones:
32 # mkurl('/fuz/buster', {foo => 'bar', boo => 'baz'}, 1);
34 # Current page, clear 'some_param' from the existing params:
35 # mkurl('', {foo => 'bar', boo => 'baz'}, ['some_param']);
37 # Current page to a named anchor 'copies'
38 # mkurl('', {}, [], 'copies');
39 MACRO mkurl(page, params, clear_params, named_anchor) BLOCK;
41 # clone the query string to avoid clobberation
42 cgi = CGI.new(CGI.query_string);
44 # remove requested params
45 IF clear_params.0; # array
46 FOR p IN clear_params; cgi.delete(p); END;
51 # x and y are artifacts of using <input type="image" /> tags
52 # instead of true submit buttons, and their values are never used.
60 # The following commented-out line can be fooled. Its replacement
61 # below is what you really mean.
62 # list = (params.$k.0 OR max == -1) ? params.$k : [params.$k];
63 list = params.$k.list;
65 IF list.size == 0; NEXT; END;
66 # CGI croaks on already-decoded strings. force-encode to be safe.
67 FOR p IN list; encoded.push(ctx.encode_utf8(p)); END;
68 foo = cgi.param("-name", k, "-values", encoded);
71 # for url brevity, remove any params that have no value
74 IF val == ''; cgi.delete(p); END;
76 # Delete POST vars unless we asked for them
77 UNLESS CGI.url_param(p).defined OR params.defined(p);
82 final = named_anchor ? '#' _ named_anchor : '';
86 page _ '?' _ cgi.query_string _ final;
91 # staying on the current page
92 cgi.url("-absolute" => 1, "-path" => 1, "-query" => 1) _ final;
96 # Dojo is required to use the copy locations advanced search filter,
97 # therefore, it should always be enabled.
100 use_autosuggest = ctx.get_cgf("opac.use_autosuggest");
102 IF use_autosuggest.enabled == "t";
106 IF ctx.google_books_preview;
110 IF ENV.OILS_NOVELIST_URL;
114 # Especially useful for image 'alt' tags and link title tags,
115 # where the content may need to be unique (making it longer)
116 # but should not exceed 75 chars for ideal screen reader support.
117 # usage: html_text_attr('title', 'Link to item I Have A Super Long Title')
118 # the full HTML attribute key="value" is produced
119 MACRO html_text_attr(name, value) BLOCK;
120 IF value.length >= 75;
121 value = value.substr(71, value.length, '...');
123 value = value.replace('\s*$', ''); # remove trailing whitespace
124 HTML.attributes($name => value);
127 MACRO img_alt(text) BLOCK;
128 html_text_attr('alt', text);