1 <?xml version="1.0" encoding="UTF-8"?>
4 <!-- String selection from user input -->
5 <widget-family name="string-input" datatype="text">
6 <label>String matching from user input</label>
9 <label>Exactly match a user supplied string</label>
11 This widget filters a column based on an exact string
16 <widget name="multistring">
17 <label>Exactly match one of several user supplied strings</label>
19 This widget filters a column based on an set of strings.
23 <widget name="initial-substring">
24 <label>Match the begining of a string from user input</label>
26 This widget filters a column based on an initial substring
33 <!-- String selection from in-database data -->
34 <widget-family name="string-choose" datatype="text">
35 <label>String filter from known data</label>
37 <widget name="dropdown">
38 <label>Exactly match a string chosen from a dropdown</label>
40 This widget filters a column based on an exact string match.
44 <widget name="multiselect">
45 <label>Match multiple strings chosen from a multiselect box</label>
47 This widget filters a column based on multiple strings.
52 <!-- Comparative time range selection -->
53 <widget-family name="comparative-timerange" datatype="timestamptz">
54 <label>Comparative time-range widgets</label>
57 <label>Compare runtime relative time months</label>
59 This widget allows the user to pick an arbitrary time range
62 <filter-code type="perl">
63 $full_col = "CAST(DATE_TRUNC('month', $full_col) AS DATE)";
65 "$full_col IN ( CAST(DATE_TRUNC('month', NOW() - CAST( ? || ' month' AS INTERVAL )) AS DATE), ".
66 " CAST(DATE_TRUNC('month', NOW() - CAST( ? || ' month' AS INTERVAL )) AS DATE))";
67 push @$bind_list, $$val{target}, $$val{target} + $$val{compare};
72 <!-- Specific time range selection family -->
73 <widget-family name="specific-timerange" datatype="timestamptz">
74 <label>Specific time-range widgets</label>
78 <label>User defined time range</label>
80 This widget allows the user to pick an arbitrary time range
87 <label>Choose a specific date</label>
89 This widget allows the user to pick a specific date on which
92 <filter-code type="perl">
93 $full_col = "DATE_TRUNC('day', $full_col)";
94 $where_clause = "$full_col = CAST(? AS DATE)";
95 push @$bind_list, sprintf('%d/%02d/%02d', @$val{qw/year month day/});
100 <label>Choose a specific week of the year</label>
102 This widget allows the user to pick a specific week of the year
105 <filter-code type="perl">
107 "( EXTRACT('year' FROM $full_col) = ? ".
108 " AND EXTRACT('week' FROM $full_col) = ? )";
109 push @$bind_list, $$val{year}, $$val{week};
113 <widget name="multiweek">
114 <label>Choose a range of weeks of the year</label>
116 This widget allows the user to pick a range of weeks of the year
119 <filter-code type="perl">
121 "( EXTRACT('year' FROM $full_col) = ? ".
122 " AND EXTRACT('week' FROM $full_col) ".
124 push @$bind_list, $$val{year}, $$val{start}, $$val{end};
128 <widget name="month">
129 <label>Choose a specific year and month</label>
131 This widget allows the user to pick a specific year and month
134 <filter-code type="perl">
136 "( EXTRACT('year' FROM $full_col) = ? ".
137 " AND EXTRACT('month' FROM $full_col) = ? )";
138 push @$bind_list, $$val{'start-year'}, $$val{'start-month'};
142 <widget name="multimonth">
143 <label>Choose a range of months</label>
145 This widget allows the user to pick a range of month on which to
148 <filter-code type="perl">
150 "DATE_TRUNC('month', $full_col) ".
151 "BETWEEN CAST(? AS DATE) AND CAST(? AS DATE)";
153 sprintf('%d/%02d/01', @$val{qw/start-year start-month/}),
154 sprintf('%d/%02d/01', @$val{qw/end-year end-month/});
159 <widget name="quarter">
160 <label>Choose a specific year and quarter</label>
162 This widget allows the user to pick a specific year and
163 quarter on which to report.
167 <widget name="multiquarter">
168 <label>Choose a range of quarters</label>
170 This widget allows the user to pick a range of quarter on which
177 <label>Choose a specific year</label>
179 This widget allows the user to pick a specific year on which to
182 <filter-code type="perl">
183 $where_clause = "EXTRACT('year' FROM $full_col) = ?";
184 push @$bind_list, $val;
188 <widget name="multiyear">
189 <label>Choose a range of years</label>
191 This widget allows the user to pick a range of years on which to
194 <filter-code type="perl">
195 $where_clause = "EXTRACT('year' FROM $full_col) BETWEEN ? AND ?";
196 push @$bind_list, $$val{year}, $$val{year} + $$val{year-count};
201 <!-- Specific time range selection family -->
202 <widget-family name="relative-timerange" datatype="timestamptz">
203 <label>Relative time-range widgets</label>
206 <label>Choose a date relative to the report runtime</label>
208 This widget allows the user to pick a date relative to the
209 report runtime on which to report.
211 <filter-code type="perl">
213 "CAST($full_col AS DATE) = ".
214 "CAST((NOW() - CAST(? || ' day' AS INTERVAL)) AS DATE)";
215 push @$bind_list, $val;
220 <label>Choose a week (sun-sat) relative to the report runtime</label>
222 This widget allows the user to pick a week (sun-sat) relative
223 to the report runtime on which to report.
225 <filter-code type="perl">
227 "( CAST(DATE_TRUNC('week', $full_col) AS DATE) = ".
228 " CAST(DATE_TRUNC('week', NOW() - CAST(? || ' weeks' AS INTERVAL) ) AS DATE) ";
229 push @$bind_list, $val;
233 <widget name="month">
234 <label>Choose a month relative to the report runtime</label>
236 This widget allows the user to pick a month relative to the
237 report runtime on which to report.
239 <filter-code type="perl">
241 "CAST(DATE_TRUNC('month', $full_col) AS DATE) = ".
242 "CAST(DATE_TRUNC('month', NOW()) - CAST(? || ' months' AS INTERVAL) AS DATE)";
243 push @$bind_list, $val;
248 <widget name="quarter">
249 <label>Choose a quarter relative to the report runtime</label>
251 This widget allows the user to pick a quarter relative to the
252 report runtime on which to report.
258 <label>Choose a year relative to the report runtime</label>
260 This widget allows the user to pick a year relative to the
261 report runtime on which to report.
263 <filter-code type="perl">
265 "CAST(DATE_TRUNC('year', $full_col) AS DATE)= ".
266 "CAST(DATE_TRUNC('year', NOW()) - CAST(? || ' years' AS INTERVAL) AS DATE)";
267 push @$bind_list, $val;
272 <!-- Library selection from in-database data - special to OpenILS -->
273 <widget-family name="lib-choose" datatype="text">
274 <label>String filter from known data</label>
276 <widget name="dropdown">
277 <label>Exactly match a Library chosen from a dropdown</label>
279 This widget filters on an exact Library Name match.
283 <widget name="multiselect">
284 <label>Match multiple Libraries chosen from a multiselect box</label>
286 This widget filters based on multiple Library names.