[% META title = 'User » Register New User' -%] [% # PROCESS dumper.tt dump = errs %] [% # PROCESS dumper.tt dump = registered_users %] [% # PROCESS dumper.tt dump = user_details %] [% # PROCESS dumper.tt dump = input_params %] [% # PROCESS dumper.tt dump = user_details.last_name.remove("\\\'") %]

Registration Details

[% IF errs; # INCLUDE dumper.tt dump = errs; %]

[% c.cfg('msg').dfv_errors %]

[% ELSE %]

Usage: preview message -> post message.

Paste Application Details:
[% END %]
[% IF user_groups AND NOT new_user_create_success %]

User group: « select one

[% END %]

[% IF new_user_create_success %] create new user » [% ELSE %] [% IF user_details AND NOT errs; class = has_role ? 'normal' : 'red' %] [% ELSE %] [% END %] [% IF user_details AND NOT has_role %] check spelling/case of 'position' entry [% END %] [% END %]

[% IF user_details; # PROCESS dumper.tt dump = preview %]

Preview:

[% IF registered_users.size; # have potential duplicates: cols = ['username' 'last_name' 'first_name' 'email']; BLOCK row; class = user_details.${col} == user.${col} ? 'red' : 'normal'; %] [% user.${col} %] [% END %]

Registered users with similar username:

[% FOREACH user IN registered_users %] [% FOREACH col IN cols; INCLUDE row; END %] [% END %]
username last name first name email location last login active
[% user.user_location.location_name %] [% user.last_login.strftime('%d.%b.%Y %H:%M') %] [% user.active %]
[% END %]
[% IF errs.error_full_name # only needed if entry already exists %] [% END %] [% class = user_details.user_location_id ? 'normal' : 'red' %] [% class = has_role OR new_user_create_success ? 'normal' : 'red' %]
UserID: [% userid = user_details.username || input_params.username | upper; IF userid; userid; ELSE %] CANNOT CREATE USERNAME[% END %] [% errs.error_username %]
LastName: [% ( user_details.last_name || input_params.last_name ) | ucfirst %] [% IF errs.error_last_name %] [% errs.error_last_name %] [% END %]
FirstName: [% ( user_details.first_name || input_params.first_name ) | ucfirst %] [% IF errs.error_first_name %] [% errs.error_first_name %] [% END %]
FullName: [% ( user_details.first_name || input_params.first_name ) | ucfirst %] [% ( user_details.last_name || input_params.last_name ) | ucfirst %] [% errs.error_full_name %]
Email: [% email = user_details.email || input_params.email; email %] [% IF errs.error_email; errs.error_email; ELSIF NOT email.match('nhs.(net|uk)$') %] « check email belongs to valid domain [% END %]
Location: [% user_details.location || input_params.location %] [% IF errs.error_user_location_id.match('missing') %] « unknown user location [% END %]
Designation: [% user_details.designation || input_params.designation %] [% UNLESS has_role OR new_user_create_success %] « does not exist [% END %]
Service: [% user_details.service || input_params.service # deleted if invalid %] [% errs.error_service %]
[% UNLESS errs %]
[% INCLUDE admin/user/new_user_msg.tt | html %]
[% END %]
[% END %]