bug hunting and a (small) new set of widget code
[Evergreen.git] / Open-ILS / src / reporter / templates / class_manip
1 [%
2
3 PROCESS inputs;
4
5 BLOCK class_table;
6         WRAPPER html/table width='100%' style='border-top: 1px solid black';
7                 WRAPPER html/row;
8                         WRAPPER html/cell align="right" width="30%";
9                                 %]<b>Name:</b>[%
10                         END;
11                         WRAPPER html/cell;
12                                 classname.findvalue('label');
13                         END;
14                 END;
15                 WRAPPER html/row;
16                         WRAPPER html/cell align="right";
17                                 %]<b>Description:</b>[%
18                         END;
19                         WRAPPER html/cell;
20                                 classname.findvalue('description');
21                         END;
22                 END;
23                 IF classname.findvalue('@fact-table') == 'true' AND CGI.param('create_stage2') != 1;
24                         WRAPPER html/row;
25                                 WRAPPER html/cell align="right";
26                                         %]<b>Actions:</b>[%
27                                 END;
28                                 WRAPPER html/cell;
29                                         IF CGI.param('detail');
30                                                 %]<a href="?detail=0&id=[% fact_table %]">No Details</a>[%
31                                         ELSE;
32                                                 %]<a href="?detail=1&id=[% fact_table %]">Details</a>[%
33                                         END;
34                                         %]|<a href="?create_stage2=1&id=[% fact_table %]">New Report Template</a>[%
35                                 END;
36                         END;
37                         WRAPPER html/row;
38                                 INCLUDE html/cell align="right" valign='top' content='<b>Report Templates:</b>';
39                                 WRAPPER html/cell;
40                                         q = 'select * from reporter.stage2 ' _
41                                                 'where pub is true or owner = ' _ DBI.quote(user.id());
42                                         FOR r = DBI.query(q);
43                                                 INCLUDE anchor
44                                                         href="stage2?id=" _ r.id
45                                                         content=utils.JSON2perl(r.params).templatename;
46                                                         '<br>';
47                                         END;
48                                 END;
49                         END;
50                 END;
51
52                 INCLUDE class_detail IF CGI.param('detail') == 1;
53         END;
54 END; 
55
56
57
58
59
60
61 BLOCK class_fields;
62         FOR f = classname.findnodes('fields/field');
63                 WRAPPER html/row;
64                         WRAPPER html/cell align="right";
65                                 f.findvalue('label');
66                         END;
67                         WRAPPER html/cell;
68                                 %] ([%
69                                 IF f.findvalue('description');
70                                         f.findvalue('description');
71                                         %] -- [%
72                                 END;
73                                 f.findvalue('@name')%]::[%f.findvalue('@datatype') %])[%
74                         END;
75                 END;
76         END;
77 END;
78
79
80
81
82
83
84 BLOCK class_detail;
85
86         INCLUDE class_fields;
87
88         IF classname.findvalue('@fact-table') == 'true' AND nosub != 1;
89                 WRAPPER html/row;
90                         WRAPPER html/cell align="right";
91                                 %]<b>Report Dimensions<br>and Attributes:</b>[%
92                         END;
93                         WRAPPER html/cell;
94                                 incs = classname.findnodes('links/link/@field');
95
96                                 FOR dim = incs;
97                                         link_xpath = '/reporter/tables/table[@id="' _ fact_table _'"]'_
98                                                                                 '/links/link[@field="' _ dim.value() _ '"]/@table';
99                                         logme(link_xpath);
100
101                                         dim_table = config.findvalue(link_xpath);
102
103                                         dim_xpath = '/reporter/tables/table[@id="' _ dim_table _ '"]';
104                                         logme(dim_xpath);
105                                                         
106                                         dim_def = config.findnodes(dim_xpath);
107
108                                         INCLUDE class_table classname = dim_def;
109                                 END;
110                         END;
111                 END;
112         END;
113 END;
114
115 %]
116