--- loncom/interface/lonuserutils.pm 2009/03/12 17:30:55 1.85
+++ loncom/interface/lonuserutils.pm 2010/01/20 16:46:23 1.114
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Utility functions for managing LON-CAPA user accounts
#
-# $Id: lonuserutils.pm,v 1.85 2009/03/12 17:30:55 bisitz Exp $
+# $Id: lonuserutils.pm,v 1.114 2010/01/20 16:46:23 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -91,7 +91,7 @@ sub modifyuserrole {
if ($setting eq 'course' || $context eq 'course') {
$scope = '/'.$cid;
$scope =~ s/\_/\//g;
- if ($role ne 'cc' && $sec ne '') {
+ if (($role ne 'cc') && ($role ne 'co') && ($sec ne '')) {
$scope .='/'.$sec;
}
} elsif ($context eq 'domain') {
@@ -235,7 +235,7 @@ sub domain_roles_select {
# domain context
#
# Role types
- my @roletypes = ('domain','author','course');
+ my @roletypes = ('domain','author','course','community');
my %lt = &role_type_names();
#
# build up the menu information to be passed to
@@ -247,6 +247,10 @@ sub domain_roles_select {
foreach my $roletype (@roletypes) {
# set up the text for this domain
$select_menus{$roletype}->{'text'}= $lt{$roletype};
+ my $crstype;
+ if ($roletype eq 'community') {
+ $crstype = 'Community';
+ }
# we want a choice of 'default' as the default in the second menu
if ($env{'form.roletype'} ne '') {
$select_menus{$roletype}->{'default'} = $env{'form.showrole'};
@@ -261,7 +265,7 @@ sub domain_roles_select {
@roles = &construction_space_roles();
} else {
my $custom = 1;
- @roles = &course_roles('domain',undef,$custom);
+ @roles = &course_roles('domain',undef,$custom,$roletype);
}
my $order = ['Any',@roles];
$select_menus{$roletype}->{'order'} = $order;
@@ -271,14 +275,15 @@ sub domain_roles_select {
&mt('Custom role');
} else {
$select_menus{$roletype}->{'select2'}->{$role} =
- &Apache::lonnet::plaintext($role);
+ &Apache::lonnet::plaintext($role,$crstype);
}
}
$select_menus{$roletype}->{'select2'}->{'Any'} = &mt('Any');
}
my $result = &Apache::loncommon::linked_select_forms
('studentform',(' 'x3).&mt('Role: '),$env{'form.roletype'},
- 'roletype','showrole',\%select_menus,['domain','author','course']);
+ 'roletype','showrole',\%select_menus,
+ ['domain','author','course','community']);
return $result;
}
@@ -290,7 +295,7 @@ sub hidden_input {
}
sub print_upload_manager_header {
- my ($r,$datatoken,$distotal,$krbdefdom,$context,$permission)=@_;
+ my ($r,$datatoken,$distotal,$krbdefdom,$context,$permission,$crstype)=@_;
my $javascript;
#
if (! exists($env{'form.upfile_associate'})) {
@@ -327,10 +332,12 @@ sub print_upload_manager_header {
my $javascript_validations =
&javascript_validations('upload',$krbdefdom,$password_choice,undef,
$env{'request.role.domain'},$context,
- $groupslist);
- my $checked=(($env{'form.noFirstLine'})?' checked="checked" ':'');
- $r->print(&mt('Total number of records found in file: [_1]',''.$distotal.' ').
- " \n");
+ $groupslist,$crstype);
+ my $checked=(($env{'form.noFirstLine'})?' checked="checked"':'');
+ $r->print('
'
+ .&mt('Total number of records found in file: [_1]'
+ ,''.$distotal.' ')
+ ."
\n");
$r->print(''.
&mt('Identify fields in uploaded list')." \n");
$r->print(&mt('Enter as many fields as you can.
The system will inform you and bring you back to this page,
if the data selected are insufficient to add users.')."
\n");
@@ -341,21 +348,24 @@ sub print_upload_manager_header {
&hidden_input('fileupload',$env{'form.fileupload'}).
&hidden_input('upfiletype',$env{'form.upfiletype'}).
&hidden_input('upfile_associate',$env{'form.upfile_associate'}));
- $r->print('
'.
+ $r->print(' '.
&mt('Ignore First Line').' ');
$r->print(' ');
+ 'onclick="javascript:this.form.associate.value=\'Reverse Association\';submit(this.form);" />');
$r->print(" \n".
'');
+ '// '."\n".
+ '');
}
###############################################################
###############################################################
sub javascript_validations {
my ($mode,$krbdefdom,$curr_authtype,$curr_authfield,$domain,
- $context,$groupslist)=@_;
+ $context,$groupslist,$crstype)=@_;
my %param = (
kerb_def_dom => $krbdefdom,
curr_authtype => $curr_authtype,
@@ -376,10 +386,10 @@ sub javascript_validations {
if (($context eq 'course') || ($context eq 'domain')) {
if ($context eq 'course') {
if ($env{'request.course.sec'} eq '') {
- $setsection_call = 'setSections(document.'.$param{'formname'}.');';
+ $setsection_call = 'setSections(document.'.$param{'formname'}.",'$crstype'".');';
$setsections_js =
&setsections_javascript($param{'formname'},$groupslist,
- $mode);
+ $mode,'',$crstype);
} else {
$setsection_call = "'ok'";
}
@@ -401,7 +411,7 @@ sub javascript_validations {
krb => 'You need to specify the Kerberos domain.',
ipass => 'You need to specify the initial password.',
name => 'The optional name field was not specified.',
- snum => 'The optional ID number field was not specified.',
+ snum => 'The optional student/employee ID field was not specified.',
section => 'The optional section field was not specified.',
email => 'The optional e-mail address field was not specified.',
role => 'The optional role field was not specified.',
@@ -738,7 +748,7 @@ ENDPICK
###############################################################
###############################################################
sub print_upload_manager_footer {
- my ($r,$i,$keyfields,$defdom,$today,$halfyear,$context,$permission) = @_;
+ my ($r,$i,$keyfields,$defdom,$today,$halfyear,$context,$permission,$crstype) = @_;
my $form = 'document.studentform';
my $formname = 'studentform';
my ($krbdef,$krbdefdom) =
@@ -756,79 +766,146 @@ sub print_upload_manager_footer {
my $intform = &Apache::loncommon::authform_internal(%param);
my $locform = &Apache::loncommon::authform_local(%param);
my $date_table = &date_setting_table(undef,undef,$context,undef,
- $formname,$permission);
+ $formname,$permission,$crstype);
+
my $Str = "\n".'';
$Str .= &hidden_input('nfields',$i);
$Str .= &hidden_input('keyfields',$keyfields);
- $Str .= "
".&mt('Login Type')." \n";
+
+ $Str .= '
'.&mt('Options').' '
+ .&Apache::lonhtmlcommon::start_pick_box();
+
+ $Str .= &Apache::lonhtmlcommon::row_title(&mt('Login Type'));
if ($context eq 'domain') {
- $Str .= '
'.&mt('Change authentication for existing users in domain "[_1]" to these settings?',$defdom).' '.&mt('No').' '.&mt('Yes').'
';
+ $Str .= '
'
+ .&mt('Change authentication for existing users in domain "[_1]" to these settings?'
+ ,$defdom)
+ .' '
+ .' '
+ .&mt('No').' '
+ .' '
+ .' '
+ .&mt('Yes').' '
+ .'
';
} else {
- $Str .= "
\n".
- &mt('Note: This will not take effect if the user already exists.').
+ $Str .= '
'."\n".
+ &mt('This will not take effect if the user already exists.').
&Apache::loncommon::help_open_topic('Auth_Options').
"
\n";
}
$Str .= &set_login($defdom,$krbform,$intform,$locform);
+
my ($home_server_pick,$numlib) =
&Apache::loncommon::home_server_form_item($defdom,'lcserver',
'default','hide');
if ($numlib > 1) {
- $Str .= '
'.&mt('LON-CAPA Home Server for New Users')." \n".
- &mt('LON-CAPA domain: [_1] with home server: [_2]',$defdom,
- $home_server_pick).'
';
- } else {
- $Str .= $home_server_pick;
- }
- $Str .= '
'.&mt('Default domain').' '."\n".
- &Apache::loncommon::select_dom_form($defdom,'defaultdomain',undef,1);
- $Str .= '
'.&mt('Starting and Ending Dates').
- " \n";
- $Str .= "
\n".$date_table."
\n";
+ $Str .= &Apache::lonhtmlcommon::row_closure()
+ .&Apache::lonhtmlcommon::row_title(
+ &mt('LON-CAPA Home Server for New Users'))
+ .&mt('LON-CAPA domain: [_1] with home server:','"'.$defdom.'"')
+ .$home_server_pick
+ .&Apache::lonhtmlcommon::row_closure();
+ } else {
+ $Str .= $home_server_pick.
+ &Apache::lonhtmlcommon::row_closure();
+ }
+
+ $Str .= &Apache::lonhtmlcommon::row_title(&mt('Default domain'))
+ .&Apache::loncommon::select_dom_form($defdom,'defaultdomain',undef,1)
+ .&Apache::lonhtmlcommon::row_closure();
+
+ $Str .= &Apache::lonhtmlcommon::row_title(&mt('Starting and Ending Dates'))
+ ."
\n".$date_table."
\n"
+ .&Apache::lonhtmlcommon::row_closure();
+
if ($context eq 'domain') {
- $Str .= '
'.&mt('Settings for assigning roles:').' '."\n".
- &mt('Pick the action to take on roles for these users:').'
'.&mt('No role changes').' '.&mt('Add a domain role').' '.&mt('Add a course role').'';
- }
- if ($context eq 'author') {
- $Str .= '
'.&mt('Default role')." \n".
- &mt('Choose the role to assign to users without a value specified in the uploaded file');
+ $Str .= &Apache::lonhtmlcommon::row_title(
+ &mt('Settings for assigning roles'))
+ .&mt('Pick the action to take on roles for these users:').'
'
+ .'
'
+ .' '
+ .' '.&mt('No role changes').' '
+ .' '
+ .' '
+ .' '.&mt('Add a domain role').' '
+ .' '
+ .' '
+ .' '.&mt('Add a course/community role').' '
+ .'';
+ } elsif ($context eq 'author') {
+ $Str .= &Apache::lonhtmlcommon::row_title(
+ &mt('Default role'))
+ .&mt('Choose the role to assign to users without a value specified in the uploaded file.')
} elsif ($context eq 'course') {
- $Str .= '
'.&mt('Default role and section')." \n".
- &mt('Choose the role and/or section(s) to assign to users without values specified in the uploaded file');
- } else {
- $Str .= '
'.&mt('Default role and/or section(s)')." \n".
- &mt('Role and/or section(s) for users without values specified in the uploaded file.');
+ $Str .= &Apache::lonhtmlcommon::row_title(
+ &mt('Default role and section'))
+ .&mt('Choose the role and/or section(s) to assign to users without values specified in the uploaded file.');
+ } else {
+ $Str .= &Apache::lonhtmlcommon::row_title(
+ &mt('Default role and/or section(s)'))
+ .&mt('Role and/or section(s) for users without values specified in the uploaded file.');
}
- $Str .= '
';
if (($context eq 'domain') || ($context eq 'author')) {
+ $Str .= '
';
my ($options,$cb_script,$coursepick) = &default_role_selector($context,1);
if ($context eq 'domain') {
- $Str .= '
'.&mt('Domain Level').' '.$options.'
'.&mt('Course Level').' '.$cb_script.$coursepick;
+ $Str .= '
'
+ .''.&mt('Domain Level').' '
+ .$options
+ .'
'
+ .''.&mt('Course Level').' '
+ .'
'
+ .$cb_script.$coursepick
+ .&Apache::lonhtmlcommon::row_closure();
} elsif ($context eq 'author') {
- $Str .= $options;
+ $Str .= $options
+ .&Apache::lonhtmlcommon::row_closure(1); # last row in pick_box
}
} else {
my ($cnum,$cdom) = &get_course_identity();
my $rowtitle = &mt('section');
my $secbox = §ion_picker($cdom,$cnum,'Any',$rowtitle,
- $permission,$context,'upload');
- $Str .= $secbox."
".&mt('Full Update')." \n".
- '
'.
- ' '.&mt('Display students with current/future access who are not in the uploaded file.').' '.&mt('Students selected from this list can be dropped.').'
'."\n";
+ $permission,$context,'upload',$crstype);
+ $Str .= $secbox
+ .&Apache::lonhtmlcommon::row_closure();
+ my %lt;
+ if ($crstype eq 'Community') {
+ %lt = &Apache::lonlocal::texthash (
+ disp => 'Display members with current/future access who are not in the uploaded file',
+ stus => 'Members selected from this list can be dropped.'
+ );
+ } else {
+ %lt = &Apache::lonlocal::texthash (
+ disp => 'Display students with current/future access who are not in the uploaded file',
+ stus => 'Students selected from this list can be dropped.'
+ );
+ }
+ $Str .= &Apache::lonhtmlcommon::row_title(&mt('Full Update'))
+ .'
'
+ .' '.$lt{'disp'}
+ .''
+ .$lt{'stus'}
+ .&Apache::lonhtmlcommon::row_closure();
}
if ($context eq 'course' || $context eq 'domain') {
$Str .= &forceid_change($context);
}
+
+ $Str .= &Apache::lonhtmlcommon::end_pick_box();
$Str .= '
';
- $Str .= '');
&print_upload_manager_footer($r,$i,$keyfields,$defdom,$today,$halfyear,
- $context,$permission);
+ $context,$permission,$crstype);
}
sub setup_date_selectors {
@@ -1012,7 +1089,7 @@ sub get_dates_from_form {
}
sub date_setting_table {
- my ($starttime,$endtime,$mode,$bulkaction,$formname,$permission) = @_;
+ my ($starttime,$endtime,$mode,$bulkaction,$formname,$permission,$crstype) = @_;
my $nolink;
if ($bulkaction) {
$nolink = 1;
@@ -1029,9 +1106,13 @@ sub date_setting_table {
($env{'form.action'} eq 'upload')) {
if ($env{'request.course.sec'} eq '') {
$dateDefault = ''.
- ' '.
- &mt('make these dates the default access dates for future student enrollment').
- ' ';
+ ' ';
+ if ($crstype eq 'Community') {
+ $dateDefault .= &mt("make these dates the default access dates for future community enrollment");
+ } else {
+ $dateDefault .= &mt("make these dates the default access dates for future course enrollment");
+ }
+ $dateDefault .= ' ';
}
}
}
@@ -1060,7 +1141,7 @@ sub date_setting_table {
}
sub make_dates_default {
- my ($startdate,$enddate,$context) = @_;
+ my ($startdate,$enddate,$context,$crstype) = @_;
my $result = '';
if ($context eq 'course') {
my ($cnum,$cdom) = &get_course_identity();
@@ -1068,26 +1149,34 @@ sub make_dates_default {
{'default_enrollment_start_date'=>$startdate,
'default_enrollment_end_date' =>$enddate},$cdom,$cnum);
if ($put_result eq 'ok') {
- $result .= &mt('Set default start and end access dates for course.').
- ' '."\n";
+ if ($crstype eq 'Community') {
+ $result .= &mt('Set default start and end access dates for community.');
+ } else {
+ $result .= &mt('Set default start and end access dates for course.');
+ }
+ $result .= ' '."\n";
#
# Refresh the course environment
&Apache::lonnet::coursedescription($env{'request.course.id'},
{'freshen_cache' => 1});
} else {
- $result .= &mt('Unable to set default access dates for course.').":".$put_result.
- ' ';
+ if ($crstype eq 'Community') {
+ $result .= &mt('Unable to set default access dates for community');
+ } else {
+ $result .= &mt('Unable to set default access dates for course');
+ }
+ $result .= ':'.$put_result.' ';
}
}
return $result;
}
sub default_role_selector {
- my ($context,$checkpriv) = @_;
+ my ($context,$checkpriv,$crstype) = @_;
my %customroles;
my ($options,$coursepick,$cb_jscript);
if ($context ne 'author') {
- %customroles = &my_custom_roles();
+ %customroles = &my_custom_roles($crstype);
}
my %lt=&Apache::lonlocal::texthash(
@@ -1099,7 +1188,7 @@ sub default_role_selector {
$options = ''."\n".
' '.&mt('Please select').' '."\n";
if ($context eq 'course') {
- $options .= &default_course_roles($context,$checkpriv,%customroles);
+ $options .= &default_course_roles($context,$checkpriv,$crstype,%customroles);
} elsif ($context eq 'author') {
my @roles = &construction_space_roles($checkpriv);
foreach my $role (@roles) {
@@ -1113,18 +1202,18 @@ sub default_role_selector {
$options .= ' '.$plrole.' ';
}
my $courseform = &Apache::loncommon::selectcourse_link
- ('studentform','dccourse','dcdomain','coursedesc',"$env{'request.role.domain'}",undef,'Course');
+ ('studentform','dccourse','dcdomain','coursedesc',"$env{'request.role.domain'}",undef,'Course/Community');
$cb_jscript =
- &Apache::loncommon::coursebrowser_javascript($env{'request.role.domain'},'currsec','studentform');
+ &Apache::loncommon::coursebrowser_javascript($env{'request.role.domain'},'currsec','studentform','courserole','Course/Community');
$coursepick = &Apache::loncommon::start_data_table().
&Apache::loncommon::start_data_table_header_row().
''.$courseform.' '.$lt{'rol'}.' '.
''.$lt{'grs'}.' '.
&Apache::loncommon::end_data_table_header_row().
&Apache::loncommon::start_data_table_row()."\n".
- ' '."\n".
+ ' '."\n".
''."\n".
- &default_course_roles($context,$checkpriv,%customroles)."\n".
+ &default_course_roles($context,$checkpriv,'Course',%customroles)."\n".
' '.
''.
''.
@@ -1140,6 +1229,7 @@ sub default_role_selector {
$env{'request.role.domain'}.'" />'.
' '.
' '.
+ ' '.
'
'.
&Apache::loncommon::end_data_table_row().
&Apache::loncommon::end_data_table()."\n";
@@ -1149,13 +1239,13 @@ sub default_role_selector {
}
sub default_course_roles {
- my ($context,$checkpriv,%customroles) = @_;
+ my ($context,$checkpriv,$crstype,%customroles) = @_;
my $output;
my $custom = 1;
- my @roles = &course_roles($context,$checkpriv,$custom);
+ my @roles = &course_roles($context,$checkpriv,$custom,lc($crstype));
foreach my $role (@roles) {
if ($role ne 'cr') {
- my $plrole=&Apache::lonnet::plaintext($role);
+ my $plrole=&Apache::lonnet::plaintext($role,$crstype);
$output .= ' '.$plrole.' ';
}
}
@@ -1204,8 +1294,14 @@ sub domain_roles {
}
sub course_roles {
- my ($context,$checkpriv,$custom) = @_;
- my @allroles = &roles_by_context('course',$custom);
+ my ($context,$checkpriv,$custom,$roletype) = @_;
+ my $crstype;
+ if ($roletype eq 'community') {
+ $crstype = 'Community' ;
+ } else {
+ $crstype = 'Course';
+ }
+ my @allroles = &roles_by_context('course',$custom,$crstype);
my @roles;
if ($context eq 'domain') {
@roles = @allroles;
@@ -1216,7 +1312,7 @@ sub course_roles {
if (&Apache::lonnet::allowed('c'.$role,$env{'request.course.id'})) {
push(@roles,$role);
} else {
- if ($role ne 'cc' && $env{'request.course.sec'} ne '') {
+ if ((($role ne 'cc') && ($role ne 'co')) && ($env{'request.course.sec'} ne '')) {
if (&Apache::lonnet::allowed('c'.$role,
$env{'request.course.id'}.'/'.
$env{'request.course.sec'})) {
@@ -1234,19 +1330,19 @@ sub course_roles {
}
sub curr_role_permissions {
- my ($context,$setting,$checkpriv) = @_;
+ my ($context,$setting,$checkpriv,$type) = @_;
my $custom = 1;
my @roles;
if ($context eq 'author') {
@roles = &construction_space_roles($checkpriv);
} elsif ($context eq 'domain') {
if ($setting eq 'course') {
- @roles = &course_roles($context,$checkpriv,$custom);
+ @roles = &course_roles($context,$checkpriv,$custom,$type);
} else {
@roles = &domain_roles($checkpriv);
}
} elsif ($context eq 'course') {
- @roles = &course_roles($context,$checkpriv,$custom);
+ @roles = &course_roles($context,$checkpriv,$custom,$type);
}
return @roles;
}
@@ -1254,10 +1350,14 @@ sub curr_role_permissions {
# ======================================================= Existing Custom Roles
sub my_custom_roles {
+ my ($crstype) = @_;
my %returnhash=();
my %rolehash=&Apache::lonnet::dump('roles');
- foreach my $key (keys %rolehash) {
+ foreach my $key (keys(%rolehash)) {
if ($key=~/^rolesdef\_(\w+)$/) {
+ if ($crstype eq 'Community') {
+ next if ($rolehash{$key} =~ /bre\&S/);
+ }
$returnhash{$1}=$1;
}
}
@@ -1315,9 +1415,9 @@ sub print_userlist {
'html' => 'HTML');
my $output_selector = '';
foreach my $outputformat ('html','csv','excel') {
- my $option = '';
$output_selector .= "\n".$option;
@@ -1332,7 +1432,7 @@ sub print_userlist {
.' '.(' 'x3)."\n");
my $roleselected = '';
if ($env{'form.showrole'} eq 'Any') {
- $roleselected = ' selected="selected" ';
+ $roleselected = ' selected="selected"';
}
my ($cnum,$cdom);
$r->print(&role_filter($context));
@@ -1346,26 +1446,50 @@ sub print_userlist {
'
');
return;
}
- if (!(($context eq 'domain') && ($env{'form.roletype'} eq 'course'))) {
- $r->print(' '.&list_submit_button(&mt('Update Display')).
- "\n\n");
+ if (!(($context eq 'domain') &&
+ (($env{'form.roletype'} eq 'course') || ($env{'form.roletype'} eq 'community')))) {
+ $r->print(
+ "\n\n"
+ .'
'
+ .&list_submit_button(&mt('Update Display'))
+ ."
\n"
+ );
}
my ($indexhash,$keylist) = &make_keylist_array();
- my (%userlist,%userinfo);
- if ($context eq 'domain' && $env{'form.roletype'} eq 'course') {
+ my (%userlist,%userinfo,$clearcoursepick);
+ if (($context eq 'domain') &&
+ ($env{'form.roletype'} eq 'course') ||
+ ($env{'form.roletype'} eq 'community')) {
+ my ($crstype,$numcodes,$title,$warning);
+ if ($env{'form.roletype'} eq 'course') {
+ $crstype = 'Course';
+ $numcodes = $totcodes;
+ $title = &mt('Select Courses');
+ $warning = &mt('Warning: data retrieval for multiple courses can take considerable time, as this operation is not currently optimized.');
+ } elsif ($env{'form.roletype'} eq 'community') {
+ $crstype = 'Community';
+ $numcodes = 0;
+ $title = &mt('Select Communities');
+ $warning = &mt('Warning: data retrieval for multiple communities can take considerable time, as this operation is not currently optimized.');
+ }
my $courseform =
- &Apache::lonhtmlcommon::course_selection($formname,$totcodes,
- $codetitles,$idlist,$idlist_titles);
+ &Apache::lonhtmlcommon::course_selection($formname,$numcodes,
+ $codetitles,$idlist,$idlist_titles,$crstype);
$r->print('
'.&Apache::lonhtmlcommon::start_pick_box()."\n".
&Apache::lonhtmlcommon::start_pick_box()."\n".
- &Apache::lonhtmlcommon::row_title(&mt('Select Course(s)'),
- 'LC_oddrow_value')."\n".
+ &Apache::lonhtmlcommon::row_title($title,'LC_oddrow_value')."\n".
$courseform."\n".
&Apache::lonhtmlcommon::row_closure(1).
&Apache::lonhtmlcommon::end_pick_box().'
'.
- '
'.&list_submit_button(&mt('Update Display')).
- "\n".'
'.&mt('Warning: data retrieval for multiple courses can take considerable time, as this operation is not currently optimized.').' '."\n");
- if ($env{'form.coursepick'}) {
+ '
'.
+ &list_submit_button(&mt('Update Display')).
+ "\n".'
'.$warning.' '."\n");
+ $clearcoursepick = 0;
+ if (($env{'form.origroletype'} ne '') &&
+ ($env{'form.origroletype'} ne $env{'form.roletype'})) {
+ $clearcoursepick = 1;
+ }
+ if (($env{'form.coursepick'}) && (!$clearcoursepick)) {
$r->print('
'.&mt('Searching').' ...
');
}
} else {
@@ -1438,8 +1562,9 @@ sub print_userlist {
}
}
}
- } elsif ($env{'form.roletype'} eq 'course') {
- if ($env{'form.coursepick'}) {
+ } elsif (($env{'form.roletype'} eq 'course') ||
+ ($env{'form.roletype'} eq 'community')) {
+ if (($env{'form.coursepick'}) && (!$clearcoursepick)) {
my %courses = &process_coursepick();
my %allusers;
my $hidepriv = 1;
@@ -1450,7 +1575,8 @@ sub print_userlist {
my (@roles,@sections,%access,%users,%userdata,
%statushash);
if ($env{'form.showrole'} eq 'Any') {
- @roles = &course_roles($context,undef,$custom);
+ @roles = &course_roles($context,undef,$custom,
+ $env{'form.roletype'});
} else {
@roles = ($env{'form.showrole'});
}
@@ -1496,6 +1622,8 @@ sub print_userlist {
$r->print(&mt('There are no authors or co-authors to display.')."\n");
} elsif ($env{'form.roletype'} eq 'course') {
$r->print(&mt('There are no course users to display')."\n");
+ } elsif ($env{'form.roletype'} eq 'community') {
+ $r->print(&mt('There are no community users to display')."\n");
}
} elsif ($context eq 'course') {
$r->print(&mt('There are no course users to display.')."\n");
@@ -1526,7 +1654,7 @@ sub role_filter {
my $output;
my $roleselected = '';
if ($env{'form.showrole'} eq 'Any') {
- $roleselected = ' selected="selected" ';
+ $roleselected = ' selected="selected"';
}
my ($role_select);
if ($context eq 'domain') {
@@ -1538,24 +1666,33 @@ sub role_filter {
$role_select = '
'."\n".
''.
&mt('Any role').' ';
- my @poss_roles = &curr_role_permissions($context);
+ my ($roletype,$crstype);
+ if ($context eq 'course') {
+ $crstype = &Apache::loncommon::course_type();
+ if ($crstype eq 'Community') {
+ $roletype = 'community';
+ } else {
+ $roletype = 'course';
+ }
+ }
+ my @poss_roles = &curr_role_permissions($context,'','',$roletype);
foreach my $role (@poss_roles) {
$roleselected = '';
if ($role eq $env{'form.showrole'}) {
- $roleselected = ' selected="selected" ';
+ $roleselected = ' selected="selected"';
}
my $plrole;
if ($role eq 'cr') {
$plrole = &mt('Custom role');
} else {
- $plrole=&Apache::lonnet::plaintext($role);
+ $plrole=&Apache::lonnet::plaintext($role,$crstype);
}
$role_select .= ''.$plrole.' ';
}
$role_select .= ' ';
$output = '
'
.&mt('Role: [_1]',$role_select)
- .' ';
+ .' ';
}
return $output;
}
@@ -1584,7 +1721,7 @@ sub section_group_filter {
$env{'form.'.$name{$item}} = 'all';
}
if ($item eq 'sec') {
- if ($env{'form.showrole'} eq 'cc') {
+ if (($env{'form.showrole'} eq 'cc') || ($env{'form.showrole'} eq 'co')) {
$env{'form.'.$name{$item}} = 'none';
}
my %sections_count = &Apache::loncommon::get_sections($cdom,$cnum);
@@ -1595,11 +1732,11 @@ sub section_group_filter {
}
if (@options > 0) {
my $currsel;
- $markup = '
'."\n";
+ $markup = '
'."\n";
foreach my $option ('all','none',@options) {
$currsel = '';
if ($env{'form.'.$name{$item}} eq $option) {
- $currsel = ' selected="selected" ';
+ $currsel = ' selected="selected"';
}
$markup .= ' ';
if (($option eq 'all') || ($option eq 'none')) {
@@ -1610,7 +1747,9 @@ sub section_group_filter {
$markup .= ' '."\n";
}
$markup .= ' '."\n";
- $output .= (' 'x3).'
'.$title{$item}.': '.$markup.' ';
+ $output .= (' 'x3).'
'
+ .''.$title{$item}.': '.$markup.' '
+ .' ';
}
}
return $output;
@@ -1663,7 +1802,8 @@ sub gather_userinfo {
$indexhash,$uniqid,$userlist);
}
}
- } elsif ($env{'form.roletype'} eq 'course') {
+ } elsif (($env{'form.roletype'} eq 'course') ||
+ ($env{'form.roletype'} eq 'community')) {
($userdata{'username'},$userdata{'domain'},$userdata{'role'}) =
split(/:/,$item);
if (ref($rolehash->{$item}) eq 'HASH') {
@@ -1713,7 +1853,8 @@ sub gather_userinfo {
sub build_user_record {
my ($context,$userdata,$userinfo,$indexhash,$record_key,$userlist) = @_;
next if ($userdata->{'start'} eq '-1' && $userdata->{'end'} eq '-1');
- if (!(($context eq 'domain') && ($env{'form.roletype'} eq 'course'))) {
+ if (!(($context eq 'domain') && (($env{'form.roletype'} eq 'course')
+ && ($env{'form.roletype'} eq 'community')))) {
&process_date_info($userdata);
}
my $username = $userdata->{'username'};
@@ -1828,13 +1969,17 @@ sub process_coursepick {
my $coursefilter = $env{'form.coursepick'};
my $cdom = $env{'request.role.domain'};
my %courses;
+ my $crssrch = 'Course';
+ if ($env{'form.roletype'} eq 'community') {
+ $crssrch = 'Community';
+ }
if ($coursefilter eq 'all') {
%courses = &Apache::lonnet::courseiddump($cdom,'.','.','.','.','.',
- undef,undef,'Course');
+ undef,undef,$crssrch);
} elsif ($coursefilter eq 'category') {
my $instcode = &instcode_from_coursefilter();
%courses = &Apache::lonnet::courseiddump($cdom,'.','.',$instcode,'.','.',
- undef,undef,'Course');
+ undef,undef,$crssrch);
} elsif ($coursefilter eq 'specific') {
if ($env{'form.coursetotal'} > 1) {
my @course_ids = split(/&&/,$env{'form.courselist'});
@@ -1978,9 +2123,10 @@ sub show_users_list {
$sortby = 'username';
}
my $setting = $env{'form.roletype'};
- my ($cid,$cdom,$cnum,$classgroups,$displayphotos,$displayclickers);
+ my ($cid,$cdom,$cnum,$classgroups,$displayphotos,$displayclickers,$crstype);
if ($context eq 'course') {
$cid = $env{'request.course.id'};
+ $crstype = &Apache::loncommon::course_type();
($cnum,$cdom) = &get_course_identity($cid);
($classgroups) = &Apache::loncoursedata::get_group_memberships(
$userlist,$keylist,$cdom,$cnum);
@@ -1998,6 +2144,7 @@ sub show_users_list {
if ($env{'course.'.$cid.'.internal.showphoto'}) {
$r->print('
');
}
@@ -2013,6 +2161,12 @@ function photowindow(photolink) {
END
}
+ } elsif ($context eq 'domain') {
+ if ($setting eq 'community') {
+ $crstype = 'Community';
+ } elsif ($setting eq 'course') {
+ $crstype = 'Course';
+ }
}
if ($mode ne 'autoenroll' && $mode ne 'pickauthor') {
my $check_uncheck_js = &Apache::loncommon::check_uncheck_jscript();
@@ -2021,6 +2175,7 @@ END
$r->print(<
+//
$date_sec_selector
@@ -2091,10 +2258,13 @@ END
'aboutme' => "Display a user's personal information page",
'owin' => "Open in a new window",
'modify' => "Modify a user's information",
+ 'track' => "View a user's recent activity",
'clicker' => "Clicker-ID",
);
if ($context eq 'domain' && $env{'form.roletype'} eq 'course') {
$lt{'extent'} = &mt('Course(s): description, section(s), status');
+ } elsif ($context eq 'domain' && $env{'form.roletype'} eq 'community') {
+ $lt{'extent'} = &mt('Communities: description, section(s), status');
} elsif ($context eq 'author') {
$lt{'extent'} = &mt('Author');
}
@@ -2106,18 +2276,21 @@ END
if ($context eq 'course') {
push(@cols,'section');
}
- if (!($context eq 'domain' && $env{'form.roletype'} eq 'course')) {
+ if (!($context eq 'domain' && ($env{'form.roletype'} eq 'course')
+ && ($env{'form.roletype'} eq 'community'))) {
push(@cols,('start','end'));
}
if ($env{'form.showrole'} eq 'Any' || $env{'form.showrole'} eq 'cr') {
push(@cols,'role');
}
if ($context eq 'domain' && ($env{'form.roletype'} eq 'author' ||
- $env{'form.roletype'} eq 'course')) {
+ $env{'form.roletype'} eq 'course' ||
+ $env{'form.roletype'} eq 'community')) {
push (@cols,'extent');
}
if (($statusmode eq 'Any') &&
- (!($context eq 'domain' && $env{'form.roletype'} eq 'course'))) {
+ (!($context eq 'domain' && (($env{'form.roletype'} eq 'course')
+ || ($env{'form.roletype'} eq 'community'))))) {
push(@cols,'status');
}
if ($context eq 'course') {
@@ -2130,19 +2303,23 @@ END
if ($env{'form.showrole'} eq 'cr') {
$rolefilter = &mt('custom');
} elsif ($env{'form.showrole'} ne 'Any') {
- $rolefilter = &Apache::lonnet::plaintext($env{'form.showrole'});
+ $rolefilter = &Apache::lonnet::plaintext($env{'form.showrole'},$crstype);
}
my $results_description;
if ($mode ne 'autoenroll') {
$results_description = &results_header_row($rolefilter,$statusmode,
- $context,$permission,$mode);
+ $context,$permission,$mode,$crstype);
$r->print(''.$results_description.' ');
}
my ($output,$actionselect,%canchange,%canchangesec);
if ($mode eq 'html' || $mode eq 'view' || $mode eq 'autoenroll' || $mode eq 'pickauthor') {
if ($mode ne 'autoenroll' && $mode ne 'pickauthor') {
if ($permission->{'cusr'}) {
- $actionselect = &select_actions($context,$setting,$statusmode,$formname);
+ unless (($context eq 'domain') &&
+ (($setting eq 'course') || ($setting eq 'community'))) {
+ $actionselect =
+ &select_actions($context,$setting,$statusmode,$formname);
+ }
}
$r->print(<
@@ -2153,7 +2330,7 @@ END
END
if ($actionselect) {
$output .= <<"END";
-$lt{'ac'}
+
$lt{'ac'}
$actionselect
@@ -2162,9 +2339,9 @@ END
if ($env{'form.showrole'} eq 'Any') {
my $custom = 1;
if ($context eq 'domain') {
- @allroles = &roles_by_context($setting,$custom);
+ @allroles = &roles_by_context($setting,$custom,$crstype);
} else {
- @allroles = &roles_by_context($context,$custom);
+ @allroles = &roles_by_context($context,$custom,$crstype);
}
} else {
@allroles = ($env{'form.showrole'});
@@ -2198,12 +2375,18 @@ END
}
}
}
- $output .= '';
}
$output .= "\n".''."\n".
&Apache::loncommon::start_data_table().
@@ -2230,11 +2413,7 @@ END
$lt{'type'}
";
} else {
- if ($mode eq 'pickauthor') {
- $output .= "\n".' '."\n";
- } else {
- $output .= "\n".''.&mt('Count').' '."\n";
- }
+ $output .= "\n".' '."\n";
if ($actionselect) {
$output .= ''.&mt('Select').' '."\n";
}
@@ -2289,9 +2468,13 @@ END
time.'_'.rand(1000000000).'.csv';
unless ($CSVfile = Apache::File->new('>/home/httpd'.$CSVfilename)) {
$r->log_error("Couldn't open $CSVfilename for output $!");
- $r->print(&mt('Problems occurred in writing the CSV file. '
- .'This error has been logged. '
- .'Please alert your LON-CAPA administrator.'));
+ $r->print(
+ ''
+ .&mt('Problems occurred in writing the CSV file.')
+ .' '.&mt('This error has been logged.')
+ .' '.&mt('Please alert your LON-CAPA administrator.')
+ .'
'
+ );
$CSVfile = undef;
}
#
@@ -2365,7 +2548,8 @@ END
}
} elsif ($env{'form.roletype'} eq 'author') {
($uname,$udom,$role) = split(/:/,$user,-1);
- } elsif ($env{'form.roletype'} eq 'course') {
+ } elsif (($env{'form.roletype'} eq 'course') ||
+ ($env{'form.roletype'} eq 'community')) {
($uname,$udom,$role) = split(/:/,$user);
}
} else {
@@ -2472,7 +2656,7 @@ END
if ($clickers!~/\w/) { $clickers='-'; }
$in{'clicker'} = $clickers;
my $role = $in{'role'};
- $in{'role'}=&Apache::lonnet::plaintext($sdata->[$index{'role'}]);
+ $in{'role'}=&Apache::lonnet::plaintext($sdata->[$index{'role'}],$crstype);
if (! defined($in{'start'}) || $in{'start'} == 0) {
$in{'start'} = &mt('none');
} else {
@@ -2537,7 +2721,7 @@ END
}
}
$r->print(' ');
+ 'actionlist" value="'.$checkval.'" />');
} else {
$r->print(' ');
}
@@ -2572,7 +2756,7 @@ END
}
if ($env{'course.'.$env{'request.course.id'}.'.internal.showphoto'}) {
if ($displayphotos eq 'on' && $role eq 'st' && $in{'photo'} ne '') {
- $r->print(' ');
+ $r->print(' ');
} else {
$r->print(' ');
}
@@ -2759,7 +2943,7 @@ sub print_username_link {
$output = $in->{'username'};
} else {
$output = '{'username'}','$in->{'domain'}'".')" />'.
+ "'$in->{'username'}','$in->{'domain'}'".')">'.
$in->{'username'}.' ';
}
return $output;
@@ -2770,6 +2954,7 @@ sub role_type_names {
'domain' => 'Domain Roles',
'author' => 'Co-Author Roles',
'course' => 'Course Roles',
+ 'community' => 'Community Roles',
);
return %lt;
}
@@ -2859,8 +3044,8 @@ sub select_actions {
}
}
if ($choices{'sections'}) {
- $output .= ' '."\n".
- ' '."\n";
+ $output .= ' '."\n".
+ ' '."\n";
}
}
return $output;
@@ -2874,9 +3059,9 @@ sub date_section_javascript {
delete => "Check the boxes for any users for whom roles are to be deleted, and click 'Proceed'",
none => "Choose an action to take for selected users",
);
- my $output = '
-
ENDTWO
return $output;
}
sub date_section_selector {
- my ($context,$permission) = @_;
+ my ($context,$permission,$crstype) = @_;
my $callingform = $env{'form.callingform'};
my $formname = 'dateselect';
my $groupslist = &get_groupslist();
my $sec_js = &setsections_javascript($formname,$groupslist);
my $output = <<"END";
ENDJS
my %lt = &Apache::lonlocal::texthash (
@@ -2988,7 +3176,7 @@ ENDJS
fors => 'For student roles changing the section, will result in a section switch as students may only be in one section of a course at a time.',
forn => 'For a role in a course that is not a student role, a user may have roles in more than one section of a course at a time.',
reta => "Retain each user's current section affiliations?",
- dnap => '(Does not apply to student roles).',
+ dnap => '(Does not apply to student roles).',
);
my ($date_items,$headertext);
if ($env{'form.bulkaction'} eq 'chgsec') {
@@ -3002,13 +3190,18 @@ ENDJS
}
$date_items = &date_setting_table($starttime,undef,$context,
$env{'form.bulkaction'},$formname,
- $permission);
+ $permission,$crstype);
}
$output .= ''.$headertext.' '.
''. &Apache::loncommon::end_page());
return;
@@ -4115,6 +4395,10 @@ sub update_user_list {
my ($r,$context,$setting,$choice) = @_;
my $now = time;
my $count=0;
+ my $crstype;
+ if ($context eq 'course') {
+ $crstype = &Apache::loncommon::course_type();
+ }
my @changelist;
if ($choice eq 'drop') {
@changelist = &Apache::loncommon::get_env_multiple('form.droplist');
@@ -4185,7 +4469,7 @@ sub update_user_list {
}
}
}
- my $plrole = &Apache::lonnet::plaintext($role);
+ my $plrole = &Apache::lonnet::plaintext($role,$crstype);
my $start = $env{'form.'.$item.'_start'};
my $end = $env{'form.'.$item.'_end'};
if ($choice eq 'drop') {
@@ -4242,7 +4526,7 @@ sub update_user_list {
}
} elsif ($choice eq 'chgsec') {
my (@newsecs,$revresult,$nochg,@retained);
- if ($role ne 'cc') {
+ if (($role ne 'cc') && ($role ne 'co')) {
@newsecs = split(/,/,$env{'form.newsecs'});
}
# remove existing section if not to be retained.
@@ -4350,7 +4634,7 @@ sub update_user_list {
}
if ($env{'form.makedatesdefault'}) {
if ($choice eq 'chgdates' || $choice eq 'reenable' || $choice eq 'activate') {
- $r->print(&make_dates_default($startdate,$enddate,$context));
+ $r->print(&make_dates_default($startdate,$enddate,$context,$crstype));
}
}
my $linktext = &mt('Display User Lists');
@@ -4437,7 +4721,7 @@ sub course_sections {
my $output = '';
my @sections = (sort {$a <=> $b} keys %{$sections_count});
my $numsec = scalar(@sections);
- my $is_selected = ' selected="selected" ';
+ my $is_selected = ' selected="selected"';
if ($numsec <= 1) {
$output = ''."\n".
' '.&mt('Select').' '."\n";
@@ -4497,7 +4781,7 @@ sub get_groupslist {
}
sub setsections_javascript {
- my ($formname,$groupslist,$mode,$checkauth) = @_;
+ my ($formname,$groupslist,$mode,$checkauth,$crstype) = @_;
my ($checkincluded,$finish,$rolecode,$setsection_js);
if ($mode eq 'upload') {
$checkincluded = 'formname.name == "'.$formname.'"';
@@ -4536,8 +4820,11 @@ sub setsections_javascript {
}
my %alerts = &Apache::lonlocal::texthash(
secd => 'Section designations do not apply to Course Coordinator roles.',
+ sedn => 'Section designations do not apply to Coordinator roles.',
accr => 'A course coordinator role will be added with access to all sections.',
+ acor => 'A coordinator role will be added with access to all sections',
inea => 'In each course, each user may only have one student role at a time.',
+ inec => 'In each community, each user may only have on member role at a time.',
youh => 'You had selected ',
secs => 'sections.',
plmo => 'Please modify your selections so they include no more than one section.',
@@ -4545,11 +4832,13 @@ sub setsections_javascript {
plch => 'Please choose a different section name.',
mnot => 'may not be used as a section name, as it is the name of a course group.',
secn => 'Section names and group names must be distinct. Please choose a different section name.',
+ nonw => 'Section names may only contain letters or numbers.',
);
$setsection_js .= <<"ENDSECCODE";
-function setSections(formname) {
+function setSections(formname,crstype) {
var re1 = /^currsec_/;
+ var re2 =/\\W/;
var groups = new Array($groupslist);
for (var i=0;i 0) {
+ alert("$alerts{'nonw'}\\n$alerts{'plch'}");
+ return;
+ }
+ numsec = numsec + validsecs.length;
}
if ((role == 'st') && (numsec > 1)) {
- alert("$alerts{'inea'} $alerts{'youh'} "+numsec+" $alerts{'secs'}\\n$alerts{'plmo'}")
+ if (crstype == 'Community') {
+ alert("$alerts{'inea'} $alerts{'youh'} "+numsec+" $alerts{'secs'}\\n$alerts{'plmo'}");
+ } else {
+ alert("$alerts{'inco'} $alerts{'youh'} "+numsec+" $alerts{'secs'}\\n$alerts{'plmo'}");
+ }
return;
}
else {
@@ -4636,7 +4945,7 @@ sub can_create_user {
}
if (ref($domconf{'usercreation'}) eq 'HASH') {
if (ref($domconf{'usercreation'}{'cancreate'}) eq 'HASH') {
- if ($context eq 'course' || $context eq 'author') {
+ if ($context eq 'course' || $context eq 'author' || $context eq 'requestcrs') {
my $creation = $domconf{'usercreation'}{'cancreate'}{$context};
if ($creation eq 'none') {
$cancreate = 0;
@@ -4734,27 +5043,36 @@ sub check_usertype {
}
sub roles_by_context {
- my ($context,$custom) = @_;
+ my ($context,$custom,$crstype) = @_;
my @allroles;
if ($context eq 'course') {
- @allroles = ('st','ad','ta','ep','in','cc');
+ @allroles = ('st');
+ if ($env{'request.role'} =~ m{^dc\./}) {
+ push(@allroles,'ad');
+ }
+ push(@allroles,('ta','ep','in'));
+ if ($crstype eq 'Community') {
+ push(@allroles,'co');
+ } else {
+ push(@allroles,'cc');
+ }
if ($custom) {
push(@allroles,'cr');
}
} elsif ($context eq 'author') {
@allroles = ('ca','aa');
} elsif ($context eq 'domain') {
- @allroles = ('li','dg','sc','au','dc');
+ @allroles = ('li','ad','dg','sc','au','dc');
}
return @allroles;
}
sub get_permission {
- my ($context,$roles) = @_;
+ my ($context,$crstype) = @_;
my %permission;
if ($context eq 'course') {
my $custom = 1;
- my @allroles = &roles_by_context($context,$custom);
+ my @allroles = &roles_by_context($context,$custom,$crstype);
foreach my $role (@allroles) {
if (&Apache::lonnet::allowed('c'.$role,$env{'request.course.id'})) {
$permission{'cusr'} = 1;
@@ -4823,9 +5141,9 @@ sub authorpriv {
}
sub roles_on_upload {
- my ($context,$setting,%customroles) = @_;
+ my ($context,$setting,$crstype,%customroles) = @_;
my (@possible_roles,@permitted_roles);
- @possible_roles = &curr_role_permissions($context,$setting,1);
+ @possible_roles = &curr_role_permissions($context,$setting,1,$crstype);
foreach my $role (@possible_roles) {
if ($role eq 'cr') {
push(@permitted_roles,keys(%customroles));
@@ -4861,6 +5179,7 @@ sub dc_setcourse_js {
my ($formname,$mode,$context) = @_;
my ($dc_setcourse_code,$authen_check);
my $cctext = &Apache::lonnet::plaintext('cc');
+ my $cotext = &Apache::lonnet::plaintext('co');
my %alerts = §ioncheck_alerts();
my $role = 'role';
if ($mode eq 'upload') {
@@ -4907,7 +5226,11 @@ function setCourse() {
numsections = numsections + newsecs.length;
}
if ((userrole == 'st') && (numsections > 1)) {
- alert("$alerts{'inea'}. $alerts{'youh'} "+numsections+" $alerts{'sect'}.\\n$alerts{'plsm'}.")
+ if (document.$formname.crstype.value == 'Community') {
+ alert("$alerts{'inco'}. $alerts{'youh'} "+numsections+" $alerts{'sect'}.\\n$alerts{'plsm'}.")
+ } else {
+ alert("$alerts{'inea'}. $alerts{'youh'} "+numsections+" $alerts{'sect'}.\\n$alerts{'plsm'}.")
+ }
return;
}
for (var j=0; j 0)) {
+ alert("$alerts{'secd'} $cotext $alerts{'role'}.\\n$alerts{'accr'}.");
+ section = "";
+ }
SCRIPTTOP
if ($mode ne 'upload') {
$dc_setcourse_code .= (<<"ENDSCRIPT");
var coursename = "_$env{'request.role.domain'}"+"_"+course+"_"+userrole
var numcourse = getIndex(document.$formname.dccourse);
if (numcourse == "-1") {
- alert("$alerts{'thwa'}");
+ if (document.$formname.type == 'Community') {
+ alert("$alerts{'thwc'}");
+ } else {
+ alert("$alerts{'thwa'}");
+ }
return;
}
else {
@@ -5044,19 +5379,22 @@ ENDSCRIPT
sub sectioncheck_alerts {
my %alerts = &Apache::lonlocal::texthash(
- curd => 'You must select a course in the current domain',
+ curd => 'You must select a course or community in the current domain',
inea => 'In each course, each user may only have one student role at a time',
+ inco => 'In each community, each user may only have one member role at a time',
youh => 'You had selected',
sect => 'sections',
plsm => 'Please modify your selections so they include no more than one section',
mayn => 'may not be used as the name for a section, as it is a reserved word',
plsc => 'Please choose a different section name',
mayt => 'may not be used as the name for a section, as it is the name of a course group',
+ mayc => 'may not be used as the name for a section, as it is the name of a community group',
secn => 'Section names and group names must be distinct',
secd => 'Section designations do not apply to ',
role => 'roles',
accr => 'role will be added with access to all sections',
- thwa => 'There was a problem with your course selection'
+ thwa => 'There was a problem with your course selection',
+ thwc => 'There was a problem with your community selection',
);
return %alerts;
}