--- loncom/interface/lonuserutils.pm 2010/01/20 17:41:25 1.97.2.4 +++ loncom/interface/lonuserutils.pm 2009/10/31 14:27:48 1.102 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Utility functions for managing LON-CAPA user accounts # -# $Id: lonuserutils.pm,v 1.97.2.4 2010/01/20 17:41:25 raeburn Exp $ +# $Id: lonuserutils.pm,v 1.102 2009/10/31 14:27:48 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -236,7 +236,6 @@ sub domain_roles_select { # # Role types my @roletypes = ('domain','author','course','community'); - my %lt = &role_type_names(); # # build up the menu information to be passed to @@ -248,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'}; @@ -272,7 +275,7 @@ 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'); @@ -1138,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(); @@ -1291,7 +1294,13 @@ sub domain_roles { sub course_roles { my ($context,$checkpriv,$custom,$roletype) = @_; - my @allroles = &roles_by_context('course',$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; @@ -1432,15 +1441,14 @@ sub print_userlist { ''); return; } - if (!(($context eq 'domain') && - (($env{'form.roletype'} eq 'course') || ($env{'form.roletype'} eq 'community')))) { + if (!(($context eq 'domain') && ($env{'form.roletype'} eq 'course'))) { $r->print(' '.&list_submit_button(&mt('Update Display')). "\n
\n"); } my ($indexhash,$keylist) = &make_keylist_array(); - my (%userlist,%userinfo,$clearcoursepick); + my (%userlist,%userinfo); 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') { @@ -1463,15 +1471,9 @@ sub print_userlist { $courseform."\n". &Apache::lonhtmlcommon::row_closure(1). &Apache::lonhtmlcommon::end_pick_box().''. - ''. - &list_submit_button(&mt('Update Display')). + '
'.&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)) { + if ($env{'form.coursepick'}) { $r->print('