]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/reporter/widgets.example.xml
c17df24bab772eb7809b2314d9fe3a7e0df3681b
[Evergreen.git] / Open-ILS / src / reporter / widgets.example.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <widgets>
3         
4         <!-- String selection from user input -->
5         <widget-family name="string-input" datatype="text">
6                 <label>String matching from user input</label>
7         
8                 <widget name="exact">
9                         <label>Exactly match a user supplied string</label>
10                         <description>
11                                 This widget filters a column based on an exact string
12                                 match.
13                         </description>
14                 </widget>
15         
16                 <widget name="multistring">
17                         <label>Exactly match one of several user supplied strings</label>
18                         <description>
19                                 This widget filters a column based on an set of strings.
20                         </description>
21                 </widget>
22         
23                 <widget name="initial-substring">
24                         <label>Match the begining of a string from user input</label>
25                         <description>
26                                 This widget filters a column based on an initial substring
27                                 match.
28                         </description>
29                 </widget>
30         </widget-family>
31         
32         
33         <!-- String selection from in-database data -->
34         <widget-family name="string-choose" datatype="text">
35                 <label>String filter from known data</label>
36         
37                 <widget name="dropdown">
38                         <label>Exactly match a string chosen from a dropdown</label>
39                         <description>
40                                 This widget filters a column based on an exact string match.
41                         </description>
42                 </widget>
43                 
44                 <widget name="multiselect">
45                         <label>Match multiple strings chosen from a multiselect box</label>
46                         <description>
47                                 This widget filters a column based on multiple strings.
48                         </description>
49                 </widget>
50         </widget-family>
51         
52         <!-- Comparative time range selection -->
53         <widget-family name="comparative-timerange" datatype="timestamptz">
54                 <label>Comparative time-range widgets</label>
55         
56                 <widget name="month">
57                         <label>Compare runtime relative time months</label>
58                         <description>
59                                 This widget allows the user to pick an arbitrary time range
60                                 on which to report.
61                         </description>
62                         <filter-code type="perl">
63                                 $full_col = "DATE_TRUNC('month', $full_col)";
64                                 $where_clause = 
65                                         "( $full_col = DATE_TRUNC('month', NOW() - CAST( ? || ' month' AS INTERVAL )) ".
66                                         "  OR $full_col = DATE_TRUNC('month', NOW() - CAST( ? || ' month' AS INTERVAL )) )";
67                                 push @$bind_list, $$val{target}, $$val{target} + $$val{compare};
68                         </filter-code>
69                 </widget>
70         </widget-family>
71         
72         <!-- Specific time range selection family -->
73         <widget-family name="specific-timerange" datatype="timestamptz">
74                 <label>Specific time-range widgets</label>
75         
76                 <!--
77                 <widget name="any">
78                         <label>User defined time range</label>
79                         <description>
80                                 This widget allows the user to pick an arbitrary time range
81                                 on which to report.
82                         </description>
83                 </widget>
84                 -->
85
86                 <widget name="day">
87                         <label>Choose a specific date</label>
88                         <description>
89                                 This widget allows the user to pick a specific date on which
90                                 to report.
91                         </description>
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/});
96                         </filter-code>
97                 </widget>
98         
99                 <widget name="week">
100                         <label>Choose a specific week of the year</label>
101                         <description>
102                                 This widget allows the user to pick a specific week of the year
103                                 on which to report.
104                         </description>
105                         <filter-code type="perl">
106                                 $where_clause =
107                                         "( EXTRACT('year' FROM $full_col) = ? ".
108                                         "  AND EXTRACT('week' FROM $full_col) = ? )";
109                                 push @$bind_list, $$val{year}, $$val{week};
110                         </filter-code>
111                 </widget>
112                 
113                 <widget name="multiweek">
114                         <label>Choose a range of weeks of the year</label>
115                         <description>
116                                 This widget allows the user to pick a range of weeks of the year
117                                 on which to report.
118                         </description>
119                         <filter-code type="perl">
120                                 $where_clause =
121                                         "( EXTRACT('year' FROM $full_col) = ? ".
122                                         "  AND EXTRACT('week' FROM $full_col) ".
123                                                 "BETWEEN ? AND ? )";
124                                 push @$bind_list, $$val{year}, $$val{start}, $$val{end};
125                         </filter-code>
126                 </widget>
127                 
128                 <widget name="month">
129                         <label>Choose a specific year and month</label>
130                         <description>
131                                 This widget allows the user to pick a specific year and month
132                                 on which to report.
133                         </description>
134                         <filter-code type="perl">
135                                 $where_clause =
136                                         "( EXTRACT('year' FROM $full_col) = ? ".
137                                         "  AND EXTRACT('month' FROM $full_col) = ? )";
138                                 push @$bind_list, $$val{'start-year'}, $$val{'start-month'};
139                         </filter-code>
140                 </widget>
141                 
142                 <widget name="multimonth">
143                         <label>Choose a range of months</label>
144                         <description>
145                                 This widget allows the user to pick a range of month on which to
146                                 report.
147                         </description>
148                         <filter-code type="perl">
149                                 $where_clause = 
150                                         "DATE_TRUNC('month', $full_col) ".
151                                                 "BETWEEN CAST(? AS DATE) AND CAST(? AS DATE)";
152                                 push @$bind_list,
153                                         sprintf('%d/%02d/01', @$val{qw/start-year start-month/}),
154                                         sprintf('%d/%02d/01', @$val{qw/end-year end-month/});
155                         </filter-code>
156                 </widget>
157                 
158                 <!--
159                 <widget name="quarter">
160                         <label>Choose a specific year and quarter</label>
161                         <description>
162                                 This widget allows the user to pick a specific year and
163                                 quarter on which to report.
164                         </description>
165                 </widget>
166                 
167                 <widget name="multiquarter">
168                         <label>Choose a range of quarters</label>
169                         <description>
170                                 This widget allows the user to pick a range of quarter on which
171                                 to report.
172                         </description>
173                 </widget>
174                 -->
175                 
176                 <widget name="year">
177                         <label>Choose a specific year</label>
178                         <description>
179                                 This widget allows the user to pick a specific year on which to
180                                 report.
181                         </description>
182                         <filter-code type="perl">
183                                 $where_clause = "EXTRACT('year' FROM $full_col) = ?";
184                                 push @$bind_list, $val;
185                         </filter-code>
186                 </widget>
187                 
188                 <widget name="multiyear">
189                         <label>Choose a range of years</label>
190                         <description>
191                                 This widget allows the user to pick a range of years on which to
192                                 report.
193                         </description>
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};
197                         </filter-code>
198                 </widget>
199         </widget-family>
200         
201         <!-- Specific time range selection family -->
202         <widget-family name="relative-timerange" datatype="timestamptz">
203                 <label>Relative time-range widgets</label>
204                 
205                 <widget name="day">
206                         <label>Choose a date relative to the report runtime</label>
207                         <description>
208                                 This widget allows the user to pick a date relative to the
209                                 report runtime on which to report.
210                         </description>
211                         <filter-code type="perl">
212                                 $where_clause = 
213                                         "DATE_TRUNC('day', $full_col) = ".
214                                                 "DATE_TRUNC('day', NOW()) - CAST(? || ' day' AS INTERVAL);
215                                 push @$bind_list, $val;
216                         </filter-code>
217                 </widget>
218                 
219                 <widget name="week">
220                         <label>Choose a week (sun-sat) relative to the report runtime</label>
221                         <description>
222                                 This widget allows the user to pick a week (sun-sat)  relative
223                                 to the report runtime on which to report.
224                         </description>
225                         <filter-code type="perl">
226                                 $where_clause =
227                                         "( DATE_TRUNC('week', $full_col) = ".
228                                         "  DATE_TRUNC('week', NOW() - CAST(? || ' weeks' AS INTERVAL) ) ";
229                                 push @$bind_list, $val;
230                         </filter-code>
231                 </widget>
232                 
233                 <widget name="month">
234                         <label>Choose a month relative to the report runtime</label>
235                         <description>
236                                 This widget allows the user to pick a month relative to the
237                                 report runtime on which to report.
238                         </description>
239                         <filter-code type="perl">
240                                 $where_clause = 
241                                         "DATE_TRUNC('month', $full_col) = ".
242                                                 "DATE_TRUNC('month', NOW()) - CAST(? || ' months' AS INTERVAL);
243                                 push @$bind_list, $val;
244                         </filter-code>
245                 </widget>
246                 
247                 <!--
248                 <widget name="quarter">
249                         <label>Choose a quarter relative to the report runtime</label>
250                         <description>
251                                 This widget allows the user to pick a quarter relative to the
252                                 report runtime on which to report.
253                         </description>
254                 </widget>
255                 -->
256
257                 <widget name="year">
258                         <label>Choose a year relative to the report runtime</label>
259                         <description>
260                                 This widget allows the user to pick a year relative to the
261                                 report runtime on which to report.
262                         </description>
263                         <filter-code type="perl">
264                                 $where_clause = 
265                                         "DATE_TRUNC('year', $full_col) = ".
266                                                 "DATE_TRUNC('year', NOW()) - CAST(? || ' years' AS INTERVAL);
267                                 push @$bind_list, $val;
268                         </filter-code>
269                 </widget>
270         </widget-family>
271
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>
275         
276                 <widget name="dropdown">
277                         <label>Exactly match a Library chosen from a dropdown</label>
278                         <description>
279                                 This widget filters on an exact Library Name match.
280                         </description>
281                 </widget>
282                 
283                 <widget name="multiselect">
284                         <label>Match multiple Libraries chosen from a multiselect box</label>
285                         <description>
286                                 This widget filters based on multiple Library names.
287                         </description>
288                 </widget>
289         </widget-family>
290         </widgets>
291