--- loncom/interface/loncreateuser.pm 2006/05/08 21:40:20 1.113 +++ loncom/interface/loncreateuser.pm 2006/05/09 15:09:27 1.115 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.113 2006/05/08 21:40:20 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.115 2006/05/09 15:09:27 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -302,17 +302,14 @@ sub print_user_modification_page { my $dc_setcourse_code = ''; my $nondc_setsection_code = ''; my %loaditem; - my (%curr_groups,$groupslist,$numgroups); - if (exists($env{'request.course.id'})) { - my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; - my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; - $numgroups = &Apache::loncommon::coursegroups(\%curr_groups,$cdom, - $cnum); - } - if ($numgroups > 0) { + + my $groupslist; + my %curr_groups = &Apache::loncommon::coursegroups(); + if (%curr_groups) { $groupslist = join('","',sort(keys(%curr_groups))); $groupslist = '"'.$groupslist.'"'; } + if ($env{'request.role'} =~ m-^dc\./(\w+)/$-) { my $dcdom = $1; $loaditem{'onload'} = "document.cu.coursedesc.value=''"; @@ -977,7 +974,6 @@ ENDDROW # # Course level # - my $num_sections; if ($env{'request.role'} =~ m-^dc\./(\w+)/$-) { $r->print(&course_level_dc($1)); @@ -1209,7 +1205,6 @@ END } } ## - my %curr_groups; my $now=time; $r->print('

'.&mt('Modifying Roles').'

'); foreach (keys (%env)) { @@ -1310,8 +1305,8 @@ END if ($num_sections == 0) { $r->print(&commit_customrole($udom,$uname,$url,$three,$four,$five,$start,$end)); } else { - my $numgrp=&Apache::loncommon::coursegroups(\%curr_groups, - $one,$two); + my %curr_groups = + &Apache::loncommon::coursegroups($one,$two); foreach my $sec (sort {$a cmp $b} keys %sections) { if (($sec eq 'none') || ($sec eq 'all') || exists($curr_groups{$sec})) { @@ -1340,8 +1335,8 @@ END if ($num_sections == 0) { $r->print(&commit_standardrole($udom,$uname,$url,$three,$start,$end,$one,$two,'')); } else { - my $numgrp=&Apache::loncommon::coursegroups(\%curr_groups, - $one,$two); + my %curr_groups = + &Apache::loncommon::coursegroups($one,$two); my $emptysec = 0; foreach my $sec (sort {$a cmp $b} keys %sections) { $sec =~ s/\W//g; @@ -1765,11 +1760,11 @@ sub course_level_table { $bgcol=~s/[^7-9a-e]//g; $bgcol=substr($bgcol.$bgcol.$bgcol.'ffffff',2,6); my ($domain,$cnum)=split(/\//,$thiscourse); - my %sections_count = (); - my $num_sections = 0; + my %sections_count; if (defined($env{'request.course.id'})) { if ($env{'request.course.id'} eq $domain.'_'.$cnum) { - $num_sections = &Apache::loncommon::get_sections($domain,$cnum,\%sections_count); + %sections_count = + &Apache::loncommon::get_sections($domain,$cnum); } } foreach ('st','ta','ep','ad','in','cc') { @@ -1782,8 +1777,8 @@ sub course_level_table { $area
Domain: $domain ENDEXTENT if ($_ ne 'cc') { - if ($num_sections > 0) { - my $currsec = &course_sections($num_sections,\%sections_count,$protectedcourse.'_'.$_); + if (%sections_count) { + my $currsec = &course_sections(\%sections_count,$protectedcourse.'_'.$_); $table .= ''. ' END - if ($num_sections > 0) { - my $currsec = &course_sections($num_sections,\%sections_count,$customrole); + if (%sections_count) { + my $currsec = &course_sections(\%sections_count,$customrole); $table.= '
'.$lt{'exs'}.'
'. @@ -1823,8 +1818,8 @@ ENDTIMEENTRY
$plrole $area'. '
'.$lt{'exs'}.'
'. @@ -1863,10 +1858,10 @@ ENDTABLE } sub course_sections { - my ($num_sections,$sections_count,$role) = @_; + my ($sections_count,$role) = @_; my $output = ''; my @sections = (sort {$a <=> $b} keys %{$sections_count}); - if ($num_sections == 1) { + if (scalar(@sections) == 1) { $output = ''."\n"; foreach (@sections) { $output .= '\n";