/[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

Contents of /trunk/web/templates/transports/table

Parent Directory Parent Directory | Revision Log Revision Log


Revision 69 - (show annotations)
Sun Jun 11 14:23:37 2006 UTC (17 years, 10 months ago) by dpavlin
File size: 2877 byte(s)
refactored transports handling
1 <%args>
2 $page => 1
3 $show_description => 0
4 $show_comment => 0
5 </%args>
6 <%init>
7 my $transports = Transports::Model::TransportCollection->new();
8 if (Jifty->web->current_user->admin) {
9 $transports->unlimit();
10 } elsif (Jifty->web->current_user->can_import) {
11 $transports->limit(
12 column => 'return_code',
13 operator => 'is',
14 value => 'null',
15 );
16 } else {
17 $transports->limit(
18 column => 'created_by',
19 value => Jifty->web->current_user->id,
20 );
21 }
22 $transports->order_by({ column => 'date' });
23 $transports->set_page_info(
24 current_page => $page,
25 per_page => 10,
26 );
27 if (my $nr = $transports->pager->total_entries) {
28 $m->out("Showing $nr transports.")
29
30 } elsif ( Jifty->web->current_user->can_import ) {
31 $m->out("No transports waiting for import.");
32 } else {
33 $m->out("No transports found.")
34 }
35 </%init>
36
37 <% Jifty->web->link(
38 label => ( $show_description ? 'no ' : '' ) . ' description',
39 onclick => {
40 replace_with => '/transports/table',
41 args => { show_description => $show_description ? 0 : 1 },
42 }
43 ) %>
44
45 <% Jifty->web->link(
46 label => ( $show_comment ? 'no ' : '' ) . ' import comment',
47 onclick => {
48 replace_with => '/transports/table',
49 args => { show_comment => $show_comment ? 0 : 1 },
50 }
51 ) %>
52
53 <table>
54 <tr>
55 <th>src</th>
56 <th>dest</th>
57 <th>class</th>
58 <th>req.nr</th>
59 <th>dep</th>
60 <th>created by</th>
61 % if ($show_description) {
62 <th>description</th>
63 % }
64 <th>import</th>
65 % if ($show_comment) {
66 <th>comment</th>
67 % }
68 </th>
69 % if (Jifty->web->current_user->admin) {
70 <th>&nbsp;</th>
71 % }
72 </tr>
73
74 % my $i = 0;
75 % while (my $t = $transports->next) {
76
77 <tr class="<% ++$i % 2 == 0 ? 'alt' : '' %>">
78 <td><% $t->source->name %></td>
79 <td><% $t->destination->name %></td>
80 <td><% $t->class->name %></td>
81 <td><tt><% $t->request_nr %></tt></td>
82 <td>
83 <% $t->client_dependent ? 'client' : 'none' %>
84 </td>
85 <td><em><% $t->created_by->name %></em></td>
86 % if ($show_description) {
87 <td><% $t->description %></td>
88 % }
89 <td>
90 % if ($t->return_code && $t->return_code->name) {
91 <% $t->return_code->name %>
92 % } elsif (Jifty->web->current_user->can_import) {
93 <% Jifty->web->link( label => 'import', onclick => {
94 replace_with => '/transports/import',
95 args => { id => $t->id },
96 } ) %>
97 % } else {
98 pending
99 % }
100 </td>
101 % if ($show_comment) {
102 <td><% $t->comment %></td>
103 % }
104 % if (Jifty->web->current_user->admin) {
105 <td><% Jifty->web->link( label => 'edit', onclick => {
106 replace_with => '/transports/edit',
107 args => { id => $t->id },
108 } ) %></td>
109 % }
110 </tr>
111 % }
112 </table>
113
114 % if ($transports->pager->previous_page) {
115 <% Jifty->web->link(
116 label => "Previous",
117 onclick => { args => { page => $transports->pager->previous_page } }
118 ) %>
119 % }
120
121 % if ($transports->pager->last_page > 1) {
122 page <% $page %> of <% $transports->pager->last_page %>
123 % }
124
125 % if ($transports->pager->next_page) {
126 <% Jifty->web->link(
127 label => "Next",
128 onclick => { args => { page => $transports->pager->next_page } }
129 ) %>
130 % }
131

  ViewVC Help
Powered by ViewVC 1.1.26