/[transports]/trunk/web/templates/transports/table
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/transports/table

Parent Directory Parent Directory | Revision Log Revision Log


Revision 48 - (hide annotations)
Tue May 30 19:05:02 2006 UTC (18 years ago) by dpavlin
Original Path: trunk/web/templates/fragments/transports
File size: 2180 byte(s)
better message when there are no transports waiting for import
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 dpavlin 46 } elsif (Jifty->web->current_user->can_import) {
9     $transports->limit(
10     column => 'return_code',
11     value => 'null',
12     operator => 'is',
13     );
14 dpavlin 43 } else {
15     $transports->limit(
16     column => 'created_by',
17     value => Jifty->web->current_user->id,
18 dpavlin 46 );
19 dpavlin 43 }
20 dpavlin 37 $transports->order_by({ column => 'date' });
21     $transports->set_page_info(
22     current_page => $page,
23     per_page => 5,
24     );
25 dpavlin 46 if (my $nr = $transports->pager->total_entries) {
26     $m->out("Showing $nr transports.")
27 dpavlin 48 } elsif ( Jifty->web->current_user->can_import ) {
28     $m->out("No transports waiting for import.");
29 dpavlin 46 } else {
30     $m->out("No transports found.")
31     }
32 dpavlin 37 </%init>
33    
34     <table>
35     <tr>
36 dpavlin 45 <th>src</th>
37     <th>dest</th>
38     <th>class</th>
39     <th>req.nr</th>
40     <th>dep</th>
41 dpavlin 37 <th>created by</th>
42 dpavlin 45 <th>description</th>
43 dpavlin 46 <th>import</th>
44 dpavlin 43 % if (Jifty->web->current_user->admin) {
45 dpavlin 37 <th>&nbsp;</th>
46 dpavlin 43 % }
47 dpavlin 37 </th>
48     </tr>
49    
50     % my $i = 0;
51     % while (my $t = $transports->next) {
52     <tr class="<% ++$i % 2 == 0 ? 'alt' : '' %>">
53     <td><% $t->source->name %></td>
54     <td><% $t->destination->name %></td>
55 dpavlin 45 <td><% $t->class->name %></td>
56 dpavlin 37 <td><tt><% $t->request_nr %></tt></td>
57     <td>
58     <% $t->client_dependent ? 'client' : 'none' %>
59     </td>
60     <td>
61     % if ($t->created_by) {
62     <em><% $t->created_by->name %></em>
63     % }
64     </td>
65 dpavlin 45 <td><% $t->description %></td>
66 dpavlin 46 <td>
67     % if ($t->return_code) {
68     <% $t->return_code->name %>
69     % } elsif (Jifty->web->current_user->can_import) {
70     <% Jifty->web->link( label => 'import', url => '/import/' . $t->id ) %>
71     % } else {
72     pending
73     % }
74     </td>
75 dpavlin 45 % if (Jifty->web->current_user->admin) {
76 dpavlin 39 <td><% Jifty->web->link( label => 'edit', url => '/edit/' . $t->id ) %></td>
77 dpavlin 45 % }
78 dpavlin 37 </tr>
79     % }
80     </table>
81    
82     % if ($transports->pager->previous_page) {
83     <% Jifty->web->link(
84     label => "Previous page",
85     onclick => { args => { page => $transports->pager->previous_page } }
86     ) %>
87     % }
88    
89     % if ($transports->pager->last_page > 1) {
90     page <% $page %> of <% $transports->pager->last_page %>
91     % }
92    
93     % if ($transports->pager->next_page) {
94     <% Jifty->web->link(
95     label => "Next page",
96     onclick => { args => { page => $transports->pager->next_page } }
97     ) %>
98     % }
99    

  ViewVC Help
Powered by ViewVC 1.1.26