bug hunting and a (small) new set of widget code
[Evergreen.git] / Open-ILS / src / reporter / widgets.example.xml
index 369a102..fccc717 100644 (file)
                                This widget allows the user to pick a specific date on which
                                to report.
                        </description>
+                       <filter-code type="perl">
+                               $full_col = "DATE_TRUNC($full_col, 'day')";
+                               $where_clause = "$full_col = CAST(? AS DATE)";
+                               push @$bind_list, sprintf('%d/%02d/%02d', @$val{qw/year month day/});
+                       </filter-code>
                </widget>
        
                <widget name="week">
                                This widget allows the user to pick a specific week of the year
                                on which to report.
                        </description>
+                       <filter-code type="perl">
+                               $full_col = "EXTRACT('week' FROM $full_col)";
+                               $where_clause = "$full_col = ?";
+                               push @$bind_list, $val;
+                       </filter-code>
                </widget>
                
                <widget name="multiweek">
                                This widget allows the user to pick a range of weeks of the year
                                on which to report.
                        </description>
+                       <filter-code type="perl">
+                               $where_clause =
+                                       "EXTRACT('year' FROM $full_col) = ? ".
+                                       "AND EXTRACT('week' FROM $full_col) ".
+                                               "BETWEEN ? AND ?";
+                               push @$bind_list, $$val{year}, $$val{start}, $$val{end};
+                       </filter-code>
                </widget>
                
                <widget name="month">
                                This widget allows the user to pick a specific year and month
                                on which to report.
                        </description>
+                       <filter-code type="perl">
+                               $where_clause =
+                                       "EXTRACT('year' FROM $full_col) = ? ".
+                                       "AND EXTRACT('month' FROM $full_col) = ?";
+                               push @$bind_list, $$val{'start-year'}, $$val{'start-month'};
+                       </filter-code>
                </widget>
                
                <widget name="multimonth">
                                This widget allows the user to pick a range of month on which to
                                report.
                        </description>
+                       <filter-code type="perl">
+                               $where_clause = 
+                                       "DATE_TRUNC($full_col, 'month') ".
+                                               "BETWEEN CAST(? AS DATE) AND CAST(? AS DATE)";
+                               push @$bind_list,
+                                       sprintf('%d/%02d/01', @$val{qw/start-year start-month/}),
+                                       sprintf('%d/%02d/01', @$val{qw/end-year end-month/});
+                       </filter-code>
                </widget>
                
                <widget name="quarter">
                                This widget allows the user to pick a specific year on which to
                                report.
                        </description>
+                       <filter-code type="perl">
+                               $where_clause = "EXTRACT('year' FROM $full_col) = ?";
+                               push @$bind_list, $val;
+                       </filter-code>
                </widget>
                
                <widget name="multiyear">
                                This widget allows the user to pick a range of years on which to
                                report.
                        </description>
+                       <filter-code type="perl">
+                               $where_clause = "EXTRACT('year' FROM $full_col) BETWEEN ? AND ?";
+                               push @$bind_list, $$val{year}, $$val{year} + $$val{year-count};
+                       </filter-code>
                </widget>
        </widget-family>
        
                                This widget allows the user to pick a month relative to the
                                report runtime on which to report.
                        </description>
+                       <filter-code type="perl">
+                               $where_clause = 
+                                       "DATE_TRUNC($full_col, 'month') = ".
+                                               "DATE_TRUNC(now(), 'month') - CAST(? || ' months' AS INTERVAL);
+                               push @$bind_list, $val;
+                       </filter-code>
                </widget>
                
                <widget name="quarter">
                        </description>
                </widget>
        </widget-family>
-</widgets>
+
+       <!-- Library selection from in-database data - special to OpenILS -->
+       <widget-family name="lib-choose" datatype="text">
+               <label>String filter from known data</label>
+       
+               <widget name="dropdown">
+                       <label>Exactly match a Library chosen from a dropdown</label>
+                       <description>
+                               This widget filters on an exact Library Name match.
+                       </description>
+               </widget>
+               
+               <widget name="multiselect">
+                       <label>Match multiple Libraries chosen from a multiselect box</label>
+                       <description>
+                               This widget filters based on multiple Library names.
+                       </description>
+               </widget>
+       </widget-family>
+       </widgets>