Changeset 1131 for trunk/LATMOS-Accounts-Web
- Timestamp:
- 09/05/12 06:35:14 (12 years ago)
- Location:
- trunk/LATMOS-Accounts-Web
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Model/AttrFilter.pm
r1082 r1131 35 35 $new->{c} = $c; 36 36 $new->{otype} = $otype; 37 $c->stash->{filter} = { 38 otype => $otype, 39 } unless($c->stash->{filter}); 40 $c->stash->{ofilter} = bless($new, __PACKAGE__); 37 $new->{base} = $c->model('Accounts')->db; 38 $self = bless($new, __PACKAGE__); 41 39 42 $c->stash->{db} ||= $c->model('Accounts')->db; # need in stash ? 43 my $base = $c->stash->{db}; 40 my $base = $new->{base}; 44 41 45 42 my @objlist = (); … … 54 51 } 55 52 } elsif (exists($c->req->params->{'attr'})) { 56 $ c->stash->{filter}{'attr'} = [ $c->req->param('attr') ];57 $ c->stash->{filter}{'attrval'} = [ $c->req->param('attrval') ];58 my @filter = $ c->stash->{ofilter}->filter;53 $self->{filter}{'attr'} = [ $c->req->param('attr') ]; 54 $self->{filter}{'attrval'} = [ $c->req->param('attrval') ]; 55 my @filter = $self->filter; 59 56 @objlist = $base->search_objects($otype, @filter); 60 57 } else { … … 62 59 } 63 60 64 $ c->stash->{objectslist} = \@objlist;61 $self->{objectslist} = \@objlist; 65 62 66 63 my $start = $c->req->param('start'); 67 $ c->stash->{uparams} = { %{ $c->req->params || {} } };64 $self->{uparams} = { %{ $c->req->params || {} } }; 68 65 my %initials; 69 66 my @sublist; 70 foreach (@{ $ c->stash->{objectslist} }) {67 foreach (@{ $self->{objectslist} }) { 71 68 $initials{substr($_, 0, 1)} = 1; 72 69 if ($start) { … … 76 73 } 77 74 } 78 $ c->stash->{sublist} = [ @sublist ];79 $ c->stash->{initials} = [ sort keys %initials ];75 $self->{sublist} = [ @sublist ]; 76 $self->{initials} = [ sort keys %initials ]; 80 77 81 $ c->stash->{ofilter}78 $self 82 79 } 83 80 … … 97 94 sub current_value { 98 95 my ($self) = @_; 99 my @vals = @{ $self->{ c}->stash->{filter}{attrval} || [] };100 my @fies = @{ $self->{ c}->stash->{filter}{attr} || [] };96 my @vals = @{ $self->{filter}{attrval} || [] }; 97 my @fies = @{ $self->{filter}{attr} || [] }; 101 98 my @couples; 102 99 foreach (@fies) { … … 143 140 } 144 141 142 sub objectslist { 143 my ($self) = @_; 144 warn $self->{objectslist}; 145 $self->{objectslist}; 146 } 147 145 148 =head1 AUTHOR 146 149 -
trunk/LATMOS-Accounts-Web/root/html/includes/list_objects.tt
r1108 r1131 1 1 2 [% objectslist = ofilter.objectslist %] 2 3 [% IF objectslist.size > 20 %] 3 4 4 [% FOREACH initial = initials %]5 [% FOREACH initial = ofilter.initials %] 5 6 [% IF c.req.param('start') == initial %] 6 7 < [% initial %] > 7 8 [% ELSE %] 8 [% uparams.start = initial %]9 <a href="[% c.uri_for('/' _ c.forward('/obj_to_uri', [ ofilter.otype ]), uparams) %]">[% initial %]</a>9 [% ofilter.uparams.start = initial %] 10 <a href="[% c.uri_for('/' _ c.forward('/obj_to_uri', [ ofilter.otype ]), ofilter.uparams) %]">[% initial %]</a> 10 11 [% END %] 11 12 [% END %] … … 27 28 28 29 [% IF c.req.param('start') %] 29 [% objectslist = sublist %]30 [% objectslist = ofilter.sublist %] 30 31 [% END %] 31 32 32 33 [% IF objectslist.size < 20 OR c.req.param('start') %] 33 34 [% FOREACH name = objectslist %] 34 [% object = db.get_object(ofilter.otype, name) %]35 [% object = c.model('Accounts').db.get_object(ofilter.otype, name) %] 35 36 <tr> 36 37 <td> -
trunk/LATMOS-Accounts-Web/root/html/includes/select_objects_list.tt
r1110 r1131 1 [% objectslist = ofilter.objectslist %] 1 2 <select name="obj" id="obj"> 2 3 [% IF objectslist.size > 1 %] … … 7 8 8 9 [% IF objectslist.size < 20 %] 9 [% object = db.get_object(ofilter.otype, name) %]10 [% object = c.model('Accounts').db.get_object(ofilter.otype, name) %] 10 11 <option value="[% name | html %]">[% name | html %] ([% 11 12 object.get_attributes('displayName') | html %])</option>
Note: See TracChangeset
for help on using the changeset viewer.