--- loncom/interface/lonuserutils.pm 2010/01/20 20:38:52 1.97.2.9 +++ loncom/interface/lonuserutils.pm 2009/10/30 03:57:35 1.101 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Utility functions for managing LON-CAPA user accounts # -# $Id: lonuserutils.pm,v 1.97.2.9 2010/01/20 20:38:52 raeburn Exp $ +# $Id: lonuserutils.pm,v 1.101 2009/10/30 03:57:35 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') && ($role ne 'co') && ($sec ne '')) { + if ($role ne 'cc' && $sec ne '') { $scope .='/'.$sec; } } elsif ($context eq 'domain') { @@ -247,10 +247,6 @@ 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'}; @@ -275,7 +271,7 @@ sub domain_roles_select { &mt('Custom role'); } else { $select_menus{$roletype}->{'select2'}->{$role} = - &Apache::lonnet::plaintext($role,$crstype); + &Apache::lonnet::plaintext($role); } } $select_menus{$roletype}->{'select2'}->{'Any'} = &mt('Any'); @@ -295,7 +291,7 @@ sub hidden_input { } sub print_upload_manager_header { - my ($r,$datatoken,$distotal,$krbdefdom,$context,$permission,$crstype)=@_; + my ($r,$datatoken,$distotal,$krbdefdom,$context,$permission)=@_; my $javascript; # if (! exists($env{'form.upfile_associate'})) { @@ -332,7 +328,7 @@ sub print_upload_manager_header { my $javascript_validations = &javascript_validations('upload',$krbdefdom,$password_choice,undef, $env{'request.role.domain'},$context, - $groupslist,$crstype); + $groupslist); my $checked=(($env{'form.noFirstLine'})?' checked="checked"':''); $r->print('

