]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/kpac/parts/grid.tt2
kpac : search link cgi improvements
[working/Evergreen.git] / Open-ILS / src / templates / kpac / parts / grid.tt2
1 [% 
2 PROCESS 'kpac/parts/util.tt2';
3
4 # Renders a single 'page' grid
5
6 MACRO render_kpac_grid(page_id) BLOCK;
7     page = ctx.kpac_config.pages.page.$page_id;
8     ncols = page.columns || 3; # avoid divide-by-zero
9     name = page.name;
10     idx = 0 %]
11 <table cellpadding="0" cellspacing="0" border="0" class="main_category_table">
12     <tr> [% 
13     width = 100 / ncols;
14     FOR cell IN page.cell;
15         IF idx == ncols; 
16             %]</tr><tr>[%  
17             idx = 0; 
18         END;
19         idx = idx + 1;
20
21         IF cell.type == 'topic';
22             tpage_id = cell.content;
23             topic_page = ctx.kpac_config.pages.page.$tpage_id %]
24
25         <td width="[% width %]%"><a href="[% mkurl(ctx.kpac_root _ '/category', {trail => trail_append(tpage_id)}) %]"><img 
26             src="[% kpac_img_path(topic_page.img) %]" alt="" /><span>[% topic_page.name %]</span></a></td>
27
28         [% ELSIF cell.type == 'search'; %]
29
30         <td width="[% width %]%"><a href="[% 
31             mkurl(ctx.kpac_root _ '/results', {query => cell.content, nosprop => 1}, ['page', 'qtype']) %]"><img 
32             src="[% kpac_img_path(cell.img) %]" alt="" /><span>[% cell.name %]</span></a></td>
33
34         [% ELSIF cell.type == 'link'; %]
35
36         <td width="[% width %]%"><a href="[% cell.content | html %]"><img 
37             src="[% kpac_img_path(cell.img) %]" alt="" /><span>[% cell.name %]</span></a></td>
38
39         [% END %]
40     [% END %]
41     </tr>
42 </table>
43 [% END %]