/[transports]/trunk/web/templates/fragments/transports
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/web/templates/fragments/transports

Parent Directory Parent Directory | Revision Log Revision Log


Revision 43 - (hide annotations)
Sat May 27 23:40:27 2006 UTC (17 years, 11 months ago) by dpavlin
File size: 1579 byte(s)
show edit options only to admin users, all transports now show just
transports for current user if user isn't admin
1 dpavlin 37 <%args>
2     $page => 1
3     </%args>
4     <%init>
5     my $transports = Transports::Model::TransportCollection->new();
6 dpavlin 43 if (Jifty->web->current_user->admin) {
7     $transports->unlimit();
8     } else {
9     $transports->limit(
10     column => 'created_by',
11     value => Jifty->web->current_user->id,
12     )
13     }
14 dpavlin 37 $transports->order_by({ column => 'date' });
15     $transports->set_page_info(
16     current_page => $page,
17     per_page => 5,
18     );
19     $m->out("No transports found.") if ($transports->pager->total_entries == 0);
20     </%init>
21    
22     <table>
23     <tr>
24     <th>source</th>
25     <th>destination</th>
26     <th>request nr</th>
27     <th>dependency</th>
28     <th>created by</th>
29 dpavlin 43 % if (Jifty->web->current_user->admin) {
30 dpavlin 37 <th>&nbsp;</th>
31 dpavlin 43 % }
32 dpavlin 37 </th>
33     </tr>
34    
35     % my $i = 0;
36     % while (my $t = $transports->next) {
37     <tr class="<% ++$i % 2 == 0 ? 'alt' : '' %>">
38     <td><% $t->source->name %></td>
39     <td><% $t->destination->name %></td>
40     <td><tt><% $t->request_nr %></tt></td>
41     <td>
42     <% $t->client_dependent ? 'client' : 'none' %>
43     </td>
44     <td>
45     % if ($t->created_by) {
46     <em><% $t->created_by->name %></em>
47     % }
48     </td>
49 dpavlin 43 % if (Jifty->web->current_user->admin) {
50 dpavlin 39 <td><% Jifty->web->link( label => 'edit', url => '/edit/' . $t->id ) %></td>
51 dpavlin 43 % }
52 dpavlin 37 </tr>
53     % }
54     </table>
55    
56     % if ($transports->pager->previous_page) {
57     <% Jifty->web->link(
58     label => "Previous page",
59     onclick => { args => { page => $transports->pager->previous_page } }
60     ) %>
61     % }
62    
63     % if ($transports->pager->last_page > 1) {
64     page <% $page %> of <% $transports->pager->last_page %>
65     % }
66    
67     % if ($transports->pager->next_page) {
68     <% Jifty->web->link(
69     label => "Next page",
70     onclick => { args => { page => $transports->pager->next_page } }
71     ) %>
72     % }
73    

  ViewVC Help
Powered by ViewVC 1.1.26