' .&mt('Total number of records found in file: [_1]' @@ -365,7 +361,7 @@ sub print_upload_manager_header { ############################################################### sub javascript_validations { my ($mode,$krbdefdom,$curr_authtype,$curr_authfield,$domain, - $context,$groupslist,$crstype)=@_; + $context,$groupslist)=@_; my %param = ( kerb_def_dom => $krbdefdom, curr_authtype => $curr_authtype, @@ -386,11 +382,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'}."'$crstype'".');'; - + $setsection_call = 'setSections(document.'.$param{'formname'}.');'; $setsections_js = &setsections_javascript($param{'formname'},$groupslist, - $mode,'',$crstype); + $mode); } else { $setsection_call = "'ok'"; } @@ -831,7 +826,7 @@ sub print_upload_manager_footer { .' '.&mt('Add a domain role').'' .'   ' + .' '.&mt('Add a course role').'' .''; } elsif ($context eq 'author') { $Str .= &Apache::lonhtmlcommon::row_title( @@ -900,7 +895,7 @@ sub print_upload_manager_footer { .'


'; if ($context eq 'course') { $Str .= '

' - .&mt('Note: This operation may be time consuming when adding several users.') + .&mt('Note: For large courses, this operation may be time consuming.') .'

'; } $Str .= '

=0) { @@ -1142,7 +1137,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(); @@ -1177,7 +1172,7 @@ sub default_role_selector { my %customroles; my ($options,$coursepick,$cb_jscript); if ($context ne 'author') { - %customroles = &my_custom_roles($crstype); + %customroles = &my_custom_roles(); } my %lt=&Apache::lonlocal::texthash( @@ -1203,16 +1198,16 @@ sub default_role_selector { $options .= ' '; } my $courseform = &Apache::loncommon::selectcourse_link - ('studentform','dccourse','dcdomain','coursedesc',"$env{'request.role.domain'}",undef,'Course/Community'); + ('studentform','dccourse','dcdomain','coursedesc',"$env{'request.role.domain'}",undef,'Course'); $cb_jscript = - &Apache::loncommon::coursebrowser_javascript($env{'request.role.domain'},'currsec','studentform','courserole','Course/Community'); + &Apache::loncommon::coursebrowser_javascript($env{'request.role.domain'},'currsec','studentform'); $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". ''. @@ -1230,7 +1225,6 @@ sub default_role_selector { $env{'request.role.domain'}.'" />'. ''. ''. - ''. ''. &Apache::loncommon::end_data_table_row(). &Apache::loncommon::end_data_table()."\n"; @@ -1296,13 +1290,7 @@ sub domain_roles { sub course_roles { 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 @allroles = &roles_by_context('course',$custom,$roletype); my @roles; if ($context eq 'domain') { @roles = @allroles; @@ -1351,14 +1339,10 @@ 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; } } @@ -1447,46 +1431,26 @@ 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); - 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 (%userlist,%userinfo); + if ($context eq 'domain' && $env{'form.roletype'} eq 'course') { my $courseform = - &Apache::lonhtmlcommon::course_selection($formname,$numcodes, - $codetitles,$idlist,$idlist_titles,$crstype); + &Apache::lonhtmlcommon::course_selection($formname,$totcodes, + $codetitles,$idlist,$idlist_titles); $r->print('

'.&Apache::lonhtmlcommon::start_pick_box()."\n". &Apache::lonhtmlcommon::start_pick_box()."\n". - &Apache::lonhtmlcommon::row_title($title,'LC_oddrow_value')."\n". + &Apache::lonhtmlcommon::row_title(&mt('Select Course(s)'), + 'LC_oddrow_value')."\n". $courseform."\n". &Apache::lonhtmlcommon::row_closure(1). &Apache::lonhtmlcommon::end_pick_box().'

'. - '

'. - &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)) { + '

'.&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'}) { $r->print('
'.&mt('Searching').' ...
 
'); } } else { @@ -1559,8 +1523,9 @@ sub print_userlist { } } } - } elsif ($env{'form.roletype'} eq 'course') { - if (($env{'form.coursepick'}) && (!$clearcoursepick)) { + } elsif (($env{'form.roletype'} eq 'course') || + ($env{'form.roletype'} eq 'community')) { + if ($env{'form.coursepick'}) { my %courses = &process_coursepick(); my %allusers; my $hidepriv = 1; @@ -1717,7 +1682,7 @@ sub section_group_filter { $env{'form.'.$name{$item}} = 'all'; } if ($item eq 'sec') { - if (($env{'form.showrole'} eq 'cc') || ($env{'form.showrole'} eq 'co')) { + if ($env{'form.showrole'} eq 'cc') { $env{'form.'.$name{$item}} = 'none'; } my %sections_count = &Apache::loncommon::get_sections($cdom,$cnum); @@ -1796,8 +1761,7 @@ sub gather_userinfo { $indexhash,$uniqid,$userlist); } } - } elsif (($env{'form.roletype'} eq 'course') || - ($env{'form.roletype'} eq 'community')) { + } elsif ($env{'form.roletype'} eq 'course') { ($userdata{'username'},$userdata{'domain'},$userdata{'role'}) = split(/:/,$item); if (ref($rolehash->{$item}) eq 'HASH') { @@ -1847,8 +1811,7 @@ 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') - && ($env{'form.roletype'} eq 'community')))) { + if (!(($context eq 'domain') && ($env{'form.roletype'} eq 'course'))) { &process_date_info($userdata); } my $username = $userdata->{'username'}; @@ -1963,17 +1926,13 @@ 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,$crssrch); + undef,undef,'Course'); } elsif ($coursefilter eq 'category') { my $instcode = &instcode_from_coursefilter(); %courses = &Apache::lonnet::courseiddump($cdom,'.','.',$instcode,'.','.', - undef,undef,$crssrch); + undef,undef,'Course'); } elsif ($coursefilter eq 'specific') { if ($env{'form.coursetotal'} > 1) { my @course_ids = split(/&&/,$env{'form.courselist'}); @@ -2155,12 +2114,6 @@ 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(); @@ -2257,8 +2210,6 @@ END ); 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'); } @@ -2270,21 +2221,18 @@ END if ($context eq 'course') { push(@cols,'section'); } - if (!($context eq 'domain' && ($env{'form.roletype'} eq 'course') - && ($env{'form.roletype'} eq 'community'))) { + if (!($context eq 'domain' && $env{'form.roletype'} eq 'course')) { 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 'community')) { + $env{'form.roletype'} eq 'course')) { push (@cols,'extent'); } - if (($statusmode eq 'Any') && - (!($context eq 'domain' && (($env{'form.roletype'} eq 'course') - || ($env{'form.roletype'} eq 'community'))))) { + if (($statusmode eq 'Any') && + (!($context eq 'domain' && $env{'form.roletype'} eq 'course'))) { push(@cols,'status'); } if ($context eq 'course') { @@ -2297,24 +2245,19 @@ 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); - + $context,$permission,$mode); $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'}) { - unless (($context eq 'domain') && - (($setting eq 'course') || ($setting eq 'community'))) { - $actionselect = - &select_actions($context,$setting,$statusmode,$formname); - } + $actionselect = &select_actions($context,$setting,$statusmode,$formname); } $r->print(< @@ -2325,7 +2268,7 @@ END END if ($actionselect) { $output .= <<"END"; -
$lt{'ac'} +
$lt{'ac'} $actionselect

 
@@ -2370,7 +2313,7 @@ END } } } - $output .= '
'.$lt{'link'}.''. + $output .= '
'.$lt{'link'}.''. ''; my @linkdests = ('aboutme'); if ($permission->{'cusr'}) { @@ -2381,6 +2324,7 @@ END $env{'request.course.sec'})) { push(@linkdests,'track'); } + $output .= ' "; } else { - $output .= "\n".''."\n"; + if ($mode eq 'pickauthor') { + $output .= "\n".''."\n"; + } else { + $output .= "\n".''."\n"; + } if ($actionselect) { $output .= ''."\n"; } @@ -2538,8 +2486,7 @@ END } } elsif ($env{'form.roletype'} eq 'author') { ($uname,$udom,$role) = split(/:/,$user,-1); - } elsif (($env{'form.roletype'} eq 'course') || - ($env{'form.roletype'} eq 'community')) { + } elsif ($env{'form.roletype'} eq 'course') { ($uname,$udom,$role) = split(/:/,$user); } } else { @@ -2945,7 +2892,6 @@ sub role_type_names { 'author' => 'Co-Author Roles', 'course' => 'Course Roles', 'community' => 'Community Roles', - ); return %lt; } @@ -3107,7 +3053,7 @@ END } else { opener.document.$callingform.retainsec.value = formname.retainsec.value; } - setSections(formname,'$crstype'); + setSections(formname); if (seccheck == 'ok') { opener.document.$callingform.newsecs.value = formname.sections.value; } @@ -3167,7 +3113,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') { @@ -3189,11 +3135,6 @@ ENDJS if ($context eq 'course' && $env{'form.bulkaction'} eq 'chgsec') { my ($cnum,$cdom) = &get_course_identity(); my $crstype = &Apache::loncommon::course_type(); - if ($crstype eq 'Community') { - $lt{'fors'} = &mt('For member roles changing the section, will result in a section switch as members may only be in one section of a community at a time.'); - $lt{'forn'} = &mt('For a role in a community that is not a member role, a user may have roles in more than one section of a community at a time.'); - $lt{'dnap'} = &mt('(Does not apply to member roles).'); - } my $info; if ($env{'form.showrole'} eq 'st') { $output .= '

