Changeset 861 for LATMOS-Accounts-Web


Ignore:
Timestamp:
12/02/11 11:42:17 (13 years ago)
Author:
nanardon
Message:
  • reimport missing files from previous svn
Location:
LATMOS-Accounts-Web
Files:
56 added
34 edited

Legend:

Unmodified
Added
Removed
  • LATMOS-Accounts-Web/Changes

    r94 r861  
    11This file documents the revision history for Perl extension LATMOS::Accounts::Web. 
    22 
     32.0.0 
     4    - add support of nethost/netzone object 
     5 
     6    - add a "My" page in user page listing object they own 
     7 
     8    - add icons to quickly identify user's account status in list (temporary, 
     9      expired, unexported) 
     10 
     11    - add a department page in group page with a realistic view of the current 
     12      people in the department. The section appear only when group have 
     13      sutype=dpmt 
     14 
     15    - add link to objects when attributes have reference 
     16 
    3170.01  2009-05-12 03:23:51 
    4         - initial revision, generated by Catalyst 
     18    - initial revision, generated by Catalyst 
  • LATMOS-Accounts-Web/MANIFEST

    r757 r861  
    11Changes 
     2MANIFEST 
     3MANIFEST.skip 
    24Makefile.PL 
    35README 
    46etc/httpd/latmos-accounts-web.conf 
    57etc/init.d/latmos-accounts-web 
    6 inc/Module/AutoInstall.pm 
    7 inc/Module/Install/AutoInstall.pm 
    8 inc/Module/Install/Base.pm 
    9 inc/Module/Install/Can.pm 
    10 inc/Module/Install/Catalyst.pm 
    11 inc/Module/Install/Fetch.pm 
    12 inc/Module/Install/Include.pm 
    13 inc/Module/Install/Makefile.pm 
    14 inc/Module/Install/Metadata.pm 
    15 inc/Module/Install/Scripts.pm 
    16 inc/Module/Install/Win32.pm 
    17 inc/Module/Install/WriteAll.pm 
    18 inc/Module/Install.pm 
    198latmos-accounts-web.spec.in 
    209latmos_accounts_web.yml.in 
    2110lib/Catalyst/Authentication/Credential/La.pm 
     11lib/LATMOS/Accounts/Web/Controller/About.pm 
    2212lib/LATMOS/Accounts/Web/Controller/Ajax.pm 
    2313lib/LATMOS/Accounts/Web/Controller/Aliases.pm 
    2414lib/LATMOS/Accounts/Web/Controller/Create.pm 
    2515lib/LATMOS/Accounts/Web/Controller/Groups.pm 
    26 lib/LATMOS/Accounts/Web/Controller/MassEdit.pm 
     16lib/LATMOS/Accounts/Web/Controller/NetHosts.pm 
     17lib/LATMOS/Accounts/Web/Controller/NetZones.pm 
    2718lib/LATMOS/Accounts/Web/Controller/Root.pm 
    2819lib/LATMOS/Accounts/Web/Controller/Sites.pm 
     
    3627lib/LATMOS/Accounts/Web.pm 
    3728root/favicon.ico 
     29root/html/about/index.tt 
    3830root/html/ajax/attrvalues.tt 
    3931root/html/ajax/check_new_name.tt 
    4032root/html/ajax/check_ug_validity.tt 
    4133root/html/ajax/cracklib.tt 
     34root/html/ajax/displayattr.tt 
    4235root/html/ajax/objattrexist.tt 
    4336root/html/ajax/objexist.tt 
    4437root/html/ajax/rawattr.tt 
     38root/html/ajax/select_freeip_select.tt 
    4539root/html/aliases/index.tt 
    46 root/html/create/group.tt 
    47 root/html/create/user.tt 
     40root/html/create/default.tt 
    4841root/html/default.tt 
    4942root/html/departments/default.tt 
     
    5144root/html/departments/menu.tt 
    5245root/html/groups/default.tt 
     46root/html/groups/dpmt.tt 
    5347root/html/groups/index.tt 
    5448root/html/groups/menu.tt 
     
    6155root/html/login.tt 
    6256root/html/logout.tt 
    63 root/html/massedit/index.tt 
     57root/html/nethosts/default.tt 
     58root/html/nethosts/index.tt 
     59root/html/nethosts/menu.tt 
     60root/html/netzones/default.tt 
     61root/html/netzones/index.tt 
     62root/html/netzones/menu.tt 
    6463root/html/no_object.tt 
    6564root/html/sites/default.tt 
     
    7574root/html/users/mail.tt 
    7675root/html/users/menu.tt 
     76root/html/users/my.tt 
    7777root/html/users/passwd.tt 
     78root/static/icons/add.png 
     79root/static/icons/appointment-new.png 
     80root/static/icons/appointment-soon.png 
    7881root/static/icons/arrow-right.png 
     82root/static/icons/avatar-default.png 
     83root/static/icons/changes-prevent.png 
    7984root/static/icons/dialog-cancel.png 
     85root/static/icons/dialog-password.png 
     86root/static/icons/document-save-as.png 
     87root/static/icons/document-save.png 
     88root/static/icons/emblem-urgent.png 
     89root/static/icons/icon_edit.png 
     90root/static/icons/expired.png 
     91root/static/icons/gnome-session-logout.png 
     92root/static/icons/gnome-stock-mail-snd.png 
     93root/static/icons/gtk-about.png 
     94root/static/icons/gtk-cancel.png 
     95root/static/icons/gtk-close.png 
     96root/static/icons/gtk-delete.png 
     97root/static/icons/gtk-go-back-ltr.png 
     98root/static/icons/gtk-go-back-rtl.png 
     99root/static/icons/gtk-goto-first-ltr.png 
     100root/static/icons/gtk-goto-first-rtl.png 
     101root/static/icons/gtk-home.png 
     102root/static/icons/gtk-jump-to-rtl.png 
     103root/static/icons/locked.png 
     104root/static/icons/mail_forward.png 
     105root/static/icons/network-workgroup.png 
     106root/static/icons/preferences-desktop-wallpaper.png 
     107root/static/icons/stock_smiley-22.png 
     108root/static/icons/system-config-users.png 
     109root/static/icons/system-users.png 
    80110root/static/icons/user-group-delete.png 
    81111root/static/icons/user-group-new.png 
    82112root/static/icons/user-group-properties.png 
     113root/static/icons/user-info.png 
     114root/static/icons/user-invisible.png 
    83115root/static/icons/user-properties.png 
     116root/static/icons/video-display.png 
    84117root/static/icons/view-calendar-day.png 
     118root/static/icons/view-media-artist.png 
     119root/static/icons/xfce-internet.png 
    85120root/static/images/btn_120x50_built.png 
    86121root/static/images/btn_120x50_built_shadow.png 
     
    98133root/static/images/mail-mark-important.png 
    99134root/static/images/process-stop.png 
    100 root/static/images/view-media-artist.png 
    101135root/static/images/view-pim-contacts.png 
    102136root/static/js/CalendarPopup.js 
     
    114148t/02pod.t 
    115149t/03podcoverage.t 
     150t/controller_About.t 
    116151t/controller_Ajax.t 
    117152t/controller_Aliases.t 
     
    119154t/controller_Groups.t 
    120155t/controller_MassEdit.t 
     156t/controller_NetHost.t 
    121157t/controller_Sites.t 
    122158t/controller_Users.t 
  • LATMOS-Accounts-Web/Makefile.PL

    r552 r861  
    44all_from 'lib/LATMOS/Accounts/Web.pm'; 
    55 
    6 requires 'Catalyst' => '5.7015'; 
     6#requires 'Catalyst' => '5.7015'; 
    77requires 'Catalyst::Plugin::ConfigLoader'; 
    88requires 'Catalyst::Plugin::Static::Simple'; 
     
    2020 
    2121install_script glob('script/*.pl'); 
    22 auto_install; 
    23 WriteAll; 
     22#auto_install; 
     23WriteMakefile( 
     24    macro => {  
     25        DESTRPMDIR => '$(shell pwd)', 
     26    }, 
     27); 
    2428 
    2529package MY; 
     
    2731sub postamble { 
    2832    <<EOF; 
    29 .PHONY .= svnmanifest 
     33# .PHONY .= svnmanifest 
    3034 
    3135svnmanifest: 
     
    3943 
    4044rpm: \$(DISTVNAME).tar.gz latmos-accounts-web.spec 
    41 \tmkdir ./noarch || : 
     45\tmkdir \$(DESTRPMDIR)/noarch || : 
    4246\trpmbuild -ba --clean\\ 
    4347\t --define "_sourcedir `pwd`" \\ 
    4448\t --define "_specdir `pwd`" \\ 
    45 \t --define "_srcrpmdir `pwd`" \\ 
    46 \t --define "_rpmdir `pwd`" \\ 
     49\t --define "_srcrpmdir \$(DESTRPMDIR)" \\ 
     50\t --define "_rpmdir \$(DESTRPMDIR)" \\ 
     51\t latmos-accounts-web.spec 
     52 
     53svnrpm: \$(DISTVNAME).tar.gz latmos-accounts-web.spec 
     54\tmkdir \$(DESTRPMDIR)/noarch || : 
     55\trpmbuild -ba --clean\\ 
     56\t --define "_sourcedir `pwd`" \\ 
     57\t --define "_specdir `pwd`" \\ 
     58\t --define "_srcrpmdir \$(DESTRPMDIR)" \\ 
     59\t --define "_rpmdir \$(DESTRPMDIR)" \\ 
     60\t --define "svnrelease `LC_ALL=C svn info | grep '^Revision:' | sed 's/Revision: //'`" \\ 
    4761\t latmos-accounts-web.spec 
    4862 
  • LATMOS-Accounts-Web/latmos-accounts-web.spec.in

    r737 r861  
    22%define name       latmos-accounts-web 
    33%define version    @VERSION@ 
    4 %define release    %mkrel 1 
     4%define release    %mkrel %{?svnrelease:0.%{svnrelease}}%{?!svnrelease:1} 
    55 
    66Name:       %{name} 
     
    8181fi 
    8282 
     83%triggerpostun -- latmos-accounts 
     84/sbin/service %name restart 
     85 
    8386%files 
    8487%defattr(-,root,root) 
  • LATMOS-Accounts-Web/latmos_accounts_web.yml.in

    r97 r861  
    11--- 
    22name: LATMOS::Accounts::Web 
     3# config: /etc/latmos-accounts/latmos-accounts.ini 
     4# company: COMPANY NAME 
  • LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web.pm

    r860 r861  
    2424    /; 
    2525 
    26 our $VERSION = '0.0.11'; 
     26our $VERSION = '2.0.0'; 
    2727 
    2828# Configure the application.  
    29 # 
    30 # Note that settings in LATMOS::Accounts::Web.yml (or other external 
    31 # configuration file that you set up manually) take precedence 
    32 # over this when using ConfigLoader. Thus configuration 
    33 # details given here can function as a default configuration, 
    34 # with a external configuration file acting as an override for 
    35 # local deployment. 
     29 
     30my $config_file = '/etc/latmos-accounts/latmos-accounts-web.yml'; 
     31if (-r $config_file ) { 
     32    __PACKAGE__->config( 'Plugin::ConfigLoader' => {  
     33            file => $config_file  
     34        }  
     35    ); 
     36} 
    3637 
    3738# http://stackoverflow.com/questions/1664816/is-there-a-way-to-force-c-urifor-in-catalyst-to-generate-a-uri-that-begins-wit 
  • LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller.pm

    r718 r861  
    2525 
    2626    if (!$c->user_exists) { 
    27         if ($c->req->path ne 'login') { 
    28             $c->forward('/login'); 
     27        # No need to login for About section 
     28        if ($c->namespace ne 'about') { 
     29            if ($c->req->path ne 'login') { 
     30                $c->forward('/login'); 
     31            } 
     32            return; 
    2933        } 
    3034    } else { 
    31         $c->model('Accounts')->db->connect($c->user->{username}, 
     35        $c->model('Accounts')->db->connect( 
     36            $c->user->{username}, 
    3237            $c->user->{password}); 
    3338    } 
    34      
    35     my $menu = ''; 
    36     my @menus = ( 
    37         [ 'users' => 'Utilisateurs' ], 
    38         ($c->model('Accounts')->db->check_acl('user', '@CREATE', 'w') 
    39             ? [ 'create/user' => 'Nouvel Util.' ] 
    40             : ()), 
    41         [ 'groups' => 'Groupes' ], 
    42         ($c->model('Accounts')->db->check_acl('group', '@CREATE', 'w') 
    43             ? [ 'create/group' => 'Nouveau Groupe' ] 
    44             : ()), 
    45         [ 'sites' => 'Sites' ], 
    46         [ 'aliases' => 'Alias Mail' ], 
    47     ); 
    48     foreach(@menus) { 
    49         $menu .= sprintf( 
    50             q{<a href="%s"><span%s>%s</span></a>}, 
    51             $c->uri_for('/' . $_->[0]), 
    52             ($c->req->path =~ m:^$_->[0]: ? ' id="actif"' : ''), 
    53             $_->[1], 
    54         ); 
    55  
    56     } 
    57     $c->stash->{mainmenu} = $menu; 
    5839} 
    5940 
  • LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Ajax.pm

    r755 r861  
    4545} 
    4646 
     47sub displayattr : Local { 
     48    my ($self, $c, $otype) = @_; 
     49    my $attribute = $c->model('Accounts')->db->attribute($otype, 
     50        $c->req->param('attr')) or return; 
     51    $c->stash->{value} = $attribute->display($c->req->param('id')); 
     52} 
     53 
    4754sub attrvalues : Local { 
    4855    my ($self, $c, $otype, $attr) = @_; 
     
    6370 
    6471    $c->stash->{'exists'} = join(', ', $obj->get_attributes($c->req->param('attr') || 
    65             'displayName')) if($obj); 
     72            'displayName') || $obj->id) if($obj); 
    6673} 
    6774 
     
    8895    my ($self, $c, $otype, $attr) = @_; 
    8996    my $base = $c->model('Accounts')->db; 
    90     my $val = $c->req->param('val'); 
     97    my $attribute = $base->attribute($otype, $attr) or return; 
     98    my $val = $attribute->input($c->req->param('val')); 
    9199    my @obj = $val ? $base->search_objects($otype, "$attr=$val") : (); 
    92100 
     
    125133} 
    126134 
     135sub select_freeip_select : Local { 
     136    my ($self, $c) = @_; 
     137 
     138} 
     139 
     140sub goto : Local { 
     141    my ($self, $c) = @_; 
     142 
     143    $c->res->redirect( 
     144        $c->uri_for('/' . $c->req->param('otype') . 's', $c->req->param('goto'), 
     145        $c->req->param('subform')) 
     146    ); 
     147    $c->stash->{template} = 'no_object.tt'; 
     148} 
     149 
     150 
    127151sub end : Private { 
    128152    my ( $self, $c ) = @_; 
  • LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Aliases.pm

    r641 r861  
    2929    my @name = $c->req->param('name'); 
    3030    my @forward = $c->req->param('forward'); 
     31    $c->stash->{page}{title} = "Gestion des alias"; 
    3132    foreach my $idx (0 .. scalar(@name) - 1) { 
    3233 
  • LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Create.pm

    r765 r861  
    55use base 'LATMOS::Accounts::Web::Controller'; 
    66use LATMOS::Accounts::Utils; 
     7use LATMOS::Accounts::Log; 
    78 
    89=head1 NAME 
     
    2930} 
    3031 
    31 sub user : Local { 
    32     my ( $self, $c ) = @_; 
    33  
     32sub default : LocalPath { 
     33    my ($self, $c, undef, $otype ) = @_; 
    3434    my $base = $c->model('Accounts')->db; 
    35     $c->stash->{form} = $c->model('AttrForms', undef, 'user', $base); 
    36     for ($c->req->param('step') || '') { 
    37         /^1$/ and do { 
    38             $c->stash->{step} = 2; 
    39             my $acc = $c->model('Accounts')->accounts; 
    40             foreach ($acc->Parameters('_defattr_')) { 
    41                 if (/^user\.(.*)/) { 
    42                     $c->req->params->{$1} ||= $acc->val('_defattr_', $_); 
    43                 } 
    44             } 
    45             $c->req->params->{exported} = 1; 
    46             if (! $c->req->params->{id}) { 
    47                 for (1) { 
    48                     my $login; 
    49                     if ($c->req->param('sn')) { 
    50                         $login = lc(to_ascii($c->req->param('sn'))); 
    51                         length($login) > 10 and $login = substr($login, 0, 8); 
    52                         $base->get_object('user', $login) or do { 
    53                             $c->req->params->{id} = $login; 
    54                             last; 
    55                         }; 
    56                         if ($c->req->param('givenName')) { 
    57                             length($login) > 8 and $login = substr($login, 0, 8); 
    58                             $login .= substr(lc(to_ascii($c->req->param('givenName'))), 0, 1); 
    59                             $base->get_object('user', $login) or do { 
    60                                 $c->req->params->{id} = $login; 
    61                                 last; 
    62                             }; 
    63                         } 
    64                     } 
    65                 } 
    66  
    67                 my $mailid = $c->req->params->{givenName} && $c->req->params->{sn} 
    68                 ? sprintf('%s.%s', 
    69                     to_ascii(lc($c->req->params->{givenName})), 
    70                     to_ascii(lc($c->req->params->{sn})),) 
    71                 : undef; 
    72  
    73                 if ($mailid && 
    74                     $base->is_supported_object('aliases') && 
    75                     ! $base->get_object('aliases', $mailid)) { 
    76                     if ($base->get_field_name('user', 'mail', 'write')) { 
    77                         if ($base->{defattr}{'user.maildomain'}) { 
    78                             $c->req->params->{mail} ||= sprintf('%s@%s', 
    79                                 $mailid, 
    80                                 $base->{defattr}{'user.maildomain'}); 
    81                         } 
    82                     } 
    83                     if ($base->get_field_name('user', 'aliases', 'write')) { 
    84                         $c->req->params->{aliases} ||= $mailid; 
    85                     } 
    86                     warn $base->get_field_name('user', 'revaliases', 'write'); 
    87                     if ($base->get_field_name('user', 'revaliases', 'write')) { 
    88                         $c->req->params->{revaliases} ||= $mailid; 
    89                     } 
    90                 } 
    91             } 
    92             last; 
    93         }; 
    94         /^2$/ and do { 
    95             $c->stash->{step} = 2; 
    96             $c->req->params->{id} or return; 
    97             $base->get_object('user', $c->req->params->{id}) and do { 
    98                 $c->stash->{idexists} = 1; 
    99                 return; 
    100             }; 
    101             $base->create_c_object('user', $c->req->params->{id}, 
    102                 %{ $c->req->params }, 
    103                 exported => $c->req->param('exported') ? 1 : 0, 
    104             ) or return; 
    105             $base->commit; 
    106             $c->res->redirect($c->uri_for('/users', $c->req->params->{id})); 
    107             last; 
    108         }; 
     35    my ($step) = $c->req->param('step'); 
     36    my $form = $c->model('AttrForms', undef, $otype, $base); 
     37    my ($status, $info); 
     38    $c->stash->{page}{title} = "Ajouter un objet / $otype"; 
     39    if ($step) { 
     40        $info = $c->session->{ochelper}; 
    10941    } 
     42    if ($info->{name}{ask}) { 
     43        $info->{name}{content} = $c->req->param('_name'); 
     44    } 
     45    foreach my $attr (@{$info->{ask} || []}) { 
     46        $info->{contents}{$attr} = $c->req->param($form->attr_field_name($attr)); 
     47    } 
     48    my $ochelper = $base->ochelper($otype); 
     49    ($status, $info) = $ochelper->step($info); 
     50     
     51    if ($status eq 'CREATED') { 
     52        $base->commit; 
     53        $c->res->redirect($c->uri_for('/' . $otype . 's', 
     54                $info->{name}{content})); 
     55    } elsif ($status eq 'ERROR') { 
     56        # On error, restart the process 
     57        $c->stash->{page}{error} = 
     58            'Erreur lors de la création de l\'objet: ' . 
     59            LATMOS::Accounts::Log::lastmessage(LA_ERR); 
     60        foreach my $attr (@{$info->{ask} || []}) { 
     61            $c->req->params->{$form->attr_field_name($attr)} = $info->{contents}{$attr}; 
     62        } 
     63        $info->{step} = 0; # reset 
     64        ($status, $info) = $ochelper->step($info); 
     65    } else { 
     66        foreach my $attr (@{$info->{ask} || []}) { 
     67            $c->req->params->{$form->attr_field_name($attr)} = $info->{contents}{$attr}; 
     68        } 
     69    } 
     70    $c->stash->{form} = $form; 
     71    $c->stash->{ochelper} = $info;  
     72    $c->session->{ochelper} = $info; 
    11073} 
    11174 
    112 sub group : Local { 
    113     my ( $self, $c ) = @_; 
    114  
    115     my $base = $c->model('Accounts')->db; 
    116     $c->stash->{form} = $c->model('AttrForms', undef, 'group', $base); 
    117     if (!exists($c->req->params->{id})) { 
    118         $c->req->params->{exported} = 1; 
    119     } 
    120  
    121     if ($c->req->params->{id}) { 
    122         $base->get_object('group', $c->req->params->{id}) and do { 
    123             $c->stash->{idexists} = 1; 
    124             return; 
    125         }; 
    126         $base->create_c_object('group', $c->req->params->{id}, 
    127             %{ $c->req->params }, 
    128             exported => $c->req->param('exported') ? 1 : 0, 
    129         ) or return; 
    130         $base->commit; 
    131         $c->res->redirect($c->uri_for('/groups', $c->req->params->{id})); 
    132     } 
    133 } 
    13475 
    13576=head1 AUTHOR 
  • LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Groups.pm

    r718 r861  
    2727    $c->stash->{ofilter} = $c->model('AttrFilter', 'group'); 
    2828    $c->stash->{groupslist} = [  map { $_->id } @{ $c->stash->{objectslist} } ]; 
     29    $c->stash->{page}{title} = "Liste des groupes"; 
    2930 
    3031} 
     
    3536    my $base = $c->model('Accounts')->db; 
    3637 
     38    $c->stash->{page}{title} = "Groupe :: $groupname"; 
    3739    $c->stash->{groupname} = $groupname; 
    3840    $c->stash->{group} = $base->get_object('group', $groupname) or do { 
     
    6567            last; 
    6668        }; 
     69        /^dpmt$/ and do { 
     70            $c->stash->{template} = 'groups/dpmt.tt'; 
     71            my @filter = (); 
     72            push(@filter, 'active=*') if (!$c->req->param('inactive')); 
     73            push(@filter, 'mail=*') if ($c->req->param('mail')); 
     74            push(@filter, 'company=' . $c->req->param('company')) if 
     75                ($c->req->param('company')); 
     76            $c->stash->{dpmt} = $groupname; 
     77            $c->stash->{odpmt} = $c->stash->{group}; 
     78            $c->stash->{user} = [ $base->search_objects('user', 
     79                    'department=' . $c->stash->{dpmt}, 
     80                    @filter, 
     81                ) ]; 
     82            foreach my $u ($base->search_objects('user', 
     83                    'memberOf=' . $c->stash->{dpmt}, 
     84                    @filter, 
     85                )) { 
     86                push(@{$c->{stash}->{guser}}, $u) 
     87                unless(grep { $u eq $_ } @{$c->stash->{user}}); 
     88            } 
     89            last; 
     90        }; 
    6791 
    6892        $c->stash->{form} = $c->model('AttrForms', 'group' . $c->stash->{subform}, $c->stash->{group}); 
  • LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Sites.pm

    r718 r861  
    2727    $c->stash->{ofilter} = $c->model('AttrFilter', 'site'); 
    2828    $c->stash->{siteslist} = [  map { $_->id } @{ $c->stash->{objectslist} } ]; 
     29    $c->stash->{page}{title} = "Liste des sites"; 
    2930} 
    3031 
     
    3435    my $base = $c->model('Accounts')->db; 
    3536 
     37    $c->stash->{page}{title} = "Site :: $sitename"; 
    3638    $c->stash->{sitename} = $sitename; 
    3739    $c->stash->{site} = $base->get_object('site', $sitename) or do { 
  • LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Users.pm

    r759 r861  
    4343        $c->stash->{initials} = [ sort keys %initials ]; 
    4444    } 
     45    $c->stash->{page}{title} = 'Listes des utilisateurs (' . scalar(@{ 
     46                $c->stash->{objectslist} }) . ')'; 
    4547    $c->stash->{userslist} = \@userlist; 
    4648} 
     
    5153    my $base = $c->model('Accounts')->db; 
    5254 
     55    $c->stash->{page}{title} = "Utilisateur :: $username"; 
    5356    $c->stash->{username} = $username; 
    5457    $c->stash->{user} = $base->get_object('user', $username) or do { 
     
    5760    }; 
    5861    $c->stash->{subform} = $subform || ''; 
     62    $c->stash->{page}{title} = "Utilisateur :: $username"; 
    5963 
    6064    for ($subform || '') { 
     
    155159            last; 
    156160        }; 
     161        /^my$/ and do { 
     162            $c->stash->{db} = $base; 
     163            $c->stash->{template} = 'users/my.tt'; 
     164        }; 
    157165        /^dump$/ and do { 
    158166            $c->stash->{db} = $base; 
  • LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Model/Accounts.pm

    r791 r861  
    5656} 
    5757 
     58sub object_navigate { 
     59    my ($self, $otype, $id, @filter) = @_; 
     60 
     61    my @list = $self->db->search_objects($otype, @filter); 
     62 
     63    my $i = 0; 
     64    for($i = 0; $i <= $#list; $i++) { 
     65        $list[$i] eq $id and last; 
     66    } 
     67 
     68    my %ptr = (); 
     69    $ptr{oprev} = $list[$i-1] if ($i > 0); 
     70    $ptr{'onext'} = $list[$i+1] if ($i < $#list); 
     71    $ptr{ofirst} = $list[0] if ($i > 1); 
     72    $ptr{'olast'} = $list[$#list] if ($i < $#list -1); 
     73    $ptr{list} = \@list; 
     74 
     75    return \%ptr; 
     76} 
     77 
    5878# Such function must not be here, but in LATMOS::Accounts 
    5979# But code does not allow this at time 
  • LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Model/AttrFilter.pm

    r638 r861  
    1919    group => [ qw(cn description gidNumber sutype) ], 
    2020    site => [ qw(l) ], 
     21    nethost => [ qw(name cname otherName ip macaddr owner serialNumber) ], 
     22    netzone => [ qw(net group type site) ], 
    2123}; 
    2224 
  • LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Model/AttrForms.pm

    r804 r861  
    44use warnings; 
    55use base 'Catalyst::Model'; 
     6use LATMOS::Accounts::Log; 
    67 
    78=head1 NAME 
     
    3940    sutype => [ 'Structure admin.', 'select-N:sutype' ], 
    4041    exported => [ 'Propagé', 'label' ], 
     42    unexported => [ 'Caché' ], 
    4143    locked => [ 'Vérouillé', 'checkbox:l' ], 
    4244    isMainAddress => [ 'Adresse principale', 'checkbox' ], 
     
    5456    contratType => [ 'Type de contrat', 'select-N:group/sutype=contrattype' ], 
    5557    managerContact => [ 'Contact' ], 
     58    owner => [ 'Propriétaire' ], 
     59    description => [ 'Description' ], 
     60    name => [ 'Nom' ], 
     61    net => [ "Réseau" ], 
     62    macaddr => [ "Adresse Ethernet" ], 
     63    noDynamic => [ "Pas d'adressage dyn." ], 
     64    cname => [ "Alias (CName)" ], 
     65    type => [ "Type" ], 
     66    netExclude => [ "Réseau exclus" ], 
     67    output => [ "Sortie" ], 
     68    template => [ "ModÚle" ], 
     69    outputD => [ "Sortie" ], 
     70    templateD => [ "ModÚle" ], 
     71    group => [ "Groupe" ], 
     72    allow_dyn => [ "DHCP dynamique" ], 
     73    ipCount => [ "Nb d'IP" ], 
     74    freeIPCount => [ "Nb d'IP libres" ], 
     75    dnsRevision => [ "Révision DNS" ], 
     76    lastUpdate => [ "DerniÚre mise à jour "], 
     77    otherName => [ "Autres noms (A)" ], 
     78    'reverse' => [ "Forcer le reverse à" ], 
     79    dynFrom => [ 'Sans Ip depuis' ], 
     80    siteNick => [ 'Acronyme' ], 
     81    serialNumber => [ 'N° de série' ], 
     82    snNative => [ 'Nom d\'origine' ], 
     83    givenNameNative => [ 'Prénom d\'origine' ], 
     84    wWWHomePage => [ 'Site Web' ], 
     85    halReference => [ 'Référence HAL' ], 
    5686}; 
    5787 
     
    6494            mail initials nickname 
    6595            locked 
    66             exported 
    6796            create 
    6897            date 
     
    76105        ) ], 
    77106    }, 
    78     userstatus => { 
    79         name => 'Status', 
     107    userstatut => { 
     108        name => 'Statut', 
    80109        attrs => [ qw( 
    81110            company 
     
    87116        ) ], 
    88117    }, 
     118    usermy => { 
     119        name => 'My', 
     120        attrs => [ qw( 
     121            snNative 
     122            givenNameNative 
     123            wWWHomePage 
     124            halReference 
     125        ) ], 
     126    }, 
    89127    site => { 
    90128        name => 'Site', 
    91129        attrs => [ qw( 
    92130            description 
     131            siteNick 
    93132            streetAddress 
    94133            postOfficeBox 
     
    115154            site 
    116155            co 
    117             exported 
     156            unexported 
    118157            description 
    119158        ) ], 
     
    124163            gidNumber description 
    125164            managedBy 
    126             sutype exported 
     165            sutype 
    127166            create 
    128167            date 
     168        ) ], 
     169    }, 
     170    nethost => { 
     171        name => 'Ordinateur', 
     172        attrs => [ qw( 
     173            name 
     174            description 
     175            serialNumber 
     176            owner 
     177            ip 
     178            macaddr 
     179            noDynamic 
     180            cname 
     181            otherName 
     182            reverse 
     183            create 
     184            date 
     185            unexported 
     186        ) ], 
     187    }, 
     188    netzone => { 
     189        name => 'Zone réseau', 
     190        attrs => [ qw( 
     191            name 
     192            description 
     193            type 
     194            net 
     195            netExclude 
     196            outputD 
     197            templateD 
     198            site 
     199            allow_dyn 
     200            dynFrom 
     201            domain 
     202            ipCount 
     203            freeIPCount 
     204            create 
     205            date 
     206            dnsRevision 
     207            lastUpdate 
     208            unexported 
    129209        ) ], 
    130210    }, 
     
    179259    my ($self, $for) = @_; 
    180260    grep { $_ } 
    181     grep { $self->base->check_acl($self->{object} || $self->otype, $_, 'r') } 
    182     grep { $self->base->get_field_name($self->otype, $_, $for || 'a') } 
     261    grep { $self->base->attribute($self->otype, $_) } 
    183262    @{ $forms->{$self->{form}}->{attrs} }; 
    184263} 
     
    196275    my ($self, $attr) = @_; 
    197276    return $self->{c}->req->param($attr) || 
    198         ($self->{object} ? $self->{object}->get_c_field($attr) : '') 
    199 } 
    200  
    201 sub attr_field { 
    202     my ($self, $attr, $type) = @_; 
    203     my $modallow = $self->base->check_acl($self->{object} 
    204         ? ($self->{object}, $attr, 'w') 
    205         : ($self->otype, '@CREATE', 'w')); 
    206     $type ||= $attrs->{$attr}[1] || ''; 
    207     if (!($self->base->get_field_name($self->otype, $attr, 'w') && $modallow)) { 
    208         $type = 'label'; 
    209     } 
    210     # exception: gidNumber is used also in group, but we don't want 
    211     # group list here, really the number ! 
    212     $type = $modallow ? 'text-U:6' : 'label' if ($self->{otype} eq 'group' && $attr eq 'gidNumber'); 
    213     $type ||= 'text'; 
    214      
    215     my $htmlname = $self->escape(($self->{object}  
     277        ($self->{object} ? $self->{object}->get_attributes($attr) : '') 
     278} 
     279 
     280sub attr_field_name { 
     281    my ($self, $attr) = @_; 
     282    return ($self->{object} 
    216283            ? $self->{object}->id . '_' 
    217284            : '' 
    218285        ) . $attr 
    219     ); 
    220     for ($type) { 
    221         /^textarea$/ and return sprintf( 
    222             '<textarea id="%s" name="%s" cols="40">%s</textarea>', 
    223             $self->escape($htmlname), 
    224             $self->escape($htmlname), 
    225             $self->escape($self->attr_raw_value($attr) || ''), 
    226         ); 
    227         /^label$/ and do { 
    228             my $field = $self->escape( 
    229                 $self->attr_raw_value($attr) 
    230             ); 
    231             $field =~ s/\n/<br>/g; 
    232             return $field . sprintf('<input type="hidden" name="%s" value="%s">', 
    233                 $self->escape($htmlname), ($self->attr_raw_value($attr) || '')); 
    234         }; 
    235         /^date$/ and do { 
    236             my ($date, $time) = split(/ /, $self->attr_raw_value($attr) || ''); 
    237             if ($date && $date =~ /^(\d+)-(\d+)-(\d+)$/) { 
    238                 $date = "$3/$2/$1"; 
    239             } 
    240             my $html = "\n" . q{<SCRIPT LANGUAGE="JavaScript" ID="js13"> 
    241             var cal13 = new CalendarPopup(); 
    242             </SCRIPT>} . "\n"; 
    243             $html .= sprintf( 
    244                 '<input type="text" id="%s" name="%s" value="%s" size="12">', 
    245                 $self->escape($htmlname), 
    246                 $self->escape($htmlname), 
    247                 $self->escape($date) 
    248             ); 
    249             $html .= q{<DIV ID="testdiv1" STYLE="position:absolute;visibility:hidden;background-color:white;layer-background-color:white;"></DIV>}; 
    250             $html .= qq| 
    251             <A HREF="#" 
    252                 onClick="cal13.select(document.forms[0].$htmlname,'${htmlname}_anc','dd/MM/yyyy');return false;" 
    253                 TITLE="cal13.select(document.forms[0].$htmlname,'${htmlname}_anc','dd/MM/yyyy');return false;" 
    254                 NAME="${htmlname}_anc" ID="${htmlname}_anc"> 
    255                 <img src="| . $self->{c}->uri_for(qw(/static icons view-calendar-day.png)) 
    256                 . qq{" style="ref"></A> 
    257                 } . "\n"; 
    258             return $html; 
    259         }; 
    260         /^checkbox(?::(\w+))?$/ and do { 
    261             my $options = $1 || ''; 
    262             my $text = sprintf('<input type="checkbox" name="%s"%s>', 
    263                 $self->escape($htmlname), 
    264                 $self->attr_raw_value($attr) ? '  checked="yes"' : '' 
    265             );  
    266             $text .= sprintf('<input type="hidden" name="%s">', 
    267                 $self->escape($htmlname)); 
    268             if ($options =~ /l/) { 
    269                 $text .= $self->attr_raw_value($attr) 
    270                     ? ' ' . $self->attr_raw_value($attr) 
    271                     : '';  
    272             } 
    273             return $text; 
    274         }; 
    275         /^select(-\w+)?:([^:\/]+)(?:\/([^:]+))?(?::(.*))?/ and do { 
    276             my $options = $1 || ''; 
    277             my $otype = $2; 
    278             my $filter = $3; 
    279             my $keyfield = $4; 
    280             my $observe_keyfield = $keyfield || 'displayName'; 
    281             my $select = sprintf('<select id="%s" name="%s">', 
    282                 $self->escape($htmlname), 
    283                 $self->escape($htmlname)) . "\n"; 
    284             $select .= '<option value="">--</option>' . "\n" if ($options =~ /N/); 
    285             my $value = $self->attr_raw_value($attr) || ''; 
    286             my $initial_observed = ''; 
    287             foreach my $id (sort $filter 
    288                 ? $self->base->search_objects($otype, $filter) 
    289                 : $self->base->list_objects($otype)) { 
    290                 my $val = $id; 
    291                 if ($keyfield) { 
    292                     my $obj = $self->base->get_object($otype, $id) or next; 
    293                     $val = $obj->get_c_field($keyfield); 
    294                 } 
    295                 $select .= sprintf( 
    296                     '    <option value="%s"%s>%s</option>', 
    297                     $self->escape($val || ''), 
    298                     $value eq $val ? ' selected="selected"' : '', 
    299                     $self->escape($id || ''), 
     286} 
     287 
     288sub attr_field { 
     289    my ($self, $attr, $type) = @_; 
     290 
     291    my $attribute = ($self->{object} 
     292        ? $self->{object}->attribute($attr) 
     293        : $self->base->attribute($self->otype, $attr)) or return; 
     294 
     295    my $htmlname = $self->escape($self->attr_field_name($attr)); 
     296 
     297    my @html_fields; 
     298    foreach my $attr_raw_value ( 
     299        $attribute->{multiple} 
     300            ? ((grep { $_ } $self->attr_raw_value($attr)), 
     301                $attribute->readonly 
     302                    ? () 
     303                    : ('') 
     304            ) 
     305            : ($self->attr_raw_value($attr))) { 
     306 
     307        my $html_id = $htmlname . 
     308            (scalar(@html_fields) ? scalar(@html_fields) : ''); 
     309 
     310        my $html_field = ''; 
     311        for ($attribute->form_type) { 
     312            /^textarea$/i and do { 
     313                $html_field = sprintf( 
     314                    '<textarea id="%s" name="%s" cols="40">%s</textarea>', 
     315                    $self->escape($html_id), 
     316                    $self->escape($htmlname), 
     317                    $self->escape($attr_raw_value || ''), 
    300318                ); 
    301                 $select .= "\n"; 
    302                 if($value eq $val) { 
    303                     if (my $obj = $self->base->get_object($otype, $id)) { 
    304                         $initial_observed = $obj->get_c_field($observe_keyfield) 
    305                         || ''; 
    306                     } 
    307                 } 
    308             } 
    309             $select .= "</select>\n"; 
    310             $select .= $self->{c}->prototype->observe_field( $htmlname, { 
    311                 update => "${htmlname}_span", 
    312                 url => $self->{c}->uri_for('/ajax', 'rawattr', $otype), 
    313                 frequency => 1, 
    314                 with   => "'attr=" . $observe_keyfield . 
    315                 "&id='+element.options[element.selectedIndex].text", 
    316             }) . 
    317             qq|<span id="${htmlname}_span">$initial_observed</span>|; 
    318             return $select; 
    319         }; 
    320         /^text(-\w+)?(?::(\d+))?/ and do { 
    321             my $flag = $1 || ''; 
    322             if (my @allowed = $self->base->obj_attr_allowed_values( 
    323                     $self->{otype}, $attr)) { 
    324                 my $cvalue = $self->attr_raw_value($attr); 
    325                 my $textf = sprintf('<select  id="%s" name="%s">', 
     319                last; 
     320            }; 
     321            /^label$/i and do { 
     322                $attr_raw_value or last; 
     323                $html_field = $self->escape($attr_raw_value); 
     324                $html_field =~ s/\n/<br>/g; 
     325                $html_field .= sprintf('<input type="hidden" name="%s" value="%s">', 
     326                    $self->escape($htmlname), ($attr_raw_value || '')); 
     327                last; 
     328            }; 
     329            /^date$/i and do { 
     330                my ($date, $time) = split(/ /, $self->attr_raw_value($attr) || ''); 
     331                if ($date && $date =~ /^(\d+)-(\d+)-(\d+)$/) { 
     332                    $date = "$3/$2/$1"; 
     333                } 
     334                my $html = "\n" . q{<SCRIPT LANGUAGE="JavaScript" ID="js13"> 
     335                var cal13 = new CalendarPopup(); 
     336                </SCRIPT>} . "\n"; 
     337                $html .= sprintf( 
     338                    '<input type="text" id="%s" name="%s" value="%s" size="12">', 
     339                    $self->escape($html_id), 
    326340                    $self->escape($htmlname), 
     341                    $self->escape($date) 
     342                ); 
     343                $html .= q{<DIV ID="testdiv1" STYLE="position:absolute;visibility:hidden;background-color:white;layer-background-color:white;"></DIV>}; 
     344                $html .= qq| 
     345                <A HREF="#" 
     346                    onClick="cal13.select(document.getElementById('$html_id'),'${html_id}_anc','dd/MM/yyyy');return false;" 
     347                    TITLE="Date" 
     348                    NAME="${html_id}_anc" ID="${html_id}_anc"> 
     349                    <img class="attr" src="| . $self->{c}->uri_for(qw(/static icons view-calendar-day.png)) 
     350                    . qq{" style="ref"></A> 
     351                    } . "\n"; 
     352                $html_field = $html; 
     353                last; 
     354            }; 
     355            /^checkbox(?::(\w+))?$/i and do { 
     356                my $options = $1 || ''; 
     357                $html_field = sprintf('<input type="checkbox" name="%s"%s>', 
     358                    $self->escape($htmlname), 
     359                    $attr_raw_value ? '  checked="yes"' : '' 
     360                );  
     361                $html_field .= sprintf('<input type="hidden" name="%s">', 
     362                    $self->escape($htmlname)); 
     363                if ($attribute->form_option('rawvalue')) { 
     364                    $html_field .= $attr_raw_value 
     365                        ? ' ' . $attr_raw_value 
     366                        : '';  
     367                } 
     368                last; 
     369            }; 
     370            /^LIST/ and do { 
     371                my $options = $1 || ''; 
     372                my $select = sprintf('<select id="%s" name="%s">', 
     373                    $self->escape($html_id), 
    327374                    $self->escape($htmlname)) . "\n"; 
    328                 $textf .= '<option value="">--</option>' . "\n"; 
    329                 foreach (sort @allowed) { 
    330                     $textf .= sprintf('<option value="%s"%s>%s</option>' . "\n", 
    331                         $self->escape($_), 
    332                         (($cvalue || '') eq $_ ? ' selected="selected"' : ''), 
    333                         $self->escape($_), 
     375                $select .= '<option value="">--</option>' . "\n" 
     376                    unless($attribute->mandatory); 
     377                my $value = $attr_raw_value || ''; 
     378                my $initial_observed = ''; 
     379                my @valslist; 
     380                foreach my $val (sort $attribute->can_values) { 
     381                    push(@valslist, { 
     382                        val => $val, 
     383                        disp => $attribute->display($val || ''), 
     384                    }); 
     385                } 
     386                foreach (sort { $a->{disp} cmp $b->{disp} } @valslist) { 
     387                    $select .= sprintf( 
     388                        '    <option value="%s"%s>%s</option>', 
     389                        $self->escape($_->{val} || ''), 
     390                        $value eq $_->{val} ? ' selected="selected"' : '', 
     391                        $self->escape($_->{disp} || ''), 
    334392                    ); 
    335                 } 
    336                 $textf .= "</select>\n"; 
    337                 return $textf; 
    338             } else { 
    339                 my $textf = sprintf( 
     393                    $select .= "\n"; 
     394                } 
     395                $select .= "</select>\n"; 
     396 
     397                $html_field = $select; 
     398                last; 
     399            }; 
     400            /^text(-\w+)?(?::(\d+))?/i and do { 
     401                my $flag = $1 || ''; 
     402                $html_field = sprintf( 
    340403                    '<input type="text" id="%s" name="%s" value="%s" size="%d">', 
     404                    $self->escape($html_id), 
    341405                    $self->escape($htmlname), 
    342                     $self->escape($htmlname), 
    343                     $self->escape($self->attr_raw_value($attr)), 
    344                     $2 || 30, 
     406                    $self->escape($attr_raw_value), 
     407                    $attribute->form_option('length') || 30, 
    345408                ); 
    346409                if ($flag =~ /A/) { 
    347                 $textf .= qq|<span id="${htmlname}_auto_complete"></span>|; 
    348                 $textf .= "\n"; 
    349                 $textf .= $self->{c}->prototype->auto_complete_field( 
    350                     $htmlname, 
    351                     { 
    352                     update => "${htmlname}_auto_complete", 
    353                     url => $self->{c}->uri_for('/ajax', 'attrvalues', $self->otype, $attr), 
    354                     indicator => "${htmlname}_stat", min_chars => 1, 
    355                     with => "'val='+document.getElementById('$htmlname').value", 
    356                     frequency => 2, 
    357                     } 
    358                 ); 
    359                 } 
    360                 if ($flag =~ /U/) { 
    361                 $textf .= qq|<span id="${htmlname}_observer_uniq"></span>|; 
    362                 $textf .= "\n"; 
    363                 $textf .= $self->{c}->prototype->observe_field( 
    364                     $htmlname, 
    365                     { 
    366                     update => "${htmlname}_observer_uniq", 
    367                     url => $self->{c}->uri_for('/ajax', 'objattrexist', 
    368                         $self->otype, $attr), 
    369                     frequency => 2, 
    370                     indicator => "${htmlname}_stat", min_chars => 1, 
    371                     with => "'val='+document.getElementById('$htmlname').value" . 
    372                         ($self->{object} ? "+'&exclude=" . $self->{object}->id . "'" : 
    373                             ''), 
    374                     } 
    375                 ); 
    376                 } 
    377                 $textf .= qq|<span style="display:none" id="${htmlname}_stat">Searching...</span>|; 
    378  
    379                 return $textf; 
     410                    $html_field .= qq|<span id="${html_id}_auto_complete"></span>|; 
     411                    $html_field .= "\n"; 
     412                    $html_field .= $self->{c}->prototype->auto_complete_field( 
     413                        $html_id, 
     414                        { 
     415                            update => "${html_id}_auto_complete", 
     416                            url => $self->{c}->uri_for('/ajax', 'attrvalues', $self->otype, $attr), 
     417                            indicator => "${html_id}_stat", min_chars => 1, 
     418                            with => "'val='+document.getElementById('$html_id').value", 
     419                            frequency => 2, 
     420                        } 
     421                    ); 
     422                } 
     423                if ($attribute->uniq) { 
     424                    $html_field .= qq|<span class="inputvalidate" id="${html_id}_observer_uniq"></span>|; 
     425                    $html_field .= "\n"; 
     426                    $html_field .= $self->{c}->prototype->observe_field( 
     427                        $html_id, 
     428                        { 
     429                            update => "${html_id}_observer_uniq", 
     430                            url => $self->{c}->uri_for('/ajax', 'objattrexist', 
     431                                $self->otype, $attr), 
     432                            frequency => 2, 
     433                            indicator => "${html_id}_stat", min_chars => 1, 
     434                            with => "'val='+document.getElementById('$html_id').value" . 
     435                            ($self->{object} ? "+'&exclude=" . $self->{object}->id . "'" : 
     436                                ''), 
     437                        } 
     438                    ); 
     439                    $html_field .= qq|<span style="display:none" id="${html_id}_stat">Searching...</span>|; 
     440                } 
     441                last; 
     442            }; 
     443        } 
     444        if (my $ref = $attribute->reference) { 
     445            my $uri_part= { 
     446                user => 'users', 
     447                group => 'groups', 
     448                nethost => 'nethosts', 
     449                netzone => 'netzones', 
     450                site => 'sites' 
     451            }->{$ref}; 
     452            my $text; 
     453            if ($self->base->attribute($ref, 'displayName')) { 
     454                if ($attr_raw_value && 
     455                    (my $obj = $self->base->get_object($ref, $attr_raw_value))) 
     456                { 
     457                    $text = $obj->get_attributes('displayName'); 
     458                } 
     459                 
     460                $html_field .= $self->{c}->prototype->observe_field( $html_id, { 
     461                        update => "${html_id}_span", 
     462                        url => $self->{c}->uri_for('/ajax', 'rawattr', $ref), 
     463                        frequency => 1, 
     464                        with   => "'attr=displayName" . 
     465                        "&id=' + element.options[element.selectedIndex].text", 
     466                    }) . "\n" if ($attribute->form_type =~ /list/i); 
     467            } elsif($attr_raw_value && $uri_part) { 
     468                $text = sprintf( 
     469                    '<img class="attr" src="%s" title="%s">', 
     470                    $self->{c}->uri_for('/static', 'icons', 'arrow-right.png'), 
     471                    $attr_raw_value, 
     472                ) 
    380473            } 
    381         }; 
     474            $html_field .= sprintf(qq{<span id="%s" style="margin-left: 1em">}, 
     475                "${html_id}_span"); 
     476 
     477            if (defined($text)) { 
     478                $html_field .= $uri_part 
     479                    ? sprintf('<a href="%s">%s</a>', 
     480                        $self->{c}->uri_for("/$uri_part", $attribute->display($attr_raw_value)), 
     481                        $text,) 
     482                    : $text; 
     483            } 
     484 
     485            $html_field .= "</span>\n"; 
     486        } 
     487        push(@html_fields, $html_field); 
    382488    } 
     489    return join("<br>\n", @html_fields); 
    383490} 
    384491 
     
    391498} 
    392499 
     500sub write_attributes { 
     501    my ($self) = @_; 
     502    my @attrs; 
     503    foreach ($self->attributes) { 
     504        my $attr = ($self->{object} 
     505            ? $self->{object}->attribute($_) 
     506            : $self->base->attribute($self->otype, $_)) or next; 
     507        $attr->readonly and next; 
     508        push(@attrs, $_); 
     509    } 
     510    @attrs; 
     511} 
     512 
    393513sub set_attrs { 
    394514    my ($self) = @_; 
     
    396516    my $prefix = $self->{object}->id . '_'; 
    397517    my %fields; 
    398     foreach ( 
    399         grep { $self->base->get_field_name($self->otype, $_, 'w') } 
    400         $self->attributes) { 
     518    foreach ($self->write_attributes) { 
     519        my $attr = ($self->{object} 
     520            ? $self->{object}->attribute($_) 
     521            : $self->base->attribute($self->otype, $_)) or next; 
    401522        if (($attrs->{$_}[1] || '') eq 'checkbox') { 
    402523            $fields{$_} = $self->{c}->req->param("$prefix$_") ? 1 : 0; 
     524        } elsif ($attr->{multiple}) { 
     525            $fields{$_} = [ grep { $_ } $self->{c}->req->param("$prefix$_") ]; 
    403526        } else { 
    404527            $fields{$_} = $self->{c}->req->param("$prefix$_"); 
    405528        } 
    406529    } 
    407     $self->{object}->set_c_fields(%fields) or return; 
     530    $self->{object}->set_c_fields(%fields) or do { 
     531        $self->{c}->stash->{page}{error} = 
     532            LATMOS::Accounts::Log::lastmessage(LA_ERR); 
     533        $self->{object}->base->rollback; 
     534        return; 
     535    }; 
    408536    $self->{object}->base->commit; 
    409537} 
  • LATMOS-Accounts-Web/root/html/ajax/objexist.tt

    r500 r861  
    11[% IF exists %] 
    2 <img src="[% c.uri_for('/static', 'images', 'dialog-cancel.png') %]"> 
     2<img class="attr" src="[% c.uri_for('/static', 'images', 'dialog-cancel.png') %]"> 
    33([% exists %]) 
    44[% ELSE %] 
    5 <img src="[% c.uri_for('/static', 'images', 'dialog-ok-apply.png') %]"> 
     5<img class="attr" src="[% c.uri_for('/static', 'images', 'dialog-ok-apply.png') %]"> 
    66[% END %] 
  • LATMOS-Accounts-Web/root/html/departments/default.tt

    r148 r861  
    1 <!-- $Id: default.tt 432 2009-05-17 13:19:38Z nanardon $ --> 
     1<!-- $Id: default.tt 2800 2010-08-01 12:02:51Z nanardon $ --> 
    22[% IF NOT department %] 
    33No department [% departmentname | html %] found. 
  • LATMOS-Accounts-Web/root/html/departments/menu.tt

    r148 r861  
    1 <!-- $Id: user_menu.tt 443 2009-05-18 03:52:21Z nanardon $ --> 
     1<!-- $Id: menu.tt 2800 2010-08-01 12:02:51Z nanardon $ --> 
    22<div> 
    33    <table border="0"> 
  • LATMOS-Accounts-Web/root/html/groups/index.tt

    r220 r861  
    1010<table border="0"> 
    1111<tr><td colspan="2">[% groupslist.size %] groupes</td></tr> 
    12 <tr><th>Nom</th><th>Description</th></tr> 
     12<tr><th>Nom</th><th>Description</th><th></th></tr> 
    1313[% FOREACH groupname = groupslist %] 
    1414[% group = db.get_object('group', groupname) %] 
    1515<tr> 
    16     <td>[% group.id | html %]</td> 
    17     <td>[% group.get_c_field('description') | truncate(30) | html %] 
    18     <a href="[% c.uri_for('/groups', groupname) %]"> 
    19         <img src="[% c.uri_for('/static', 'icons', 'arrow-right.png') %]" 
     16    <td><a href="[% c.uri_for('/groups', groupname) %]"> 
     17        <img src="[% c.uri_for('/static', 'icons', 'icon_edit.png') %]" 
    2018            height="16" width="16" 
    2119            alt="[% "edit " _ groupname | html %]"> 
    22     </a></td> 
     20    </a> [% group.id | html %]</td> 
     21    <td> 
     22    <span title="[% group.get_c_field('description') | html %]"> 
     23    [% group.get_c_field('description') | truncate(30) | html %] 
     24    </span> 
     25    </td> 
    2326</tr> 
    2427[% END %] 
  • LATMOS-Accounts-Web/root/html/groups/menu.tt

    r544 r861  
    11<!-- $Id$ --> 
    2 <div id="omenu"> 
     2<div id="oinfo"> 
    33    [% INCLUDE 'includes/obj_prev_next.tt' objtype='group' objname=groupname %] 
    4     <table border="0"> 
    5     <tr><td> 
     4 
     5    <div> 
    66    <img src="[% c.uri_for('/static', 'icons', 'user-group-properties.png') %]" 
    77    alt="[% "Groupe " _ groupname %]"> 
    8     </td> 
    9     <td>    
    10     [% groupname | html %]<br> 
     8    </div> 
     9 
     10    <div>    
     11    <p id="oname">[% groupname | html %]</p> 
    1112    [% group.get_c_field('description') | html %] 
    12     </table> 
    13     <div style="clear: both;"></div> 
     13    </div> 
     14 
     15</div> 
     16<div style="clear: both;"></div> 
     17<div id="omenu"> 
    1418        <a href="[% c.uri_for(groupname) %]"><span [% 'id="oactive"' IF subform == '' %]>SystÚme</span></a> 
    1519        <a href="[% c.uri_for(groupname, 'users') %]"><span [% 'id="oactive"' IF subform == 'users' %]>Utilisateurs</span></a> 
     20[% IF group.get_attributes('sutype') == 'dpmt' %] 
     21        <a href="[% c.uri_for(groupname, 'dpmt') %]"><span [% 'id="oactive"' IF subform == 'dpmt' %]>Département</span></a> 
     22[% END %] 
    1623</div> 
     24<div style="clear: both;"></div> 
  • LATMOS-Accounts-Web/root/html/groups/users.tt

    r756 r861  
    44[% ELSE %] 
    55     
    6 [% modallow = c.model('Accounts').db.check_acl(group, 'memberUID', 'w') %] 
     6[% modallow = c.model('Accounts').db.check_acl(group, 'memberUID', 'w') AND 
     7NOT group.attribute('memberUID').ro %] 
    78 
    89<div class="objectform" id="objectform"> 
     
    1920<b>Membres primaire:</b><br> 
    2021[% END %] 
    21 <a href="[% c.uri_for('/users', uid) %]">[% uid | html %]</a><br> 
     22<a href="[% c.uri_for('/users', uid) %]">[% uid | html %]</a> 
     23[% ouser = c.model('Accounts').db.get_object('user', uid) %] 
     24[% INCLUDE user_flag ouser=ouser %] 
     25<br> 
    2226[% END %] 
    2327 
    2428[% FOREACH uid = group.get_c_field('member').sort %] 
     29[% ouser = c.model('Accounts').db.get_object('user', uid) %] 
    2530[% IF loop.first %] 
    2631<b>Membres</b><br> 
    2732[% END %] 
    2833[% IF modallow %] 
    29 <form action="[% c.uri_for(groupname, subform) %]" method="POST"> 
     34[% IF ouser.get_attributes('department') == group.id OR 
     35      ouser.get_attributes('contratType') == group.id %] 
     36<img src="[% c.uri_for('/static', 'icons', 'changes-prevent.png') %]" 
     37    width="24" height="24" title="Ce groupe est géré via un autre attribut"> 
     38[% ELSE %] 
     39<form action="[% c.uri_for(groupname, subform) %]" method="POST" style="display: inline"> 
    3040<input type="hidden" name="deluser" value="[% uid | html %]"> 
    3141<input type="image" src="[% c.uri_for('/static', 'icons', 'user-group-delete.png') %]" width="24" height="24"> 
     42</form> 
    3243[% END %] 
    33 <a href="[% c.uri_for('/users', uid) %]">[% uid | html %] 
    34 ([% c.model('Accounts').db.get_object('user', uid).get_attributes('displayName') | html %])</a><br> 
     44[% END %] 
     45<a href="[% c.uri_for('/users', uid, 'statut') %]">[% uid | html %] 
     46([% ouser.get_attributes('displayName') | html %])</a> 
     47[% INCLUDE user_flag ouser=ouser %] 
     48<br> 
    3549[% IF modallow %] 
    36 </form> 
    3750[% END %] 
    3851[% IF loop.last %] 
  • LATMOS-Accounts-Web/root/html/includes/form.tt

    r507 r861  
    11<!-- $Id$ --> 
    2 <div id="oform"> 
     2<div id="oform" class="oform"> 
    33[% attributes = form.attributes() %] 
    44[% IF attributes.0 %] 
     
    1313<tr><th>[% form.attr_label(attr) %]</th><td>[% form.attr_field(attr) %]</td> 
    1414[% IF loop.last %] 
     15[% IF form.write_attributes %] 
    1516<tr><td colspan=2>[% form.submit %]</td></tr> 
     17[% END %] 
    1618</table> 
    1719</form> 
  • LATMOS-Accounts-Web/root/html/includes/header.tt

    r689 r861  
    22<html> 
    33<head> 
    4 <title>[% page.title %]</title> 
     4<title>LATMOS::Accounts / [% page.title %]</title> 
    55<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
    66<link rel="stylesheet" href="[% c.uri_for('/static', 'style.css') %]?" type="text/css"> 
     
    1212<script type="text/javascript" language="JavaScript" src="[% c.uri_for('/static', 'js', 'dragdrop.js') %]"></script> 
    1313<script type="text/javascript" language="JavaScript" src="[% c.uri_for('/static', 'js', 'controls.js') %]"></script> 
     14<script type="text/javascript" language="JavaScript"> 
     15function resetmenu() { 
     16    document.getElementById('menui').innerHTML = '[% page.title | html %]'; 
     17} 
     18 
     19[% IF page.error %] 
     20window.onload = analert; 
     21 
     22function analert () { 
     23    alert('[% page.error | replace('\'', '\\\'') %]'); 
     24} 
     25[% END %] 
     26</script> 
    1427</head> 
    1528 
     
    2033[% END %] 
    2134 
     35[% BLOCK user_flag %] 
     36[% INCLUDE object_flag object = ouser %] 
     37[% END %] 
     38 
     39[% BLOCK object_flag %] 
     40[% IF object.type == 'user' %] 
     41    [% IF object.get_attributes('unexported') %] 
     42<img src="[% c.uri_for('/static', 'icons', 'gtk-delete.png') %]" 
     43class="notice" title="Ce compte est désactivé" alt="disable"> 
     44    [% ELSIF object.get_attributes('expired') %] 
     45<img src="[% c.uri_for('/static', 'icons', 'emblem-urgent.png') %]" 
     46class="notice" title="Ce compte est expiré ([% object.get_attributes('expired') %])" alt="expired"> 
     47    [% ELSIF object.get_attributes('expire') %] 
     48<img src="[% c.uri_for('/static', 'icons', 'appointment-new.png') %]" 
     49class="notice" title="Ce compte est temporaire ([% object.get_attributes('expire') %])" alt="temporary"> 
     50    [% END %] 
     51[% ELSE %] 
     52    [% IF object.get_attributes('unexported') %] 
     53<img src="[% c.uri_for('/static', 'icons', 'gtk-delete.png') %]" 
     54class="notice" title="Cette entrée est désactivés" alt="disable"> 
     55    [% END %] 
     56[% END %] 
     57[% END %] 
     58 
    2259<body> 
    2360<!-- $Id$ --> 
    24 <div id="head" class="pmenu"> 
    25     Gestion des Utilisateurs du LATMOS 
    26 [% IF c.user.username %] 
    27 <span style="float:right; font-size: 0.5em;"> 
    28 Vous êtes [% c.user.username | html %] 
    29 </span> 
    30 [% END %] 
     61<div id="head"> 
     62    <div class="pmenu"> 
     63        [% IF c.config.company %] 
     64        Gestion informatique - [% c.config.company | html %] 
     65        [% ELSE %] 
     66        Gestion informatique 
     67        [% END %] 
     68    [% IF c.user.username %] 
     69    <span style="float:right; font-size: 0.5em;"> 
     70    Vous êtes [% c.user.username | html %] 
     71    </span> 
     72    [% END %] 
     73    </div> 
     74 
     75    <div id="mainmenu" style="float: left"> 
     76        <span> 
     77            <a href="[% c.uri_for('/users') %]" 
     78            onMouseOver="document.getElementById('menui').innerHTML='Liste des utilisateurs';" 
     79            onMouseOut="resetmenu();" 
     80            > 
     81            <img title="Utilisateurs" src="[% c.uri_for('/static', 'icons', 'avatar-default.png') %]"></a> 
     82        [% IF c.model('Accounts').db.check_acl('user', '@CREATE', 'w') %] 
     83            <a href="[% c.uri_for('/create', 'user') %]" 
     84            onMouseOver="document.getElementById('menui').innerHTML='Créer un utilisateur';" 
     85            onMouseOut="resetmenu();" 
     86            > 
     87            <img title="Ajouter un utilisateurs" src="[% c.uri_for('/static', 'icons', 'add.png') %]"></a> 
     88        [% END %] 
     89        </span> 
     90        <span> 
     91            <a href="[% c.uri_for('/groups') %]" 
     92            onMouseOver="document.getElementById('menui').innerHTML='Liste des groupes';" 
     93            onMouseOut="resetmenu();" 
     94            > 
     95            <img title="Groupes" src="[% c.uri_for('/static', 'icons', 'system-users.png') %]"></a> 
     96        [% IF c.model('Accounts').db.check_acl('group', '@CREATE', 'w') %] 
     97            <a href="[% c.uri_for('/create', 'group') %]" 
     98            onMouseOver="document.getElementById('menui').innerHTML='Créer un groupe';" 
     99            onMouseOut="resetmenu();" 
     100            > 
     101            <img title="Ajouter un groupe" src="[% c.uri_for('/static', 'icons', 'add.png') %]"></a> 
     102        [% END %] 
     103        </span> 
     104        <span> 
     105            <a href="[% c.uri_for('/sites') %]" 
     106            onMouseOver="document.getElementById('menui').innerHTML='Liste des sites';" 
     107            onMouseOut="resetmenu();" 
     108            > 
     109            <img title="Sites" src="[% c.uri_for('/static', 'icons', 'xfce-internet.png') %]"></a> 
     110        </span> 
     111        [% # On cache volontairement les alias si l'utilisateur ne doit pas y 
     112        toucher %] 
     113        [% IF c.model('Accounts').db.check_acl('aliases', '@CREATE', 'w') %] 
     114        <span> 
     115            <a href="[% c.uri_for('/aliases') %]" 
     116            onMouseOver="document.getElementById('menui').innerHTML= 
     117                'Alias mail sans utilisateur';" 
     118            onMouseOut="resetmenu();" 
     119            > 
     120            <img title="Alias mail" src="[% c.uri_for('/static', 'icons', 'mail_forward.png') %]"></a> 
     121        </span> 
     122        [% END %] 
     123        <span> 
     124            <a href="[% c.uri_for('/nethosts') %]" 
     125            onMouseOver="document.getElementById('menui').innerHTML='Liste des hÃŽtes réseau';" 
     126            onMouseOut="resetmenu();" 
     127            > 
     128            <img title="HÃŽtes réseau" src="[% c.uri_for('/static', 'icons', 'video-display.png') %]"></a> 
     129        [% IF c.model('Accounts').db.check_acl('nethost', '@CREATE', 'w') %] 
     130            <a href="[% c.uri_for('/create', 'nethost') %]" 
     131            onMouseOver="document.getElementById('menui').innerHTML='Ajouter un hote réseau';" 
     132            onMouseOut="resetmenu();" 
     133            > 
     134            <img title="Ajouter un hÃŽte réseau" src="[% c.uri_for('/static', 'icons', 'add.png') %]"></a> 
     135        [% END %] 
     136        </span> 
     137        [% # On cache volontaire les zones si l'utilisateur ne doit pas y 
     138        toucher %] 
     139        [% IF c.model('Accounts').db.check_acl('netzone', '@CREATE', 'w') %] 
     140        <span> 
     141            <a href="[% c.uri_for('/netzones') %]" 
     142            onMouseOver="document.getElementById('menui').innerHTML='Liste des zones réseaux';" 
     143            onMouseOut="resetmenu();" 
     144            > 
     145            <img title="Gestion Réseau" src="[% c.uri_for('/static', 'icons', 'network-workgroup.png') %]"></a> 
     146            <a href="[% c.uri_for('/create', 'netzone') %]" 
     147            onMouseOver="document.getElementById('menui').innerHTML='Ajouter une zones réseau';" 
     148            onMouseOut="resetmenu();" 
     149            ><img title="Ajouter une zone" src="[% c.uri_for('/static', 'icons', 'add.png') %]"></a> 
     150        </span> 
     151        [% END %] 
     152        <span> 
     153            <a href="[% c.uri_for('/about') %]" 
     154            onMouseOver="document.getElementById('menui').innerHTML='A propos...';" 
     155            onMouseOut="resetmenu();" 
     156            > 
     157            <img title="A propos..." src="[% c.uri_for('/static', 'icons', 'gtk-about.png') %]"></a> 
     158        </span> 
     159    </div> 
     160 
     161    [% IF c.user.username %] 
     162    <div style="float: right"> 
     163        <span> 
     164            <a href="[% c.uri_for('/users', c.user.username) %]" 
     165            onMouseOver="document.getElementById('menui').innerHTML='Mon profile';" 
     166            onMouseOut="resetmenu();" 
     167            > 
     168            <img title="Mon profile" src="[% c.uri_for('/static', 'icons', 'gtk-home.png') %]"></a> 
     169        </span> 
     170        <span> 
     171            <a href="[% c.uri_for('/users', c.user.username, 'passwd') %]" 
     172            onMouseOver="document.getElementById('menui').innerHTML='Changer mon mot de passe';" 
     173            onMouseOut="resetmenu();" 
     174            > 
     175            <img title="Changer mon mot de passe" src="[% c.uri_for('/static', 
     176            'icons', 'dialog-password.png') %]"></a> 
     177        </span> 
     178        <span> 
     179            <a href="[% c.uri_for('/logout') %]" 
     180            onMouseOver="document.getElementById('menui').innerHTML='Se déconnecter';" 
     181            onMouseOut="resetmenu();" 
     182            > 
     183            <img title="Se déconnecter" src="[% c.uri_for('/static', 
     184                    'icons', 'gtk-close.png') %]"></a> 
     185        </span> 
     186    </div> 
     187    [% END %] 
     188     
     189    <div style="clear: both"></div> 
     190 
     191    <p>&gt; <span id="menui">[% page.title | html %]</span></p> 
    31192</div> 
    32 <div id="mainmenu" class="pmenu"> 
    33 <div style="float: left">[% mainmenu %]</div> 
    34 [% IF c.user.username %] 
    35 <div style="float: right"> 
    36     <a href="[% c.uri_for('/users', c.user.username) %]"><span>Mon profile</span></a> 
    37     <a href="[% c.uri_for('/users', c.user.username, 'passwd') %]"><span>Mon mot de passe</span></a> 
    38     <a href="[% c.uri_for('/logout') %]"><span>Se déconnecter</span></a> 
    39 </div> 
    40 [% END %] 
    41 <div style="clear: both"></div> 
    42 </div> 
  • LATMOS-Accounts-Web/root/html/includes/obj_prev_next.tt

    r544 r861  
    11<!-- $Id$ --> 
    22 
    3 <p style="float: right"> 
    4 [% prev_next = c.model('Accounts').object_prev_next(objtype, objname) %] 
    5 [% IF prev_next.0 %]                                                     
    6 <a href="[% c.uri_for(prev_next.0, subform) %]" title="[% prev_next.0 | html 
    7 %]">Prec.</a> 
    8 [% ELSE %]                                                                                 
    9 Prec.                                                                                      
    10 [% END %]                                                                                  
    11 [% IF prev_next.1 %]                                                                       
    12 <a href="[% c.uri_for(prev_next.1, subform) %]" title="[% prev_next.1 | html 
    13 %]">Suiv.</a> 
    14 [% ELSE %]                                                                                 
    15 Suiv.                                                                                      
    16 [% END %]                                                                                  
    17 </p>   
     3<div id="navigate" style="float: right"> 
     4<p> 
     5[% nav = c.model('Accounts').object_navigate(objtype, objname) %] 
     6 
     7[% IF nav.ofirst %] 
     8<a href="[% c.uri_for(nav.ofirst, subform) %]"> 
     9<img src="[% c.uri_for('/static', 'icons/gtk-goto-first-ltr.png') %]" title="[% 
     10nav.ofirst | html %]" alt="first"> 
     11</a> 
     12[% END %] 
     13 
     14[% IF nav.oprev %] 
     15<a href="[% c.uri_for(nav.oprev, subform) %]"> 
     16<img src="[% c.uri_for('/static', 'icons/gtk-go-back-ltr.png') %]" title="[% 
     17nav.oprev | html %]" alt="previous"> 
     18</a> 
     19[% END %] 
     20 
     21[% IF nav.onext %] 
     22<a href="[% c.uri_for(nav.onext, subform) %]"> 
     23<img src="[% c.uri_for('/static', 'icons/gtk-go-back-rtl.png') %]" title="[% 
     24nav.onext | html %]" alt="next"> 
     25</a> 
     26[% END %] 
     27 
     28[% IF nav.olast %] 
     29<a href="[% c.uri_for(nav.olast, subform) %]"> 
     30<img src="[% c.uri_for('/static', 'icons/gtk-goto-first-rtl.png') %]" title="[% 
     31nav.olast | html %]" alt="last"> 
     32</a> 
     33[% END %] 
     34</p> 
     35 
     36[% IF nav.list %] 
     37<form action="[% c.uri_for('/ajax/goto') %]"> 
     38<p> 
     39<input type="hidden" name="otype" value="[% objtype | html %]"> 
     40<input type="hidden" name="subform" value="[% subform | html %]"> 
     41<select name="goto"> 
     42[% FOREACH item = nav.list %] 
     43<option value="[% item | html %]" [% 'selected="selected"' IF item == objname 
     44%]>[% item | html %]</option> 
     45[% END %] 
     46</select> 
     47<input type="image" alt="Go To" title="Aller à" src="[% 
     48c.uri_for('/static', 'icons', 'gtk-jump-to-rtl.png') %]"> 
     49</p> 
     50</form> 
     51[% END %] 
     52 
     53</div>  
  • LATMOS-Accounts-Web/root/html/sites/default.tt

    r214 r861  
    1 <!-- $Id: default.tt 432 2009-05-17 13:19:38Z nanardon $ --> 
     1<!-- $Id: default.tt 2800 2010-08-01 12:02:51Z nanardon $ --> 
    22[% IF NOT site %] 
    33No site [% sitename | html %] found. 
  • LATMOS-Accounts-Web/root/html/sites/menu.tt

    r214 r861  
    1 <!-- $Id: user_menu.tt 443 2009-05-18 03:52:21Z nanardon $ --> 
    2 <div id="omenu"> 
    3     <table border="0"> 
    4     <tr><td> 
     1<!-- $Id: menu.tt 3103 2010-08-26 12:47:15Z nanardon $ --> 
     2<div id="oinfo"> 
     3 
     4    [% INCLUDE 'includes/obj_prev_next.tt' objtype='site' objname=sitename %] 
     5 
     6    <div> 
    57    <img src="[% c.uri_for('/static', 'icons', 'user-properties.png') %]" 
    68    alt="[% "User " _ sitename %]"> 
    7     </td> 
    8     <td>    
    9     [% sitename | html %]<br> 
     9    </div> 
     10    <div>    
     11    <p id="oname">[% sitename | html %]</p> 
    1012    [% user.get_c_field('l') | html %] 
    11     </td></tr> 
    12     </table> 
     13    </div> 
    1314</div> 
     15<div style="clear: both;"></div> 
  • LATMOS-Accounts-Web/root/html/users/address.tt

    r686 r861  
    2020</form> 
    2121 
     22[% IF address.base.check_acl(address, '@DELETE', 'w') %] 
    2223<table border=1><tr><td align="center"> 
    2324<form action="[% c.uri_for(username, subform) %]" method="POST"> 
     
    2829</form> 
    2930</td></tr></table> 
     31[% END %] 
    3032 
    3133</div> 
  • LATMOS-Accounts-Web/root/html/users/address_form.tt

    r760 r861  
    6363    <td>[% form.attr_field('co', fieldtype) %]</td> 
    6464</tr> 
     65[% IF form.write_attributes %] 
    6566<tr> 
    6667    <th></th> 
    67     <td>[% form.submit %]</td> 
     68    <td> 
     69    [% form.submit %] 
     70    </td> 
    6871</tr> 
     72[% END %] 
    6973</table> 
  • LATMOS-Accounts-Web/root/html/users/groups.tt

    r508 r861  
    2020[% FOREACH g = user.get_c_field('memberOf') %] 
    2121[% IF modallow %] 
    22 <form action="[% c.uri_for(username, subform) %]" method="POST"> 
     22[% IF user.get_attributes('department') == g OR  
     23      user.get_attributes('contratType') == g %] 
     24<img src="[% c.uri_for('/static', 'icons', 'changes-prevent.png') %]" 
     25    width="24" height="24" title="Ce groupe est géré via un autre attribut"> 
     26[% ELSE %] 
     27<form action="[% c.uri_for(username, subform) %]" method="POST" style="display: inline"> 
    2328<input type="hidden" name="delgroup" value="[% g | html %]"> 
    2429<input type="image" src="[% c.uri_for('/static', 'icons', 'user-group-delete.png') %]" width="24" height="24"> 
     30</form> 
     31[% END %] 
    2532[% END %] 
    2633<a href="[% c.uri_for('/groups', g) %]">[% g | html %]</a><br> 
    2734[% IF modallow %] 
    28 </form> 
    2935[% END %] 
    3036[% END %] 
  • LATMOS-Accounts-Web/root/html/users/index.tt

    r682 r861  
    99 
    1010<table border="0"> 
    11 <tr><td colspan="2">[% objectslist.size %] Utilisateurs<br> 
     11<tr><td colspan="5"> 
    1212[% IF initials %] 
    1313Pages:  
     
    2222[% END %] 
    2323</td></tr> 
    24 <tr><th>Login</th><th>Nom</th></tr> 
     24<tr><td></td><th>Login</th><th>Nom</th><th>Description</th><th>Mail</th></tr> 
    2525[% FOREACH username = userslist %] 
    2626[% user = db.get_object('user', username) %] 
    2727<tr> 
    28     <td>[% username | html %]</td> 
     28    <td> 
     29[% INCLUDE 'user_flag' ouser=user %] 
     30    </td> 
     31    <td><a href="[% c.uri_for('/users', username) %]"> 
     32        <img src="[% c.uri_for('/static', 'icons', 'icon_edit.png') %]" 
     33            height="16" width="16" 
     34            alt="[% "edit " _ username | html %]"> 
     35    </a>[% username | html %]</td> 
    2936    <td> 
    3037        [% user.get_c_field('sn') | html %] 
    3138        [% user.get_c_field('givenName') | html %] 
    32         [% user.get_c_field('description') | truncate(20) | html %] 
    33     <a href="[% c.uri_for('/users', username) %]"> 
    34         <img src="[% c.uri_for('/static', 'icons', 'arrow-right.png') %]" 
    35             height="16" width="16" 
    36             alt="[% "edit " _ username | html %]"> 
    37     </a></td> 
     39   </td> 
     40    <td> 
     41    <span title="[% user.get_c_field('description') | html %]">     
     42    [% user.get_c_field('description') | truncate(20) | html %] 
     43    </span> 
     44   </td> 
     45    <td><span title="[% user.get_c_field('mail') | html %]"> 
     46    [% user.get_c_field('mail') | truncate(20) | html %]</span> 
     47   </td> 
    3848</tr> 
    3949[% END %] 
  • LATMOS-Accounts-Web/root/html/users/menu.tt

    r730 r861  
    11<!-- $Id$ --> 
    2 <div id="omenu"> 
    3  
     2<div id="oinfo"> 
    43[% INCLUDE 'includes/obj_prev_next.tt' objtype='user' objname=username %] 
    54 
    6 <table border="0"> 
    7 <tr><td> 
    8 [% IF NOT user.get_c_field('exported') OR user.get_c_field('locked') %] 
    9 <img src="[% c.uri_for('/static', 'icons', 'view-media-artist.png') %]" 
    10 [% ELSE %] 
    11 <img src="[% c.uri_for('/static', 'icons', 'user-properties.png') %]" 
    12 [% END %] 
    13 alt="[% "User " _ username %]"> 
    14 </td> 
    15 <td>    
    16 [% username | html %]<br> 
    17 [% user.get_c_field('displayName') | html %] 
    18 </td> 
    19 </tr> 
    20 </table> 
     5    <div> 
     6    [% IF NOT user.get_c_field('exported') %] 
     7    <img src="[% c.uri_for('/static', 'icons', 'gtk-delete.png') %]" 
     8    alt="[% "User " _ username %]" title="le compte est désactivé"> 
     9    [% ELSE %] 
     10    <img src="[% c.uri_for('/static', 'icons', 'user-properties.png') %]" 
     11    alt="[% "User " _ username %]"> 
     12    [% END %] 
     13    </div> 
     14 
     15    <div> 
     16    [% IF user.get_c_field('locked') %] 
     17    <img src="[% c.uri_for('/static', 'icons', 'locked.png') %]"  
     18    alt="le compte est vérrouillé" title="le compte est vérrouillé"> 
     19    [% END %] 
     20    </div> 
     21 
     22    <div> 
     23    <p id="oname">[% username | html %] 
     24        [% INCLUDE user_flag ouser = user %]</span></p> 
     25    [% user.get_c_field('displayName') | html %] 
     26    </div> 
     27</div> 
    2128<div style="clear: both;"></div> 
     29<div id="omenu"> 
    2230        <a href="[% c.uri_for(username) %]"><span [% 'id="oactive"' IF subform == '' %]>SystÚme</span></a> 
    23         <a href="[% c.uri_for(username, 'status') %]"><span [% 'id="oactive"' IF subform == 'status' %]>Status</span></a> 
     31        <a href="[% c.uri_for(username, 'statut') %]"><span [% 'id="oactive"' IF subform == 'statut' %]>Statut</span></a> 
    2432        <a href="[% c.uri_for(username, 'groups') %]"><span [% 'id="oactive"' IF subform == 'groups' %]>Groupes</span></a> 
    2533        <a href="[% c.uri_for(username, 'address') %]"><span [% 'id="oactive"' IF subform == 'address' %]>Adresses</span></a> 
    2634        <a href="[% c.uri_for(username, 'mail') %]"><span [% 'id="oactive"' IF subform == 'mail' %]>eMail</span></a> 
     35        <a href="[% c.uri_for(username, 'my') %]"><span [% 'id="oactive"' IF subform == 'my' %]>My</span></a> 
    2736[% IF c.model('Accounts').db.check_acl(user, 'userPasswd', 'r') %] 
    2837        <a href="[% c.uri_for(username, 'passwd') %]"><span [% 'id="oactive"' IF subform == 'passwd' %]>Mot de passe</span></a> 
    2938[% END %] 
    3039</div> 
     40<div style="clear:both"></div> 
  • LATMOS-Accounts-Web/root/html/users/passwd.tt

    r667 r861  
    33[% INCLUDE 'users/menu.tt' %] 
    44 
     5<script type="text/javascript"> 
     6function check_passwd() { 
     7    new Ajax.Updater( 
     8        'perror', 
     9        '[% c.uri_for('/ajax', 'cracklib', username) %]', 
     10        { parameters: 'passwd=' + document.getElementById("passwd").value + 
     11            '&cpasswd=' + document.getElementById("cpasswd").value } 
     12    ) 
     13} 
     14</script> 
     15 
    516<div id="oform"> 
    617[% IF c.model('Accounts').db.check_acl(user, 'userPassword', 'w') %] 
    718<form id="fpasswd" action="[% c.uri_for(username, subform) %]" method="POST"> 
    8 [% c.prototype.observe_form('fpasswd', { 
    9     url => c.uri_for('/ajax', 'cracklib', username), 
    10     update => 'perror', 
    11     frequency => 1, 
    12 }) %] 
    1319<table border="1"> 
    1420<tr> 
    1521<th>Nouveau mot de passe:</th> 
    16 <td><input type="password" name="passwd"></td> 
     22<td><input type="password" name="passwd" id="passwd" onkeyup="check_passwd()"></td> 
    1723</tr> 
    1824<tr> 
    1925<th>Confirmation:</th> 
    20 <td><input type="password" name="cpasswd"></td> 
     26<td><input type="password" name="cpasswd" id="cpasswd" onkeyup="check_passwd()"></td> 
    2127</tr> 
    2228<tr><td colspan="2"><span id="perror">[% pmerror | html %]</span></td></tr> 
  • LATMOS-Accounts-Web/root/static/style.css

    r507 r861  
    22    border: none; 
    33    vertical-align: middle; 
     4    padding: 0em 
    45} 
    56 
    67.pmenu { 
     8    padding: 0.5em; 
     9    font-size: 2em; 
     10} 
     11 
     12.permdenied { 
     13    padding: 0.5em; 
     14} 
     15 
     16#head { 
    717    background-color: #7DB4D8; 
    8     padding: 0.5em; 
    9 } 
    10  
    11 .permdenied { 
    12     padding: 0.5em; 
    13 } 
    14  
    15 #head { 
    16     font-size: 2em; 
     18    padding-bottom: 0.2em; 
     19    padding-top: 0.2em; 
    1720} 
    1821 
    1922#mainmenu a { 
    20     font-size: 80%; 
     23    font-size: 50px; 
    2124    overflow: hidden; 
    2225    text-decoration: none; 
     
    2427 
    2528#mainmenu span { 
     29    padding-left: 1em; 
     30    padding-right: 1em; 
     31    text-decoration: none; 
     32} 
     33 
     34#mainmenu span#actif { 
    2635    border-style: outset; 
    2736    padding-left: 1em; 
    2837    padding-right: 1em; 
    2938    text-decoration: none; 
    30 } 
    31  
    32 #mainmenu span#actif { 
    33     border-style: inset; 
    34     border-size: 1px; 
    35     padding-left: 1em; 
    36     padding-right: 1em; 
    37     text-decoration: none; 
     39    height: 32px; 
    3840} 
    3941 
    4042#mainmenu a:hover { 
    41     border: solid; 
    42 } 
    43  
    44 div#objectform  { 
     43/*    border: solid;*/ 
     44    background-color: #7DB4D8; 
     45} 
     46 
     47#oinfo div { 
     48    float: left; 
     49    padding: 0.5em; 
     50} 
     51 
     52#oname { 
     53    font-size: 1.2em; 
     54    padding: 0em; 
     55    margin: 0em; 
     56} 
     57 
     58#omenu a { 
     59    text-decoration: none; 
     60    color: black; 
     61} 
     62 
     63#omenu div { 
     64    float: left; 
     65    padding-top: 0.5em; 
     66    padding-bottom: 0.5em; 
     67} 
     68 
     69 
     70#omenu span { 
     71    padding-left: 1em; 
     72    padding-right: 1em; 
     73    margin: 0; 
     74    border: groove thin; 
     75    text-decoration: none; 
     76    float: left; 
     77    background-color: #DDDDD9; 
     78    color: black; 
     79} 
     80 
     81#omenu span#oactive { 
     82    padding-left: 1em; 
     83    padding-right: 1em; 
     84    margin: 0; 
     85    border: groove thin; 
     86    text-decoration: none; 
     87    float: left; 
     88    background-color: #7DB4D8; 
     89    color: black; 
     90} 
     91 
     92#omenu a:hover { 
     93    /* border: inset; */ 
     94    text-color blue; 
     95} 
     96 
     97div.objectform  { 
    4598    border-style: outset; 
    4699    width: 60%; 
     
    49102} 
    50103 
    51 #objectform table { 
     104.objectform table { 
    52105    margin-left: auto; 
    53106    margin-right: auto; 
     
    56109} 
    57110 
    58 #omenu a { 
    59     text-decoration: none; 
    60 } 
    61  
    62 #omenu td { 
    63     padding-left: 0.5em; 
    64     padding-right: 0.5em; 
    65 } 
    66  
    67 #omenu table { 
     111div.objectformleft { 
     112    /* border-style: outset; */ 
     113    width: 60%; 
     114    margin-left: auto; 
     115    margin-right: auto; 
     116} 
     117 
     118.objectformleft table { 
     119    /* 
     120    margin-top: 1em; 
     121    margin-bottom: 1em; 
     122    */ 
     123} 
     124 
     125.objectformleft #oform { 
     126    /*border: inset;*/ 
     127    float: left; 
     128} 
     129 
     130.oform { 
     131    /* border: inset; */ 
    68132    margin: 0.5em; 
    69133} 
    70134 
    71  
    72 #omenu span { 
    73     padding-left: 1em; 
    74     padding-right: 1em; 
    75     margin: 0; 
    76     border: groove thin; 
    77     text-decoration: none; 
    78 } 
    79  
    80 #omenu span#oactive { 
    81     margin: 0; 
    82     padding-left: 1em; 
    83     padding-right: 1em; 
    84     border: outset; 
    85     border-bottom-style: none; 
    86     text-decoration: none; 
    87     font-weight:bold; 
    88 } 
    89  
    90 #omenu a:hover { 
    91     border: inset; 
    92 } 
    93  
    94 #oform { 
    95     border: inset; 
    96 } 
    97  
    98 table#oform { 
    99     margin-left: 20%; 
    100     margin-right: 20%; 
     135.oform table { 
     136    /* margin-left: 20%; 
     137    margin-right: 20%; */ 
     138} 
     139 
     140.oform td { 
     141    vertical-align: top; 
     142} 
     143 
     144.oform p { 
     145    margin: 0.5em; 
     146    font-weight: bold; 
     147} 
     148 
     149.oform ul { 
     150    padding: 0.5em; 
     151} 
     152 
     153.oform li { 
     154    list-style-type: none; 
     155    padding-left: 0.2em; 
     156} 
     157 
     158.inputvalidate img { 
     159    width: 1em; 
     160    height:1em; 
     161} 
     162 
     163#navigate { 
     164} 
     165 
     166#navigate p { 
     167    margin: 0em; 
     168    text-align: center; 
     169} 
     170 
     171#navigate input { 
     172    width: 3em; 
     173    height:3em; 
     174    vertical-align: middle; 
     175} 
     176 
     177#navigate img { 
     178    width: 2em; 
     179    height:2em; 
     180    vertical-align: middle; 
     181} 
     182 
     183img.notice { 
     184    width: 1em; 
     185    height:1em; 
     186    vertical-align: middle; 
     187} 
     188 
     189img.attr { 
     190    width: 1.5em; 
     191    height:1.5em; 
     192    vertical-align: middle; 
    101193} 
    102194 
Note: See TracChangeset for help on using the changeset viewer.