--- loncom/interface/loncommon.pm 2006/05/01 20:48:55 1.359 +++ 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.359 2006/05/01 20:48:55 albertel Exp $ +# $Id: loncommon.pm,v 1.368 2006/05/10 21:50:39 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2773,6 +2773,9 @@ Inputs: =item * $notitle, if true keep the nav controls, but remove the title bar +=item * $no_inline_link, if true and in remote mode, don't show the + 'Switch To Inline Menu' link + =back @@ -2785,15 +2788,13 @@ other decorations will be returned. sub bodytag { my ($title,$function,$addentries,$bodyonly,$domain,$forcereg,$customtitle, - $notopbar,$bgcolor,$notitle)=@_; + $notopbar,$bgcolor,$notitle,$no_inline_link)=@_; $title=&mt($title); $function = &get_users_function() if (!$function); my $img = &designparm($function.'.img',$domain); - my $tabbg = &designparm($function.'.tabbg',$domain); my $font = &designparm($function.'.font',$domain); - my $sidebg = &designparm($function.'.sidebg',$domain); my $pgbg = $bgcolor || &designparm($function.'.pgbg',$domain); my %design = ( 'style' => 'margin-top: 0px', @@ -2847,12 +2848,13 @@ sub bodytag { $env{'environment.middlename'} $env{'environment.lastname'} $env{'environment.generation'} +  
-$role +$role 
-$realm +$realm 
ENDROLE @@ -2934,7 +2936,8 @@ ENDROLE $lonhttpdPort.$img.'" alt="'.$function.'" />'; # Explicit link to get inline menu - my $menu='
'.&mt('Switch to Inline Menu Mode').''; + my $menu= ($no_inline_link?'' + :'
'.&mt('Switch to Inline Menu Mode').''); # if ($notitle) { return $bodytag; @@ -2942,11 +2945,12 @@ ENDROLE return(< -$upperleft +$upperleft $messages  $titleinfo $dc_info $menu $roleinfo + ENDBODY } @@ -3086,7 +3090,6 @@ sub standard_css { my $mail_other_hover = '#669999'; return < h1, h2, h3, th { font-family: $sans } a:focus { color: red; background: yellow } table.thinborder { border-collapse: collapse; } @@ -3106,7 +3109,7 @@ table#LC_top_nav, table#LC_menubuttons, width: 100%; background: $pgbg; border: 0px; - border-spacing: 1px; + border-spacing: 2px 1px; padding: 0px; margin: 0px; border-collapse: separate; @@ -3114,9 +3117,11 @@ table#LC_top_nav, table#LC_menubuttons, table#LC_title_bar { width: 100%; border: 0; - border-spacing: 3px; + border-spacing: 0px 1px; + padding: 0px 2px 0px 2px; background: $pgbg; font-family: $sans; + border-collapse: collapse; } table#LC_title_bar.LC_with_remote { width: 100%; @@ -3142,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 { @@ -3162,6 +3172,10 @@ table#LC_top_nav td a, div#LC_top_nav a color: $font; font-family: $sans; } +table#LC_top_nav td.LC_top_nav_logo { + background: $tabbg; + text-align: right; +} table#LC_breadcrumbs td { background: $tabbg; color: $font; @@ -3257,7 +3271,6 @@ table.LC_mail_list tr.LC_mail_other { table.LC_mail_list tr.LC_mail_other:hover { background-color: $mail_other_hover; } - END } @@ -3291,10 +3304,18 @@ Inputs: $title - optional title for the sub headtag { my ($title,$head_extra,$args) = @_; + my $function = $args->{'function'} || &get_users_function(); + my $domain = $args->{'domain'} || &determinedomain(); + my $bgcolor = $args->{'bgcolor'} || &designparm($function.'.pgbg',$domain); + my $url = join(':',$env{'user.name'},$env{'user.domain'}, + $env{'environment.color.timestamp'}, + $function,$domain,$bgcolor); + + $url = '/adm/css/'.&Apache::lonnet::escape($url).'.css'; + my $result = ''. - &standard_css($args->{'function'},$args->{'domain'}, - $args->{'bgcolor'}). + ''. &font_settings(). &Apache::lonhtmlcommon::htmlareaheaders(); @@ -3453,6 +3474,9 @@ Inputs: $title - optional title for the head -> skip the generation body -> skip all generation + no_inline_link -> if true and in remote mode, don't show the + 'Switch To Inline Menu' link + =back =cut @@ -3488,7 +3512,7 @@ sub start_page { $args->{'only_body'}, $args->{'domain'}, $args->{'force_register'}, $args->{'body_title'}, $args->{'no_nav_bar'}, $args->{'bgcolor'}, - $args->{'no_title'}); + $args->{'no_title'}, $args->{'no_inline_link'}); } } @@ -3629,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 ''; + } } ############################################### @@ -3734,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'}; + } + + my %sectioncount; - if (!defined($possible_roles) || (grep/^st$/,@$possible_roles)) { + 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}++; } } } @@ -3763,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; } ############################################### @@ -3803,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; } ###############################################