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

Contents of /trunk/web/templates/fragments/table

Parent Directory Parent Directory | Revision Log Revision Log


Revision 67 - (show annotations)
Sun Jun 11 11:38:48 2006 UTC (17 years, 10 months ago) by dpavlin
File size: 2144 byte(s)
start refactore of transports
1 <%args>
2 $page => 1
3 </%args>
4 <%init>
5 my $transports = Transports::Model::TransportCollection->new();
6 if (Jifty->web->current_user->admin) {
7 $transports->unlimit();
8 } elsif (Jifty->web->current_user->can_import) {
9 $transports->limit(
10 column => 'return_code',
11 operator => 'is',
12 value => 'null',
13 );
14 } else {
15 $transports->limit(
16 column => 'created_by',
17 value => Jifty->web->current_user->id,
18 );
19 }
20 $transports->order_by({ column => 'date' });
21 $transports->set_page_info(
22 current_page => $page,
23 per_page => 5,
24 );
25 if (my $nr = $transports->pager->total_entries) {
26 $m->out("Showing $nr transports.")
27 } elsif ( Jifty->web->current_user->can_import ) {
28 $m->out("No transports waiting for import.");
29 } else {
30 $m->out("No transports found.")
31 }
32 </%init>
33
34 <table>
35 <tr>
36 <th>src</th>
37 <th>dest</th>
38 <th>class</th>
39 <th>req.nr</th>
40 <th>dep</th>
41 <th>created by</th>
42 <th>description</th>
43 <th>import</th>
44 % if (Jifty->web->current_user->admin) {
45 <th>&nbsp;</th>
46 % }
47 </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 <td><% $t->class->name %></td>
56 <td><tt><% $t->request_nr %></tt></td>
57 <td>
58 <% $t->client_dependent ? 'client' : 'none' %>
59 </td>
60 <td><em><% $t->created_by->name %></em></td>
61 <td><% $t->description %></td>
62 <td>
63 % if ($t->return_code) {
64 <% $t->return_code->name %>
65 % } elsif (Jifty->web->current_user->can_import) {
66 <% Jifty->web->link( label => 'import', url => '/import/' . $t->id ) %>
67 % } else {
68 pending
69 % }
70 </td>
71 % if (Jifty->web->current_user->admin) {
72 <td><% Jifty->web->link( label => 'edit', url => '/edit/' . $t->id ) %></td>
73 % }
74 </tr>
75 % }
76 </table>
77
78 % if ($transports->pager->previous_page) {
79 <% Jifty->web->link(
80 label => "Previous page",
81 onclick => { args => { page => $transports->pager->previous_page } }
82 ) %>
83 % }
84
85 % if ($transports->pager->last_page > 1) {
86 page <% $page %> of <% $transports->pager->last_page %>
87 % }
88
89 % if ($transports->pager->next_page) {
90 <% Jifty->web->link(
91 label => "Next page",
92 onclick => { args => { page => $transports->pager->next_page } }
93 ) %>
94 % }
95

  ViewVC Help
Powered by ViewVC 1.1.26