1 [%- USE money = format(l('$%.2f'));
5 SET DATE_FORMAT = l('%m/%d/%Y');
7 # Don't wrap in l() here; do that where this format string is actually used.
8 SET HUMAN_NAME_FORMAT = '[_1] [_2] [_3] [_4] [_5]';
10 # x and y are artifacts of using <input type="image" /> tags instead of
11 # true submit buttons, and their values are never used. page is used, but
12 # currently none of the use cases for rendering the query_string back
13 # into page output call for propagating the value of the page variable.
15 query_string = CGI.query_string |
16 replace(';x=\d+','') | replace(';y=\d+','') | replace(';page=\d*', '') |
17 replace(';', '&') | replace('&', '&');
19 propagator = '?' _ query_string;
21 is_advanced = CGI.param("_adv").size;
22 is_special = CGI.param("_special").size;
24 # -----------------------------------------------------------------------------
27 # Current page, updated params:
28 # mkurl('', {foo => 'bar', boo => 'baz'});
30 # New page, one param is a list:
31 # mkurl('http://flarg.baz/squz', {foo => 'bar', boo => ['baz', 'faz']});
33 # New page, clear all existing params before applying new ones:
34 # mkurl('/fuz/buster', {foo => 'bar', boo => 'baz'}, 1);
36 # Current page, clear the 'some_param' from the existing params:
37 # mkurl('', {foo => 'bar', boo => 'baz'}, ['some_param']);
38 MACRO mkurl(page, params, clear_params) BLOCK;
40 # clone the query string to avoid clobberation
41 cgi = CGI.new(CGI.query_string);
43 # remove requested params
44 IF clear_params.0; # array
45 FOR p IN clear_params; cgi.delete(p); END;
50 # always remove these pesky artifacts
55 foo = cgi.param("-name", k, "-values", params.$k);
58 # for url brevity, remove any params that have no value
61 IF val == ''; cgi.delete(p); END;
65 page _ '?' _ cgi.query_string;
67 cgi.url("-path" => 1, "-query" => 1);