/[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/table revision 67 by dpavlin, Sun Jun 11 11:38:48 2006 UTC trunk/web/templates/transports/table revision 72 by dpavlin, Mon Jun 12 03:44:50 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    
8    my $u = Jifty->web->current_user;
9    
10    warn "user->id: ", $u->id, " ", $u->admin ? 'admin' : '', "\n";
11    
12    use Data::Dumper;
13    warn Dumper( $u->admin );
14    
15  my $transports = Transports::Model::TransportCollection->new();  my $transports = Transports::Model::TransportCollection->new();
16  if (Jifty->web->current_user->admin) {  if (Jifty->web->current_user->admin) {
17          $transports->unlimit();          $transports->unlimit();
# Line 20  if (Jifty->web->current_user->admin) { Line 30  if (Jifty->web->current_user->admin) {
30  $transports->order_by({ column => 'date' });  $transports->order_by({ column => 'date' });
31  $transports->set_page_info(  $transports->set_page_info(
32          current_page => $page,          current_page => $page,
33          per_page => 5,          per_page => 10,
34  );  );
35  if (my $nr = $transports->pager->total_entries) {  if (my $nr = $transports->pager->total_entries) {
36          $m->out("Showing $nr transports.")          $m->out("Showing $nr transports.")
37    
38  } elsif ( Jifty->web->current_user->can_import ) {  } elsif ( Jifty->web->current_user->can_import ) {
39          $m->out("No transports waiting for import.");          $m->out("No transports waiting for import.");
40  } else {  } else {
# Line 31  if (my $nr = $transports->pager->total_e Line 42  if (my $nr = $transports->pager->total_e
42  }  }
43  </%init>  </%init>
44    
45    <% Jifty->web->link(
46            label => ( $show_description ? 'no ' : '' ) . ' description',
47            onclick => {
48                    replace_with => '/transports/table',
49                    args => { show_description => $show_description ? 0 : 1 },
50            }
51    ) %>
52    
53    <% Jifty->web->link(
54            label => ( $show_comment ? 'no ' : '' ) . ' import comment',
55            onclick => {
56                    replace_with => '/transports/table',
57                    args => { show_comment => $show_comment ? 0 : 1 },
58            }
59    ) %>
60    
61    <%perl>
62    use Data::Dumper;
63    my $t = $transports->first;
64    $transports->goto_first_item;
65    warn Dumper( $t->id );
66    </%perl>
67    
68  <table>  <table>
69  <tr>  <tr>
70  <th>src</th>  <th>src</th>
# Line 39  if (my $nr = $transports->pager->total_e Line 73  if (my $nr = $transports->pager->total_e
73  <th>req.nr</th>  <th>req.nr</th>
74  <th>dep</th>  <th>dep</th>
75  <th>created by</th>  <th>created by</th>
76    % if ($show_description) {
77  <th>description</th>  <th>description</th>
78    % }
79  <th>import</th>  <th>import</th>
80    % if ($show_comment) {
81    <th>comment</th>
82    % }
83    </th>
84  % if (Jifty->web->current_user->admin) {  % if (Jifty->web->current_user->admin) {
85  <th>&nbsp;</th>  <th>&nbsp;</th>
86  % }  % }
 </th>  
87  </tr>  </tr>
88    
89  % my $i = 0;  % my $i = 0; $transports->goto_first_item;
90  % while (my $t = $transports->next) {  % while (my $t = $transports->next) {
91    
92  <tr class="<% ++$i % 2 == 0 ? 'alt' : '' %>">  <tr class="<% ++$i % 2 == 0 ? 'alt' : '' %>">
93  <td><% $t->source->name %></td>  <td><% $t->source->name %></td>
94  <td><% $t->destination->name %></td>  <td><% $t->destination->name %></td>
# Line 58  if (my $nr = $transports->pager->total_e Line 98  if (my $nr = $transports->pager->total_e
98  <% $t->client_dependent ? 'client' : 'none' %>  <% $t->client_dependent ? 'client' : 'none' %>
99  </td>  </td>
100  <td><em><% $t->created_by->name %></em></td>  <td><em><% $t->created_by->name %></em></td>
101  <td><% $t->description %></td>  % if ($show_description) {
102    <td><% $t->description || '' %></td>
103    % }
104  <td>  <td>
105  %  if ($t->return_code) {  %  if ($t->return_code && $t->return_code->name) {
106  <% $t->return_code->name %>  <% $t->return_code->name %>
107  %  } elsif (Jifty->web->current_user->can_import) {  %  } elsif (Jifty->web->current_user->can_import) {
108  <% Jifty->web->link( label => 'import', url => '/import/' . $t->id ) %>  <% Jifty->web->link( label => 'import', onclick => {
109            replace_with => '/transports/import',
110            args => { id => $t->id },
111    } ) %>
112  %  } else {  %  } else {
113  pending  pending
114  %  }  %  }
115  </td>  </td>
116    % if ($show_comment) {
117    <td><% $t->comment || '' %></td>
118    % }
119  %  if (Jifty->web->current_user->admin) {  %  if (Jifty->web->current_user->admin) {
120  <td><% Jifty->web->link( label => 'edit', url => '/edit/' . $t->id ) %></td>  <td><% Jifty->web->link( label => 'edit', onclick => {
121            replace_with => '/transports/edit',
122            args => { id => $t->id },
123    } ) %></td>
124  %  }  %  }
125  </tr>  </tr>
126  % }  % }
# Line 77  pending Line 128  pending
128    
129  % if ($transports->pager->previous_page) {  % if ($transports->pager->previous_page) {
130   <% Jifty->web->link(   <% Jifty->web->link(
131          label => "Previous page",          label => "Previous",
132          onclick => { args => { page => $transports->pager->previous_page } }          onclick => { args => { page => $transports->pager->previous_page } }
133   ) %>   ) %>
134  % }  % }
# Line 88  page <% $page %> of <% $transports->page Line 139  page <% $page %> of <% $transports->page
139    
140  % if ($transports->pager->next_page) {  % if ($transports->pager->next_page) {
141   <% Jifty->web->link(   <% Jifty->web->link(
142          label => "Next page",          label => "Next",
143          onclick => { args => { page => $transports->pager->next_page } }          onclick => { args => { page => $transports->pager->next_page } }
144   ) %>   ) %>
145  % }  % }

Legend:
Removed from v.67  
changed lines
  Added in v.72

  ViewVC Help
Powered by ViewVC 1.1.26