--- loncom/interface/lonuserutils.pm 2010/01/20 21:37:37 1.97.2.12 +++ loncom/interface/lonuserutils.pm 2010/01/05 22:08:48 1.109.2.2 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Utility functions for managing LON-CAPA user accounts # -# $Id: lonuserutils.pm,v 1.97.2.12 2010/01/20 21:37:37 raeburn Exp $ +# $Id: lonuserutils.pm,v 1.109.2.2 2010/01/05 22:08:48 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1141,7 +1141,7 @@ sub date_setting_table { } sub make_dates_default { - my ($startdate,$enddate,$context,$crstype = @_; + my ($startdate,$enddate,$context,$crstype) = @_; my $result = ''; if ($context eq 'course') { my ($cnum,$cdom) = &get_course_identity(); @@ -1185,8 +1185,10 @@ sub default_role_selector { 'exs' => "Existing sections", 'new' => "New section", ); - $options = ''."\n"; + unless (($context eq 'course') && (&Apache::loncommon::needs_gci_custom())) { + $options .= ' '."\n"; + } if ($context eq 'course') { $options .= &default_course_roles($context,$checkpriv,$crstype,%customroles); } elsif ($context eq 'author') { @@ -1447,18 +1449,14 @@ sub print_userlist { return; } 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" - ); + (($env{'form.roletype'} eq 'course') || ($env{'form.roletype'} eq 'community')))) { + $r->print(' '.&list_submit_button(&mt('Update Display')). + "\n

\n"); } my ($indexhash,$keylist) = &make_keylist_array(); my (%userlist,%userinfo,$clearcoursepick); if (($context eq 'domain') && - ($env{'form.roletype'} eq 'course') || + ($env{'form.roletype'} eq 'course') || ($env{'form.roletype'} eq 'community')) { my ($crstype,$numcodes,$title,$warning); if ($env{'form.roletype'} eq 'course') { @@ -1562,7 +1560,8 @@ sub print_userlist { } } } - } elsif ($env{'form.roletype'} eq 'course') { + } elsif (($env{'form.roletype'} eq 'course') || + ($env{'form.roletype'} eq 'community')) { if (($env{'form.coursepick'}) && (!$clearcoursepick)) { my %courses = &process_coursepick(); my %allusers; @@ -1746,9 +1745,7 @@ sub section_group_filter { $markup .= ''."\n"; } $markup .= ''."\n"; - $output .= (' 'x3).'' - .'' - .' '; + $output .= (' 'x3).''; } } return $output; @@ -2276,7 +2273,7 @@ END push(@cols,'section'); } if (!($context eq 'domain' && ($env{'form.roletype'} eq 'course') - && ($env{'form.roletype'} eq 'community'))) { + && ($env{'form.roletype'} eq 'community'))) { push(@cols,('start','end')); } if ($env{'form.showrole'} eq 'Any' || $env{'form.showrole'} eq 'cr') { @@ -2287,7 +2284,7 @@ END $env{'form.roletype'} eq 'community')) { push (@cols,'extent'); } - if (($statusmode eq 'Any') && + if (($statusmode eq 'Any') && (!($context eq 'domain' && (($env{'form.roletype'} eq 'course') || ($env{'form.roletype'} eq 'community'))))) { push(@cols,'status'); @@ -2302,13 +2299,12 @@ 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,$crstype); - $r->print(''.$results_description.'

'); } my ($output,$actionselect,%canchange,%canchangesec); @@ -2330,7 +2326,7 @@ END END if ($actionselect) { $output .= <<"END"; -
$lt{'ac'} +
$lt{'ac'} $actionselect

 
@@ -2375,7 +2371,7 @@ END } } } - $output .= '
'.$lt{'link'}.''. + $output .= '
'.$lt{'link'}.''. ''; my @linkdests = ('aboutme'); if ($permission->{'cusr'}) { @@ -2386,6 +2382,7 @@ END $env{'request.course.sec'})) { push(@linkdests,'track'); } + $output .= '
'; my $usernamelink = $env{'form.usernamelink'}; if ($usernamelink eq '') { @@ -2655,7 +2652,7 @@ END if ($clickers!~/\w/) { $clickers='-'; } $in{'clicker'} = $clickers; my $role = $in{'role'}; - $in{'role'}=&Apache::lonnet::plaintext($sdata->[$index{'role'}],$crstype); + $in{'role'}=&Apache::lonnet::plaintext($sdata->[$index{'role'}],$crstype); if (! defined($in{'start'}) || $in{'start'} == 0) { $in{'start'} = &mt('none'); } else { @@ -2954,7 +2951,6 @@ sub role_type_names { 'author' => 'Co-Author Roles', 'course' => 'Course Roles', 'community' => 'Community Roles', - ); return %lt; } @@ -3409,7 +3405,6 @@ sub results_header_row { } } elsif (($env{'form.roletype'} eq 'course') || ($env{'form.roletype'} eq 'community')) { - my $coursefilter = $env{'form.coursepick'}; if ($env{'form.roletype'} eq 'course') { if ($coursefilter eq 'category') { @@ -3662,8 +3657,7 @@ sub print_first_users_upload_form { $str .= ''; $str .= ''; - - $str .= '

'.&mt('Upload a file containing information about users').'

'."\n"; + $str .= '

'.&mt('Upload a file containing information about users').'

'."\n"; # Excel and CSV Help $str .= '
' @@ -3750,7 +3744,7 @@ sub upfile_drop_add { } my ($startdate,$enddate) = &get_dates_from_form(); if ($env{'form.makedatesdefault'}) { - $r->print(&make_dates_default($startdate,$enddate,$context,$crstype); + $r->print(&make_dates_default($startdate,$enddate,$context,$crstype)); } # Determine domain and desired host (home server) my $defdom=$env{'request.role.domain'}; @@ -3809,7 +3803,7 @@ sub upfile_drop_add { } elsif ($setting eq 'course') { $defaultrole = $env{'form.courserole'}; $defaultsec = $env{'form.sections'}; - } + } } elsif ($context eq 'author') { $defaultrole = $env{'form.defaultrole'}; } elsif ($context eq 'course') { @@ -4161,7 +4155,7 @@ sub upfile_drop_add { $role = 'cr_'.$env{'user.domain'}.'_'. $env{'user.name'}.'_'.$role; } - if (($role ne 'cc') && ($role ne 'co')) { + if (($role ne 'cc') && ($role ne 'co')) { if (@secs > 1) { $multiple = 1; foreach my $sec (@secs) { @@ -4820,7 +4814,7 @@ sub setsections_javascript { 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 one member 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.', @@ -5031,14 +5025,22 @@ sub roles_by_context { if ($env{'request.role'} =~ m{^dc\./}) { push(@allroles,'ad'); } - push(@allroles,('ta','ep','in')); - if ($crstype eq 'Community') { - push(@allroles,'co'); + if (&Apache::loncommon::needs_gci_custom()) { + if ($crstype eq 'Community') { + push(@allroles,'co'); + } else { + push(@allroles,'cc'); + } } else { - push(@allroles,'cc'); - } - if ($custom) { - push(@allroles,'cr'); + 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'); @@ -5362,7 +5364,7 @@ sub sectioncheck_alerts { my %alerts = &Apache::lonlocal::texthash( 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', + 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',