'.$lt{'fors'}.'

'; @@ -3259,50 +3200,26 @@ sub section_picker { } sub results_header_row { - my ($rolefilter,$statusmode,$context,$permission,$mode,$crstype) = @_; + my ($rolefilter,$statusmode,$context,$permission,$mode) = @_; my ($description,$showfilter); if ($rolefilter ne 'Any') { $showfilter = $rolefilter; } if ($context eq 'course') { if ($mode eq 'csv' || $mode eq 'excel') { - if ($crstype eq 'Community') { - $description = &mt('Community - [_1]:',$env{'course.'.$env{'request.course.id'}.'.description'}).' '; - } else { - $description = &mt('Course - [_1]:',$env{'course.'.$env{'request.course.id'}.'.description'}).' '; - } + $description = &mt('Course - [_1]:',$env{'course.'.$env{'request.course.id'}.'.description'}).' '; } if ($statusmode eq 'Expired') { - if ($crstype eq 'Community') { - $description .= &mt('Users in community with expired [_1] roles',$showfilter); - } else { - $description .= &mt('Users in course with expired [_1] roles',$showfilter); - } + $description .= &mt('Users in course with expired [_1] roles',$showfilter); } elsif ($statusmode eq 'Future') { - if ($crstype eq 'Community') { - $description .= &mt('Users in community with future [_1] roles',$showfilter); - } else { - $description .= &mt('Users in course with future [_1] roles',$showfilter); - } + $description .= &mt('Users in course with future [_1] roles',$showfilter); } elsif ($statusmode eq 'Active') { - if ($crstype eq 'Community') { - $description .= &mt('Users in community with active [_1] roles',$showfilter); - } else { - $description .= &mt('Users in course with active [_1] roles',$showfilter); - } + $description .= &mt('Users in course with active [_1] roles',$showfilter); } else { if ($rolefilter eq 'Any') { - if ($crstype eq 'Community') { - $description .= &mt('All users in community'); - } else { - $description .= &mt('All users in course'); - } + $description .= &mt('All users in course'); } else { - if ($crstype eq 'Community') { - $description .= &mt('All users in community with [_1] roles',$rolefilter); - } else { - $description .= &mt('All users in course with [_1] roles',$rolefilter); - } + $description .= &mt('All users in course with [_1] roles',$rolefilter); } } my $constraint; @@ -3310,7 +3227,7 @@ sub results_header_row { if ($viewablesec ne '') { if ($env{'form.showrole'} eq 'st') { $constraint = &mt('only users in section "[_1]"',$viewablesec); - } elsif (($env{'form.showrole'} ne 'cc') && ($env{'form.showrole'} ne 'co')) { + } elsif ($env{'form.showrole'} ne 'cc') { $constraint = &mt('only users affiliated with no section or section "[_1]"',$viewablesec); } if (($env{'form.grpfilter'} ne 'all') && ($env{'form.grpfilter'} ne '')) { @@ -3398,29 +3315,19 @@ sub results_header_row { $description .= &mt('All co-authors in domain with [_1] roles',$rolefilter); } } - } elsif (($env{'form.roletype'} eq 'course') || - ($env{'form.roletype'} eq 'community')) { - + } elsif ($env{'form.roletype'} eq 'course') { my $coursefilter = $env{'form.coursepick'}; - if ($env{'form.roletype'} eq 'course') { - if ($coursefilter eq 'category') { - my $instcode = &instcode_from_coursefilter(); - if ($instcode eq '.') { - $description .= &mt('All courses in domain').' - '; - } else { - $description .= &mt('Courses in domain with institutional code: [_1]',$instcode).' - '; - } - } elsif ($coursefilter eq 'selected') { - $description .= &mt('Selected courses in domain').' - '; - } elsif ($coursefilter eq 'all') { + if ($coursefilter eq 'category') { + my $instcode = &instcode_from_coursefilter(); + if ($instcode eq '.') { $description .= &mt('All courses in domain').' - '; + } else { + $description .= &mt('Courses in domain with institutional code: [_1]',$instcode).' - '; } - } elsif ($env{'form.roletype'} eq 'community') { - if ($coursefilter eq 'selected') { - $description .= &mt('Selected communities in domain').' - '; - } elsif ($coursefilter eq 'all') { - $description .= &mt('All communities in domain').' - '; - } + } elsif ($coursefilter eq 'selected') { + $description .= &mt('Selected courses in domain').' - '; + } elsif ($coursefilter eq 'all') { + $description .= &mt('All courses in domain').' - '; } if ($statusmode eq 'Expired') { $description .= &mt('users with expired [_1] roles',$showfilter); @@ -3653,19 +3560,22 @@ sub print_first_users_upload_form { $str .= ''; $str .= ''; - $str .= '

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

