Changeset 407


Ignore:
Timestamp:
08/31/09 17:11:21 (15 years ago)
Author:
nanardon
Message:
  • attributes needing to have uniq value are now check online, showing img on field change
Location:
LATMOS-Accounts-Web
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Ajax.pm

    r272 r407  
    5656} 
    5757 
     58sub objattrexist : Local { 
     59    my ($self, $c, $otype, $attr) = @_; 
     60    my $base = $c->model('Accounts')->db; 
     61    my $val = $c->req->param('val'); 
     62    my @obj = $base->search_objects($otype, "$attr=$val"); 
     63 
     64    if (my $filter = $c->req->param('exclude')) { 
     65        @obj = grep { $_ ne $filter } @obj; 
     66    } 
     67    $c->stash->{'exists'} = join(', ', @obj); 
     68} 
     69 
    5870sub end : Private { 
    5971    my ( $self, $c ) = @_; 
  • LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Model/AttrForms.pm

    r373 r407  
    1717my $attrs = { 
    1818    uid => [ 'Login', 'text:12' ], 
    19     uidNumber => [ 'UID', 'text:6' ], 
     19    uidNumber => [ 'UID', 'text-U:6' ], 
    2020    gidNumber => [ 'GID', 'select:group:gidNumber' ], 
    2121    manager => [ 'Responsable', 'select-N:user' ], 
     
    2323    sn => [ 'Nom' ], 
    2424    givenName => [ 'Prénom' ], 
    25     homeDirectory => [ 'Home' ], 
     25    homeDirectory => [ 'Home', 'text-U:15' ], 
    2626    loginShell => [ 'Shell', 'text-A' ], 
    2727    physicalDeliveryOfficeName => [ 'Bureau' ], 
     
    4343    site => [ 'Site', 'select-N:site' ], 
    4444    co => [ 'Pays' ], 
     45    mail => [ 'Mail', 'text-U:30' ], 
    4546}; 
    4647 
     
    187188    # group list here, really the number ! 
    188189    $type ||= 'text'; 
    189     $type = 'text:6' if (($self->{form} || '') =~ /^group/ && $attr eq 'gidNumber'); 
    190     my $htmlname = ($self->{object} ? $self->{object}->id . '_' : '') . $attr; 
     190    $type = 'text-U:6' if (($self->{form} || '') =~ /^group/ && $attr eq 'gidNumber'); 
     191    my $htmlname = $self->escape(($self->{object} ? $self->{object}->id . '_' : 
     192            '') . $attr); 
    191193    for ($type) { 
    192194        /^textarea$/ and return sprintf( 
     
    280282            ); 
    281283            if ($flag =~ /A/) { 
    282             $textf .= qq{<span id="${htmlname}_auto_complete"></span>}; 
     284            $textf .= qq|<span id="${htmlname}_auto_complete"></span>|; 
    283285            $textf .= "\n"; 
    284286            $textf .= $self->{c}->prototype->auto_complete_field( 
    285287                $htmlname, 
    286                 {  
     288                { 
     289                update => "${htmlname}_auto_complete", 
    287290                url => $self->{c}->uri_for('/ajax', 'attrvalues', $self->otype, $attr), 
    288291                indicator => "${htmlname}_stat", min_chars => 1, 
    289292                with => "'val='+document.getElementById('$htmlname').value", 
     293                frequency => 2, 
    290294                } 
    291             ) . 
    292             qq|<span style="display:none" id="${htmlname}_stat">Searching...</span>|; 
     295            ); 
    293296            } 
     297            if ($flag =~ /U/) { 
     298            $textf .= qq|<span id="${htmlname}_observer_uniq"></span>|; 
     299            $textf .= "\n"; 
     300            $textf .= $self->{c}->prototype->observe_field( 
     301                $htmlname, 
     302                { 
     303                update => "${htmlname}_observer_uniq", 
     304                url => $self->{c}->uri_for('/ajax', 'objattrexist', 
     305                    $self->otype, $attr), 
     306                frequency => 2, 
     307                indicator => "${htmlname}_stat", min_chars => 1, 
     308                with => "'val='+document.getElementById('$htmlname').value" . 
     309                    ($self->{object} ? "+'&exclude=" . $self->{object}->id . "'" : 
     310                        ''), 
     311                } 
     312            ); 
     313            } 
     314            $textf .= qq|<span style="display:none" id="${htmlname}_stat">Searching...</span>|; 
     315 
    294316            return $textf; 
    295317        }; 
  • LATMOS-Accounts-Web/root/html/users/index.tt

    r220 r407  
    11[% db = c.model('Accounts').db %] 
    2 <!-- $Id --> 
     2<!-- $Id$ --> 
    33<div style="float: right" id="filter"> 
    44[% INCLUDE 'includes/filter.tt' 
Note: See TracChangeset for help on using the changeset viewer.