Changeset 899 for LATMOS-Accounts-Web


Ignore:
Timestamp:
02/23/12 13:02:26 (12 years ago)
Author:
nanardon
Message:
  • move attributes label to config files
Location:
LATMOS-Accounts-Web
Files:
1 added
4 edited
1 moved

Legend:

Unmodified
Added
Removed
  • LATMOS-Accounts-Web/Changes

    r890 r899  
    77 
    88    - review object list page and icons (Hans) 
     9 
     10    - move attributes label from code to configuration file, allowing to change 
     11      them 
     12    - add a prossible description/hint to attribute 
    913 
    10142.0.0 
  • LATMOS-Accounts-Web/Makefile.PL

    r861 r899  
    6363EOF 
    6464} 
     65 
     66sub install { 
     67    my ($self) = @_; 
     68    my $section = $self->SUPER::install(); 
     69 
     70    $section =~ s/(^install ::.*)/$1 install_config/m; 
     71 
     72    $section .= q[ 
     73install_config :: 
     74        install -d $(DESTDIR)/etc 
     75        install -d $(DESTDIR)/etc/latmos-accounts 
     76        install etc/latmos_accounts_web.yml $(DESTDIR)/etc/latmos-accounts//latmos_accounts_web.yml 
     77]; 
     78 
     79    return $section; 
     80} 
     81 
  • LATMOS-Accounts-Web/etc/latmos_accounts_web.yml

    • Property svn:keywords set to Id
    r896 r899  
    11--- 
     2# $Id$ 
     3 
    24# Where to find configuration file: 
    35# config: /etc/latmos-accounts/latmos-accounts.ini 
     
    2426#        op: = 
    2527#      - ... 
     28 
     29# The attribute label used in application 
     30attrs: 
     31  uidNumber: 
     32    label: UID 
     33#    hint: ... 
     34  givenName: 
     35    label: Prénom 
     36  uid: 
     37    label: Login 
     38  uidNumber: 
     39    label: UID 
     40  gidNumber: 
     41    label: GID 
     42  manager: 
     43    label: Responsable 
     44  managedBy: 
     45    label: Responsable 
     46  sn: 
     47    label: Nom 
     48  givenName: 
     49    label: Prénom 
     50  homeDirectory: 
     51    label: Home 
     52  loginShell: 
     53    label: Shell 
     54  physicalDeliveryOfficeName: 
     55    label: Bureau 
     56  telephoneNumber: 
     57    label: Téléphone 
     58  otherTelephone: 
     59    label: Téléphone (autre) 
     60  company: 
     61    label: Société 
     62  l: 
     63    label: Ville 
     64  postalCode: 
     65    label: Code postal 
     66  postOfficeBox: 
     67    label: BP 
     68  department: 
     69    label: Département 
     70  streetAddress: 
     71    label: Rue 
     72  title: 
     73    label: Fonction 
     74  expire: 
     75    label: Expire le 
     76  st: 
     77    label: État (US) 
     78  sutype: 
     79    label: Structure admin. 
     80  exported: 
     81    label: Propagé 
     82  unexported: 
     83    label: Caché 
     84  locked: 
     85    label: Vérouillé 
     86  isMainAddress: 
     87    label: Adresse principale 
     88  site: 
     89    label: Site 
     90  co: 
     91    label: Pays 
     92  mail: 
     93    label: Mail 
     94  grade: 
     95    label: Grade 
     96  facsimileTelephoneNumber: 
     97    label: Fax 
     98  nickname: 
     99    label: Nick 
     100  cn: 
     101    label: Nom 
     102  initials: 
     103    label: Initiales 
     104  create: 
     105    label: Créé le 
     106  date: 
     107    label: Modifié le 
     108  college: 
     109    label: College 
     110  contratType: 
     111    label: Type de contrat 
     112  managerContact: 
     113    label: Contact 
     114  owner: 
     115    label: Propriétaire 
     116  description: 
     117    label: Description 
     118  name: 
     119    label: Nom 
     120  net: 
     121    label: Réseau 
     122  macaddr: 
     123    label: Adresse Ethernet 
     124  noDynamic: 
     125    label: Pas d'adressage dyn. 
     126  cname: 
     127    label: Alias (CName) 
     128  type: 
     129    label: Type 
     130  netExclude: 
     131    label: Réseau exclus 
     132  output: 
     133    label: Sortie 
     134  template: 
     135    label: ModÚle 
     136  gecos: 
     137    label: Gecos Unix 
  • LATMOS-Accounts-Web/latmos-accounts-web.spec.in

    r861 r899  
    9494%config(noreplace) %_sysconfdir/httpd/conf/webapps.d/* 
    9595%_sysconfdir/init.d/latmos-accounts-web 
    96  
     96%config(noreplace) %_sysconfdir/latmos-accounts/* 
  • LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Model/AttrForms.pm

    r898 r899  
    1515 
    1616=cut 
    17  
    18 my $attrs = { 
    19     uid => [ 'Login' ], 
    20     uidNumber => [ 'UID' ], 
    21     gidNumber => [ 'GID' ], 
    22     manager => [ 'Responsable' ], 
    23     managedBy => [ 'Responsable' ], 
    24     sn => [ 'Nom' ], 
    25     givenName => [ 'Prénom' ], 
    26     homeDirectory => [ 'Home' ], 
    27     loginShell => [ 'Shell' ], 
    28     physicalDeliveryOfficeName => [ 'Bureau' ], 
    29     telephoneNumber => [ 'Téléphone' ], 
    30     otherTelephone => [ 'Téléphone (autre)' ], 
    31     company => [ 'Société' ], 
    32     l => [ 'Ville' ], 
    33     postalCode => [ 'Code postal' ], 
    34     postOfficeBox => [ 'BP' ], 
    35     department => [ 'Département' ], 
    36     streetAddress => [ 'Rue' ], 
    37     title => [ 'Fonction' ], 
    38     expire => [ 'Expire le' ], 
    39     st => [ 'État (US)' ], 
    40     sutype => [ 'Structure admin.' ], 
    41     exported => [ 'Propagé' ], 
    42     unexported => [ 'Caché' ], 
    43     locked => [ 'Vérouillé' ], 
    44     isMainAddress => [ 'Adresse principale' ], 
    45     site => [ 'Site' ], 
    46     co => [ 'Pays' ], 
    47     mail => [ 'Mail' ], 
    48     grade => [ 'Grade' ], 
    49     facsimileTelephoneNumber => [ 'Fax' ], 
    50     nickname => [ 'Nick' ], 
    51     cn => [ 'Nom' ], 
    52     initials => [ 'Initiales' ], 
    53     create => [ 'Créé le' ], 
    54     date => [ 'Modifié le' ], 
    55     college => [ 'College' ], 
    56     contratType => [ 'Type de contrat' ], 
    57     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' ], 
    86 }; 
    8717 
    8818my $forms = { 
     
    273203sub attr_label { 
    274204    my ($self, $attr) = @_; 
     205    my ($hint, $label) = ('', ''); 
     206    LATMOS::Accounts::Web->config->{attrs} ||= {}; 
    275207    my $htmlname = ($self->{object} ? $self->{object}->id . '_' : '') . $attr; 
    276     return sprintf('<label for="%s">%s</label>', 
     208    if (my $attr_config = LATMOS::Accounts::Web->config->{attrs}{$attr}) { 
     209        $label = $attr_config->{label} || ''; 
     210        utf8::encode($label); 
     211        $hint = $attr_config->{hint} || ''; 
     212        utf8::encode($hint); 
     213    } 
     214    return sprintf('<label %sfor="%s">%s</label>', 
     215        ($hint ? sprintf('title="%s"', $self->escape($hint)) : ''), 
    277216        $self->escape($htmlname), 
    278         $self->escape($attrs->{$attr}[0] || $attr) 
     217        $self->escape($label || $attr), 
    279218    ); 
    280219} 
     
    528467            ? $self->{object}->attribute($_) 
    529468            : $self->base->attribute($self->otype, $_)) or next; 
    530         if (($attrs->{$_}[1] || '') eq 'checkbox') { 
    531             $fields{$_} = $self->{c}->req->param("$prefix$_") ? 1 : 0; 
    532         } elsif ($attr->{multiple}) { 
     469        if ($attr->{multiple}) { 
    533470            $fields{$_} = [ grep { $_ } $self->{c}->req->param("$prefix$_") ]; 
    534471        } else { 
Note: See TracChangeset for help on using the changeset viewer.