'."\n"; # Excel and CSV Help - $str .= '
' + $str .= '

' .&Apache::loncommon::help_open_topic("Course_Create_Class_List", &mt("How do I create a users list from a spreadsheet")) - .'

'."\n" + ."
\n" .&Apache::loncommon::help_open_topic("Course_Convert_To_CSV", &mt("How do I create a CSV file from a spreadsheet")) - .'

'."\n"; + ."

\n"; + $str .= &Apache::lonhtmlcommon::start_pick_box() .&Apache::lonhtmlcommon::row_title(&mt('File')) + .'

'."\n" + .&mt('Please upload an UTF8 encoded file to ensure a correct character encoding in your classlist.')."\n" + .'

'."\n" .&Apache::loncommon::upfile_select_html() .&Apache::lonhtmlcommon::row_closure() .&Apache::lonhtmlcommon::row_title( @@ -3743,7 +3653,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'}; @@ -3802,7 +3712,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') { @@ -3821,7 +3731,7 @@ sub upfile_drop_add { } my (%userlist,%modifiable_fields,@poss_roles); my $secidx = &Apache::loncoursedata::CL_SECTION(); - my @courseroles = &roles_by_context('course',1,$crstype); + my @courseroles = &roles_by_context('course',1,'',$crstype); if (!&Apache::lonnet::allowed('mau',$domain)) { if ($context eq 'course' || $context eq 'author') { @poss_roles = &curr_role_permissions($context,'','',$crstype); @@ -3910,7 +3820,7 @@ sub upfile_drop_add { } } my (%curr_rules,%got_rules,%alerts); - my %customroles = &my_custom_roles($crstype); + my %customroles = &my_custom_roles(); my @permitted_roles = &roles_on_upload($context,$setting,$crstype,%customroles); # Get new users list @@ -4154,7 +4064,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') { if (@secs > 1) { $multiple = 1; foreach my $sec (@secs) { @@ -4515,7 +4425,7 @@ sub update_user_list { } } elsif ($choice eq 'chgsec') { my (@newsecs,$revresult,$nochg,@retained); - if (($role ne 'cc') && ($role ne 'co')) { + if ($role ne 'cc') { @newsecs = split(/,/,$env{'form.newsecs'}); } # remove existing section if not to be retained. @@ -4770,7 +4680,7 @@ sub get_groupslist { } sub setsections_javascript { - my ($formname,$groupslist,$mode,$checkauth,$crstype) = @_; + my ($formname,$groupslist,$mode,$checkauth) = @_; my ($checkincluded,$finish,$rolecode,$setsection_js); if ($mode eq 'upload') { $checkincluded = 'formname.name == "'.$formname.'"'; @@ -4809,11 +4719,8 @@ 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 one member role at a time.', youh => 'You had selected ', secs => 'sections.', plmo => 'Please modify your selections so they include no more than one section.', @@ -4824,7 +4731,7 @@ sub setsections_javascript { ); $setsection_js .= <<"ENDSECCODE"; -function setSections(formname,crstype) { +function setSections(formname) { var re1 = /^currsec_/; var groups = new Array($groupslist); for (var i=0;i 1)) { - 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'}"); - } + alert("$alerts{'inea'} $alerts{'youh'} "+numsec+" $alerts{'secs'}\\n$alerts{'plmo'}") return; } else { @@ -5153,7 +5053,6 @@ 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') { @@ -5200,11 +5099,7 @@ function setCourse() { numsections = numsections + newsecs.length; } if ((userrole == 'st') && (numsections > 1)) { - 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'}.") - } + 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") { - if (document.$formname.type == 'Community') { - alert("$alerts{'thwc'}"); - } else { - alert("$alerts{'thwa'}"); - } + alert("$alerts{'thwa'}"); return; } else { @@ -5353,22 +5236,19 @@ ENDSCRIPT sub sectioncheck_alerts { my %alerts = &Apache::lonlocal::texthash( - curd => 'You must select a course or community in the current domain', + curd => 'You must select a course 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', - thwc => 'There was a problem with your community selection', + thwa => 'There was a problem with your course selection' ); return %alerts; }
'; my $usernamelink = $env{'form.usernamelink'}; if ($usernamelink eq '') { @@ -2407,7 +2351,11 @@ END $lt{'type'}  '.&mt('Count').''.&mt('Select').'