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