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

Diff of /trunk/web/templates/transports/table

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/web/templates/fragments/transports revision 37 by dpavlin, Sat May 27 15:56:52 2006 UTC trunk/web/templates/transports/table revision 69 by dpavlin, Sun Jun 11 14:23:37 2006 UTC
# Line 1  Line 1 
1  <%args>  <%args>
2  $page => 1  $page => 1
3    $show_description => 0
4    $show_comment => 0
5  </%args>  </%args>
6  <%init>  <%init>
7  my $transports = Transports::Model::TransportCollection->new();  my $transports = Transports::Model::TransportCollection->new();
8  $transports->unlimit();  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' });  $transports->order_by({ column => 'date' });
23  $transports->set_page_info(  $transports->set_page_info(
24          current_page => $page,          current_page => $page,
25          per_page => 5,          per_page => 10,
26  );  );
27  $m->out("No transports found.") if ($transports->pager->total_entries == 0);  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>  </%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>  <table>
54  <tr>  <tr>
55  <th>source</th>  <th>src</th>
56  <th>destination</th>  <th>dest</th>
57  <th>request nr</th>  <th>class</th>
58  <th>dependency</th>  <th>req.nr</th>
59    <th>dep</th>
60  <th>created by</th>  <th>created by</th>
61  <th>&nbsp;</th>  % if ($show_description) {
62    <th>description</th>
63    % }
64    <th>import</th>
65    % if ($show_comment) {
66    <th>comment</th>
67    % }
68  </th>  </th>
69    % if (Jifty->web->current_user->admin) {
70    <th>&nbsp;</th>
71    % }
72  </tr>  </tr>
73    
74  % my $i = 0;  % my $i = 0;
75  % while (my $t = $transports->next) {  % while (my $t = $transports->next) {
76    
77  <tr class="<% ++$i % 2 == 0 ? 'alt' : '' %>">  <tr class="<% ++$i % 2 == 0 ? 'alt' : '' %>">
78  <td><% $t->source->name %></td>  <td><% $t->source->name %></td>
79  <td><% $t->destination->name %></td>  <td><% $t->destination->name %></td>
80    <td><% $t->class->name %></td>
81  <td><tt><% $t->request_nr %></tt></td>  <td><tt><% $t->request_nr %></tt></td>
82  <td>  <td>
83  <% $t->client_dependent ? 'client' : 'none' %>  <% $t->client_dependent ? 'client' : 'none' %>
84  </td>  </td>
85    <td><em><% $t->created_by->name %></em></td>
86    % if ($show_description) {
87    <td><% $t->description %></td>
88    % }
89  <td>  <td>
90  %  if ($t->created_by) {  %  if ($t->return_code && $t->return_code->name) {
91      <em><% $t->created_by->name %></em>  <% $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>  </td>
101  <td><a href="/edit/<% $t->id %>">edit</a></td>  % 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>  </tr>
111  % }  % }
112  </table>  </table>
113    
114  % if ($transports->pager->previous_page) {  % if ($transports->pager->previous_page) {
115   <% Jifty->web->link(   <% Jifty->web->link(
116          label => "Previous page",          label => "Previous",
117          onclick => { args => { page => $transports->pager->previous_page } }          onclick => { args => { page => $transports->pager->previous_page } }
118   ) %>   ) %>
119  % }  % }
# Line 55  page <% $page %> of <% $transports->page Line 124  page <% $page %> of <% $transports->page
124    
125  % if ($transports->pager->next_page) {  % if ($transports->pager->next_page) {
126   <% Jifty->web->link(   <% Jifty->web->link(
127          label => "Next page",          label => "Next",
128          onclick => { args => { page => $transports->pager->next_page } }          onclick => { args => { page => $transports->pager->next_page } }
129   ) %>   ) %>
130  % }  % }

Legend:
Removed from v.37  
changed lines
  Added in v.69

  ViewVC Help
Powered by ViewVC 1.1.26