--- loncom/interface/loncommon.pm 2006/05/08 22:34:00 1.364 +++ loncom/interface/loncommon.pm 2006/05/10 21:50:39 1.368 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.364 2006/05/08 22:34:00 albertel Exp $ +# $Id: loncommon.pm,v 1.368 2006/05/10 21:50:39 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2945,11 +2945,12 @@ ENDROLE return(< -$upperleft +$upperleft $messages  $titleinfo $dc_info $menu $roleinfo + ENDBODY } @@ -3117,6 +3118,7 @@ table#LC_title_bar { width: 100%; border: 0; border-spacing: 0px 1px; + padding: 0px 2px 0px 2px; background: $pgbg; font-family: $sans; border-collapse: collapse; @@ -3145,6 +3147,11 @@ span.LC_title_bar_title { table#LC_title_bar td.LC_title_bar_domain_logo { background: $sidebg; text-align: right; + padding: 0px; +} +table#LC_title_bar td.LC_title_bar_role_logo { + background: $sidebg; + padding: 0px; } table#LC_menubuttons_mainmenu { @@ -3646,6 +3653,14 @@ sub simple_error_page { sub end_data_table_row { return ''; } + + sub start_data_table_header_row { + return ''; + } + + sub end_data_table_header_row { + return ''; + } } ############################################### @@ -3751,20 +3766,27 @@ Returns number of sections. ############################################### sub get_sections { - my ($cdom,$cnum,$sectioncount,$possible_roles) = @_; - if (!($cdom && $cnum)) { return 0; } - my $numsections = 0; + my ($cdom,$cnum,$possible_roles) = @_; + if (!defined($cdom) || !defined($cnum)) { + my $cid = $env{'request.course.id'}; + + return if (!defined($cid)); + + $cdom = $env{'course.'.$cid.'.domain'}; + $cnum = $env{'course.'.$cid.'.num'}; + } - if (!defined($possible_roles) || (grep/^st$/,@$possible_roles)) { + my %sectioncount; + + if (!defined($possible_roles) || (grep(/^st$/,@$possible_roles))) { my ($classlist) = &Apache::loncoursedata::get_classlist($cdom,$cnum); my $sec_index = &Apache::loncoursedata::CL_SECTION(); my $status_index = &Apache::loncoursedata::CL_STATUS(); - while (my ($student,$data) = each %$classlist) { + while (my ($student,$data) = each(%$classlist)) { my ($section,$status) = ($data->[$sec_index], $data->[$status_index]); unless ($section eq '-1' || $section =~ /^\s*$/) { - if (!defined($$sectioncount{$section})) { $numsections++; } - $$sectioncount{$section}++; + $sectioncount{$section}++; } } } @@ -3780,10 +3802,9 @@ sub get_sections { } if ($user =~ /^$role:[^:]*:[^:]*:(\w+)/) { $section=$1; } if (!defined($section) || $section eq '-1') { next; } - if (!defined($$sectioncount{$section})) { $numsections++; } - $$sectioncount{$section}++; + $sectioncount{$section}++; } - return $numsections; + return %sectioncount; } ############################################### @@ -3820,25 +3841,24 @@ can be sent to &get_group_settings() to ############################################### sub coursegroups { - my ($curr_groups,$cdom,$cnum,$group) = @_; - my $numgroups; + my ($cdom,$cnum,$group) = @_; if (!defined($cdom) || !defined($cnum)) { my $cid = $env{'request.course.id'}; + + return if (!defined($cid)); + $cdom = $env{'course.'.$cid.'.domain'}; $cnum = $env{'course.'.$cid.'.num'}; } - %{$curr_groups} = &Apache::lonnet::get_coursegroups($cdom,$cnum,$group); - my ($tmp) = keys(%{$curr_groups}); - if ($tmp=~/^error:/) { - unless ($tmp eq 'error: 2 tie(GDBM) Failed while attempting dump') { - &logthis('Error retrieving groups: '.$tmp.' in '.$cnum.':'. - $cdom); - } - $numgroups = 0; - } else { - $numgroups = keys(%{$curr_groups}); + my %curr_groups = &Apache::lonnet::get_coursegroups($cdom,$cnum,$group); + my ($tmp) = keys(%curr_groups); + if ($tmp=~/^(con_lost|no_such_host|error: [^2] )/) { + undef(%curr_groups); + &logthis('Error retrieving groups: '.$tmp.' in '.$cnum.':'.$cdom); + } elsif ($tmp=~/^error: 2 /) { + undef(%curr_groups); } - return $numgroups; + return %curr_groups; } ###############################################