Ignore:
Timestamp:
09/05/12 06:35:14 (12 years ago)
Author:
nanardon
Message:

AttrFilter? don't automatically fill stash anymore

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Model/AttrFilter.pm

    r1082 r1131  
    3535    $new->{c} = $c; 
    3636    $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__); 
    4139 
    42     $c->stash->{db} ||= $c->model('Accounts')->db; # need in stash ? 
    43     my $base = $c->stash->{db}; 
     40    my $base = $new->{base}; 
    4441 
    4542    my @objlist = (); 
     
    5451        } 
    5552    } 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; 
    5956        @objlist = $base->search_objects($otype, @filter); 
    6057    } else { 
     
    6259    } 
    6360 
    64     $c->stash->{objectslist} = \@objlist; 
     61    $self->{objectslist} = \@objlist; 
    6562 
    6663    my $start = $c->req->param('start'); 
    67     $c->stash->{uparams} = { %{ $c->req->params || {} } }; 
     64    $self->{uparams} = { %{ $c->req->params || {} } }; 
    6865    my %initials; 
    6966    my @sublist; 
    70     foreach (@{ $c->stash->{objectslist} }) { 
     67    foreach (@{ $self->{objectslist} }) { 
    7168        $initials{substr($_, 0, 1)} = 1; 
    7269        if ($start) { 
     
    7673        } 
    7774    } 
    78     $c->stash->{sublist} = [ @sublist ]; 
    79     $c->stash->{initials} = [ sort keys %initials ]; 
     75    $self->{sublist} = [ @sublist ]; 
     76    $self->{initials} = [ sort keys %initials ]; 
    8077 
    81     $c->stash->{ofilter} 
     78    $self 
    8279} 
    8380 
     
    9794sub current_value { 
    9895    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} || [] }; 
    10198    my @couples; 
    10299    foreach (@fies) { 
     
    143140} 
    144141 
     142sub objectslist { 
     143    my ($self) = @_; 
     144    warn $self->{objectslist}; 
     145    $self->{objectslist}; 
     146} 
     147 
    145148=head1 AUTHOR 
    146149 
Note: See TracChangeset for help on using the changeset viewer.