Changeset 225
- Timestamp:
- 06/05/09 10:28:37 (15 years ago)
- Location:
- LATMOS-Accounts-Web
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller.pm
r216 r225 44 44 } 45 45 46 sub filter : Private { 47 my ( $self, $c ) = @_; 48 my $otype = $c->stash->{filter}->{otype} or return; 49 50 $c->stash->{db} ||= $c->model('Accounts')->db; 51 my $base = $c->stash->{db}; 52 if ($c->req->param('attrval')) { 53 $c->stash->{filter}{attrval} = [ $c->req->param('attrval') ]; 54 $c->stash->{filter}{attr} = [ $c->req->param('attr') ]; 55 } else { 56 # avoid undef 57 $c->stash->{filter}{attrval} ||= []; 58 $c->stash->{filter}{attr} ||= []; 59 } 60 61 my %filter = map { 62 $c->stash->{filter}{attr}[$_] && $c->stash->{filter}{attrval}[$_] 63 ? ($c->stash->{filter}{attr}[$_] => $c->stash->{filter}{attrval}[$_]) 64 : () 65 } (0 .. $#{ $c->stash->{filter}{attr} || []}); 66 $c->stash->{objectslist} = [ 67 map { $base->get_object($otype, $_) } 68 (%filter 69 ? ($base->search_objects($otype, %filter) ) 70 : ($base->list_objects($otype) )) 71 ] 72 } 73 46 74 =head2 end 47 75 -
LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/MassEdit.pm
r222 r225 3 3 use strict; 4 4 use warnings; 5 use base ' Catalyst::Controller';5 use base 'LATMOS::Accounts::Web::Controller'; 6 6 7 7 =head1 NAME … … 26 26 27 27 my $base = $c->stash->{db} = $c->model('Accounts')->db; 28 if (my $otype = $c->req->param('otype')) { 29 my %filter = map { 30 $c->req->params->{attr}[$_] && $c->req->params->{attrval}[$_] 31 ? ($c->req->params->{attr}[$_] => $c->req->params->{attrval}[$_]) 32 : () 33 } (0 .. $#{ $c->req->params->{attr} || []}); 34 $c->stash->{objectslist} = [ 35 map { $base->get_object($otype, $_) } 36 (%filter 37 ? ($base->search_objects($otype, %filter) ) 38 : ($base->list_objects($otype) )) 39 ] 28 if ($c->req->param('otype') && $c->req->param('otype') ne $c->session->{filter}{otype}) { 29 $c->session->{filter} = undef; 30 $c->stash->{filter}->{otype} = $c->req->param('otype'); 31 $c->session->{massedit}{attrcol} = undef; 32 } else { 33 $c->stash->{filter} = $c->session->{filter}; 34 if ($c->req->param('attrcol')) { 35 $c->session->{massedit}{attrcol} = [ $c->req->param('attrcol') ]; 36 } else { 37 $c->req->params->{attrcol} = $c->session->{massedit}{attrcol}; 38 } 40 39 } 40 $c->forward('filter'); 41 $c->session->{filter} = $c->stash->{filter}; 41 42 } 42 43 -
LATMOS-Accounts-Web/root/html/includes/filter.tt
r221 r225 1 1 <!-- $Id$ --> 2 2 <p>Filtre:</p> 3 <form action="[% formuri%]" method="POST">3 <form action="[% c.action.namespace %]" method="POST"> 4 4 <input type="hidden" name="otype" value="[% otype | html %]"> 5 5 [% FOREACH item = [0, 1, 2 ] %] … … 13 13 <option value=""></option> 14 14 [% FOREACH f = db.list_canonical_fields(otype, 'r') %] 15 <option value="[% f | html %]" [% ' selected="1"' IF c.req.params.attr.$item == f %]>15 <option value="[% f | html %]" [% ' selected="1"' IF filter.attr.$item == f %]> 16 16 [% c.model('AttrForms').attr_label(f) | html %] 17 17 </option> … … 19 19 </select> 20 20 </td> 21 <td><input type="text" name="attrval" value="[% c.req.params.attrval.$item | html %]"></td></tr>21 <td><input type="text" name="attrval" value="[% filter.attrval.$item | html %]"></td></tr> 22 22 [% IF loop.last %] 23 23 </table>
Note: See TracChangeset
for help on using the changeset viewer.