adding/comitting miker's work
[Evergreen.git] / Open-ILS / src / reporter / templates / widget_manip
1 [%
2
3 PROCESS inputs;
4
5 BLOCK widget_selector;
6
7         logme("widget_selector called for table $tableid");
8
9         #   if we got some columns, use them. if not, get all non-primary columns
10         IF ! columns;
11                 columns_xpath =
12                         '/reporter/tables/table[@id="' _ tableid _
13                         '"]/fields/field[not(@primary) or @primary!="true"]'
14                 columns = config.findnodes(columns_xpath);
15                 logme("widget_selector had to grab columns for table $tableid!");
16         END;
17
18         column_input_type="checkbox";
19         IF force;
20                 column_input_type="hidden";
21         END;
22
23         FOR column IN columns;
24                 column_name=column.findvalue('@name');
25
26                 WRAPPER html/row;
27                         WRAPPER html/cell valign='top' align='right';
28                                 # checkbox for column filter here ...
29                                 INCLUDE $column_input_type
30                                         name="filter:$tableid"
31                                         value=column_name
32                                         checked=1; 
33                                 column.findvalue('label');
34                         END;
35                         WRAPPER html/cell;
36
37                                 col_widget_fams_xpath =
38                                         '/reporter/widgets/widget-family[@datatype="' _
39                                         column.findvalue('@datatype') _ '"]';
40
41                                 IF column.findnodes('@widget-family');
42                                         col_widget_fams_xpath =
43                                                 '/reporter/widgets/widget-family[@name="' _
44                                                 column.findvalue('@widget-family') _ '"]';
45                                 END;
46
47                                 logme("finding widget families using $col_widget_fams_xpath");
48
49                                 widget_fams = config.findnodes(col_widget_fams_xpath);
50
51                                 '<UL>';
52                                 FOR fam IN widget_fams;
53
54                                         fam_input = 'radio';
55                                         IF loop.size == 1;
56                                                 fam_input = 'hidden';
57                                         END;
58
59                                         checked = 0;
60                                         IF loop.count == 1;
61                                                 checked = 1;
62                                         END;
63
64                                         fam_name = fam.findvalue('@name');
65                                         # radio for widget family here ...
66                                         '<LI>';
67                                         INCLUDE $fam_input
68                                                 name="filter:$tableid:$column_name"
69                                                 value= fam_name;
70                                         fam.findvalue('label');
71                                         '<UL>';
72                                         
73                                         FOR widget IN fam.findnodes('widget');
74
75                                                 fam_input = 'radio';
76                                                 IF loop.size == 1;
77                                                         fam_input = 'hidden';
78                                                 END;
79
80                                                 checked = 0;
81                                                 IF loop.count == 1;
82                                                         checked = 1;
83                                                 END;
84
85                                                 widget_name = widget.findvalue('@name');
86                                                 # radio for widget here ...
87                                                 '<LI>';
88                                                 INCLUDE $fam_input
89                                                         name="filter:$tableid:$column_name:$fam_name"
90                                                         value= widget_name;
91                                                 widget.findvalue('label');
92                                                 '</LI>';
93                                         END;
94                                         '</UL>';
95                                         '</LI>';
96                                 END;
97                                 '</UL>';
98                         END;
99                 END;
100         END;
101 END;
102
103 %]
104