--- loncom/interface/lonuserutils.pm 2007/12/22 00:47:25 1.23 +++ loncom/interface/lonuserutils.pm 2007/12/22 04:23:05 1.25 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Utility functions for managing LON-CAPA user accounts # -# $Id: lonuserutils.pm,v 1.23 2007/12/22 00:47:25 raeburn Exp $ +# $Id: lonuserutils.pm,v 1.25 2007/12/22 04:23:05 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -738,13 +738,13 @@ sub print_upload_manager_footer { } if ($context eq 'author') { $Str .= '

'.&mt('Default role')."

\n". - &mt('Choose the role to assign to users without one specified in the uploaded file'); + &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 to assign to users without one specified in the uploaded file'); + &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')."
\n". - &mt('Role and/or section for users without one in the uploaded file.'); + $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 .= '
'; if (($context eq 'domain') || ($context eq 'author')) { @@ -786,13 +786,14 @@ sub forceid_change { "

\n".'
'."\n". - &mt('(only do if you know what you are doing.)')."

\n"; + &mt('(only do if you know what you are doing.)')."\n"; if ($context eq 'domain') { - $output .= '

'."\n"; + ''."\n"; } + $output .= '

'; return $output; } @@ -962,7 +963,7 @@ sub date_setting_table { ($env{'form.action'} eq 'upload')) { if ($env{'request.course.sec'} eq '') { $dateDefault = ''. - ''; } @@ -1001,14 +1002,14 @@ 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 dates for course'). + $result .= &mt('Set default start and end access dates for course.'). '
'."\n"; # # Refresh the course environment &Apache::lonnet::coursedescription($env{'request.course.id'}, {'freshen_cache' => 1}); } else { - $result .= &mt('Unable to set default dates for course').":".$put_result. + $result .= &mt('Unable to set default access dates for course.').":".$put_result. '
'; } } @@ -1289,7 +1290,8 @@ sub print_userlist { $r->print(''); } if (!(($context eq 'domain') && ($env{'form.roletype'} eq 'course'))) { - $r->print(&list_submit_button(&mt('Update Display'))."\n

\n"); + $r->print(' '.&list_submit_button(&mt('Update Display')). + "\n

