Changeset 1081 for trunk/LATMOS-Accounts-Web/lib
- Timestamp:
- 07/28/12 09:20:21 (12 years ago)
- Location:
- trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web.pm
r929 r1081 31 31 32 32 __PACKAGE__->config( 33 objects => { 34 user => { 35 quick_search => [ qw(cn sn givenName) ], 36 list => [ qw(sn givenName mail) ], 37 }, 38 group => { 39 quick_search => [ qw(cn description) ], 40 list => [ qw(description) ], 41 }, 42 nethost => { 43 quick_search => [ qw(cn description ip cname otherName) ], 44 list => [ qw(description owner) ], 45 }, 46 netzone => { 47 quick_search => [ qw(cn description ip) ], 48 list => [ qw(type description) ], 49 }, 50 site => { 51 quick_search => [ qw(cn l) ], 52 list => [ qw(l) ], 53 }, 54 aliases => { 55 quick_search => [ qw(name) ], 56 list => [ qw() ], 57 }, 58 59 }, 33 60 'attrs' => { 34 61 'physicalDeliveryOfficeName' => { -
trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Ajax.pm
r932 r1081 180 180 } 181 181 182 sub list_objects : Local { 183 my ($self, $c, $otype) = @_; 184 $c->stash->{ofilter} = $c->model('AttrFilter', $otype); 185 } 186 182 187 sub end : Private { 183 188 my ( $self, $c ) = @_; -
trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Aliases.pm
r932 r1081 25 25 my ( $self, $c ) = @_; 26 26 27 my $db = $c->model('Accounts')->db; 28 my @al = $c->req->param('al'); 29 my @name = $c->req->param('name'); 30 my @forward = $c->req->param('forward'); 31 $c->stash->{page}{title} = "Gestion des alias"; 32 foreach my $idx (0 .. scalar(@name) - 1) { 33 34 if ($c->req->param('del' . ($idx+1))) { 35 $db->delete_object('aliases', $al[$idx]); 36 } elsif ($al[$idx] ne $name[$idx]) { 37 # delete old, create new 38 $db->delete_c_object('aliases', $al[$idx]) if($al[$idx]); 39 $db->create_c_object('aliases', $name[$idx], 40 forward => [ split(/\s*,\s*/, $forward[$idx]) ], 41 ); 42 } else { 43 my $obj = $db->get_object('aliases', $al[$idx]); 44 $obj->set_c_fields( 45 'forward' => [ split(/\s*,\s*/, $forward[$idx]) ], 46 ); 47 } 48 } 49 50 $db->commit; 27 $c->stash->{ofilter} = $c->model('AttrFilter', 'aliases'); 51 28 } 52 29 -
trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Users.pm
r1051 r1081 26 26 27 27 $c->stash->{ofilter} = $c->model('AttrFilter', 'user'); 28 my $start = $c->req->param('start');29 $c->stash->{uparams} = { %{ $c->req->params || {} } };30 my %initials;31 my @userlist;32 foreach (map { $_->id } @{ $c->stash->{objectslist} }) {33 $initials{substr($_, 0, 1)} = 1;34 if ($start) {35 if (index($_, $start) == 0) {36 push(@userlist, $_);37 }38 }39 }40 if (@{ $c->stash->{objectslist} } < 20) {41 @userlist = map { $_->id } @{ $c->stash->{objectslist} };42 } else {43 $c->stash->{initials} = [ sort keys %initials ];44 }45 $c->stash->{page}{title} = 'Listes des utilisateurs (' . scalar(@{46 $c->stash->{objectslist} }) . ')';47 $c->stash->{userslist} = \@userlist;48 28 } 49 29 -
trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Model/AttrFilter.pm
r959 r1081 21 21 nethost => [ qw(name cname otherName ip macaddr owner serialNumber) ], 22 22 netzone => [ qw(net group type site) ], 23 aliases => [ qw(as) ], 23 24 }; 24 25 … … 37 38 otype => $otype, 38 39 } unless($c->stash->{filter}); 39 if (exists($c->req->params->{'attr'})) { 40 $c->stash->{ofilter} = bless($new, __PACKAGE__); 41 42 $c->stash->{db} ||= $c->model('Accounts')->db; # need in stash ? 43 my $base = $c->stash->{db}; 44 45 my @objlist = (); 46 if ($c->req->params->{'q'}) { 47 my %objs; 48 foreach my $attr (@{ $c->config->{objects}{$otype}{quick_search} || [ 'cn' ]}) { 49 foreach ($base->search_objects( 50 $otype, "$attr~" . $c->req->params->{'q'})) { 51 $objs{$_} = 1; 52 } 53 @objlist = sort keys %objs; 54 } 55 } elsif (exists($c->req->params->{'attr'})) { 40 56 $c->stash->{filter}{'attr'} = [ $c->req->param('attr') ]; 41 57 $c->stash->{filter}{'attrval'} = [ $c->req->param('attrval') ]; 58 my @filter = $c->stash->{ofilter}->filter; 59 @objlist = $base->search_objects($otype, @filter); 60 } else { 61 @objlist = $base->list_objects($otype); 42 62 } 43 44 $c->stash->{ofilter} = bless($new, __PACKAGE__);45 $c->stash->{db} ||= $c->model('Accounts')->db;46 my $base = $c->stash->{db};47 63 48 my @filter = $c->stash->{ofilter}->filter;49 64 $c->stash->{objectslist} = [ 50 65 map { $base->get_object($otype, $_) } 51 (@filter 52 ? ($base->search_objects($otype, @filter) ) 53 : ($base->list_objects($otype) )) 66 @objlist 54 67 ]; 68 69 my $start = $c->req->param('start'); 70 $c->stash->{uparams} = { %{ $c->req->params || {} } }; 71 my %initials; 72 my @sublist; 73 foreach (@{ $c->stash->{objectslist} }) { 74 $initials{substr($_->id, 0, 1)} = 1; 75 if ($start) { 76 if (index($_->id, $start) == 0) { 77 push(@sublist, $_); 78 } 79 } 80 } 81 $c->stash->{sublist} = [ @sublist ]; 82 $c->stash->{initials} = [ sort keys %initials ]; 55 83 56 84 $c->stash->{ofilter} -
trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/View/TTpart.pm
r511 r1081 10 10 LATMOS::Accounts::Web->path_to( 'root', 'html' ), 11 11 ], 12 PRE_PROCESS => 'includes/defs.tt', 12 13 ); 13 14
Note: See TracChangeset
for help on using the changeset viewer.