\n"); } my ($indexhash,$keylist) = &make_keylist_array(); my (%userlist,%userinfo); @@ -1479,7 +1481,8 @@ sub gather_userinfo { ($userdata{'username'},$userdata{'domain'},$userdata{'role'}) = split(/:/,$item); ($userdata{'start'},$userdata{'end'})=split(/:/,$rolehash->{$item}); - &build_user_record(\%userdata,$userinfo,$indexhash,$item,$userlist); + &build_user_record($context,\%userdata,$userinfo,$indexhash, + $item,$userlist); } elsif ($context eq 'course') { my $viewablesec = &viewable_section($permission); ($userdata{'username'},$userdata{'domain'},$userdata{'role'}, @@ -1488,13 +1491,15 @@ sub gather_userinfo { if (($viewablesec ne '') && ($userdata{'section'} ne '')) { next if ($viewablesec ne $userdata{'section'}); } - &build_user_record(\%userdata,$userinfo,$indexhash,$item,$userlist); + &build_user_record($context,\%userdata,$userinfo,$indexhash, + $item,$userlist); } elsif ($context eq 'domain') { if ($env{'form.roletype'} eq 'domain') { ($userdata{'role'},$userdata{'username'},$userdata{'domain'}) = split(/:/,$item); ($userdata{'end'},$userdata{'start'})=split(/:/,$rolehash->{$item}); - &build_user_record(\%userdata,$userinfo,$indexhash,$item,$userlist); + &build_user_record($context,\%userdata,$userinfo,$indexhash, + $item,$userlist); } elsif ($env{'form.roletype'} eq 'author') { if (ref($rolehash->{$item}) eq 'HASH') { $userdata{'extent'} = $item; @@ -1503,7 +1508,8 @@ sub gather_userinfo { ($userdata{'start'},$userdata{'end'}) = split(/:/,$rolehash->{$item}{$key}); my $uniqid = $key.':'.$item; - &build_user_record(\%userdata,$userinfo,$indexhash,$uniqid,$userlist); + &build_user_record($context,\%userdata,$userinfo, + $indexhash,$uniqid,$userlist); } } } elsif ($env{'form.roletype'} eq 'course') { @@ -1521,9 +1527,9 @@ sub gather_userinfo { # FIXME: actions on courses disabled for now # if ($permission->{'cusr'}) { # if ($numcids > 1) { -# $spanstart .= ''; +# $spanstart .= ' '; # } else { -# $spanstart .= ''; +# $spanstart .= ' '; # } # } $spanend = '
'; @@ -1533,13 +1539,20 @@ sub gather_userinfo { $rolehash->{$item}{$cid}{'desc'}.$space; if (ref($rolehash->{$item}{$cid}{'secs'}) eq 'HASH') { foreach my $sec (sort(keys(%{$rolehash->{$item}{$cid}{'secs'}}))) { - $userdata{'extent'} .= $sec.$space.$rolehash->{$item}{$cid}{'secs'}{$sec}.$spanend; + if (($env{'form.Status'} eq 'Any') || + ($env{'form.Status'} eq $rolehash->{$item}{$cid}{'secs'}{$sec})) { + $userdata{'extent'} .= $sec.$space.$rolehash->{$item}{$cid}{'secs'}{$sec}.$spanend; + $userdata{'status'} = $rolehash->{$item}{$cid}{'secs'}{$sec}; + } } } } } } - &build_user_record(\%userdata,$userinfo,$indexhash,$item,$userlist); + if ($userdata{'status'} ne '') { + &build_user_record($context,\%userdata,$userinfo, + $indexhash,$item,$userlist); + } } } } @@ -1547,14 +1560,15 @@ sub gather_userinfo { } sub build_user_record { - my ($userdata,$userinfo,$indexhash,$record_key,$userlist) = @_; + my ($context,$userdata,$userinfo,$indexhash,$record_key,$userlist) = @_; next if ($userdata->{'start'} eq '-1' && $userdata->{'end'} eq '-1'); - &process_date_info($userdata); + if (!(($context eq 'domain') && ($env{'form.roletype'} eq 'course'))) { + &process_date_info($userdata); + } my $username = $userdata->{'username'}; my $domain = $userdata->{'domain'}; if (ref($userinfo->{$username.':'.$domain}) eq 'HASH') { - $userdata->{'fullname'} = - $userinfo->{$username.':'.$domain}{'fullname'}; + $userdata->{'fullname'} = $userinfo->{$username.':'.$domain}{'fullname'}; $userdata->{'id'} = $userinfo->{$username.':'.$domain}{'id'}; } else { &aggregate_user_info($domain,$username,$userinfo); @@ -1844,8 +1858,8 @@ END if ($mode ne 'autoenroll') { my $check_uncheck_js = &Apache::loncommon::check_uncheck_jscript(); my $alert = &mt("You must select at least one user by checking a user's 'Select' checkbox"); - my $singconfirm = &mt(' for a single user'); - my $multconfirm = &mt(' for multiple users'); + my $singconfirm = &mt(' for a single user?'); + my $multconfirm = &mt(' for multiple users?'); my $date_sec_selector = &date_section_javascript($context,$setting,$statusmode); $r->print(<print(''.$results_description.'
'); } my ($output,$actionselect); @@ -2633,13 +2647,15 @@ sub section_picker { } sub results_header_row { - my ($rolefilter,$statusmode,$context,$permission) = @_; + my ($rolefilter,$statusmode,$context,$permission,$mode) = @_; my ($description,$showfilter); if ($rolefilter ne 'Any') { $showfilter = $rolefilter; } if ($context eq 'course') { - $description = &mt('Course - ').$env{'course.'.$env{'request.course.id'}.'.description'}.': '; + if ($mode eq 'csv' || $mode eq 'excel') { + $description = &mt('Course - ').$env{'course.'.$env{'request.course.id'}.'.description'}.': '; + } if ($statusmode eq 'Expired') { $description .= &mt('Users in course with expired [_1] roles',$showfilter); } elsif ($statusmode eq 'Future') {