--- loncom/interface/loncommon.pm 2006/06/29 16:03:39 1.407 +++ loncom/interface/loncommon.pm 2006/07/03 00:46:00 1.415 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.407 2006/06/29 16:03:39 albertel Exp $ +# $Id: loncommon.pm,v 1.415 2006/07/03 00:46:00 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2866,15 +2866,12 @@ sub bodytag { return $bodytag; } - + my $name = &plainname($env{'user.name'},$env{'user.domain'}); my $roleinfo=(<
- $env{'environment.firstname'} - $env{'environment.middlename'} - $env{'environment.lastname'} - $env{'environment.generation'} + $name  
@@ -3150,7 +3147,7 @@ table#LC_top_nav, table#LC_menubuttons { padding: 0px; } -table#LC_title_bar, table#LC_breadcrumbs, table#LC_nav_location, +table#LC_title_bar, table.LC_breadcrumbs, table#LC_nav_location, table#LC_title_bar.LC_with_remote { width: 100%; border-color: $pgbg; @@ -3163,8 +3160,16 @@ table#LC_title_bar.LC_with_remote { padding: 0px; } +table.LC_docs_path { + width: 100%; + border: 0; + background: $pgbg; + font-family: $sans; + border-collapse: collapse; + padding: 0px; +} + table#LC_title_bar td { - padding: 3px; background: $tabbg; } table#LC_title_bar td.LC_title_bar_who { @@ -3209,14 +3214,21 @@ table#LC_top_nav td a, div#LC_top_nav a table#LC_top_nav td.LC_top_nav_logo { background: $tabbg; text-align: right; + white-space: nowrap; + font-weight: bold; +} +table#LC_top_nav td.LC_top_nav_logo img { + margin-left: 0.2em; + vertical-align: bottom; } -table#LC_breadcrumbs td { +table.LC_breadcrumbs td, table.LC_docs_path td { background: $tabbg; color: $font; font-family: $sans; font-size: smaller; } -table#LC_breadcrumbs td.LC_breadcrumb_component { +table.LC_breadcrumbs td.LC_breadcrumbs_component, +table.LC_docs_path td.LC_docs_path_component { background: $tabbg; color: $font; font-family: $sans; @@ -3465,8 +3477,10 @@ Inputs: $title - optional title for the $args - optional arguments force_register - if is true call registerurl so the remote is informed - redirect -> array ref of seconds before redirect occurs - url to redirect to + redirect -> array ref of + 1- seconds before redirect occurs + 2- url to redirect to + 3- whether the side effect should occur (side effect of setting $env{'internal.head.redirect'} to the url redirected too) @@ -3493,7 +3507,6 @@ sub headtag { my $result = ''. - ''. &font_settings(). &Apache::lonhtmlcommon::htmlareaheaders(); @@ -3502,9 +3515,11 @@ sub headtag { } if (ref($args->{'redirect'})) { - my ($time,$url) = @{$args->{'redirect'}}; + my ($time,$url,$inhibit_continue) = @{$args->{'redirect'}}; $url = &Apache::lonenc::check_encrypt($url); - $env{'internal.head.redirect'} = $url; + if (!$inhibit_continue) { + $env{'internal.head.redirect'} = $url; + } $result.=< @@ -3514,7 +3529,9 @@ ADDMETA $title = 'The LearningOnline Network with CAPA'; } - $result .= ' LON-CAPA '.&mt($title).''.$head_extra; + $result .= ' LON-CAPA '.&mt($title).'' + .'' + .$head_extra; return $result; } @@ -3886,33 +3903,35 @@ role status: active, previous or future. =cut sub check_user_status { - my ($udom,$uname,$cdom,$crs,$role,$secgrp) = @_; + my ($udom,$uname,$cdom,$crs,$role,$sec) = @_; my %userinfo = &Apache::lonnet::dump('roles',$udom,$uname); my @uroles = keys %userinfo; my $srchstr; my $active_chk = 'none'; + my $now = time; if (@uroles > 0) { - if (($role eq 'cc') || ($secgrp eq '') || (!defined($secgrp))) { + if (($role eq 'cc') || ($sec eq '') || (!defined($sec))) { $srchstr = '/'.$cdom.'/'.$crs.'_'.$role; } else { - $srchstr = '/'.$cdom.'/'.$crs.'/'.$secgrp.'_'.$role; } - if (grep/^$srchstr$/,@uroles) { + $srchstr = '/'.$cdom.'/'.$crs.'/'.$sec.'_'.$role; + } + if (grep/^\Q$srchstr\E$/,@uroles) { my $role_end = 0; my $role_start = 0; $active_chk = 'active'; - if ($userinfo{$srchstr} =~ m/^($role)_(\d+)/) { - $role_end = $2; - if ($userinfo{$srchstr} =~ m/^($role)_($role_end)_(\d+)$/) { - $role_start = $3; + if ($userinfo{$srchstr} =~ m/^\Q$role\E_(\d+)/) { + $role_end = $1; + if ($userinfo{$srchstr} =~ m/^\Q$role\E_\Q$role_end\E_(\d+)$/) { + $role_start = $1; } } if ($role_start > 0) { - if (time < $role_start) { + if ($now < $role_start) { $active_chk = 'future'; } } if ($role_end > 0) { - if (time > $role_end) { + if ($now > $role_end) { $active_chk = 'previous'; } } @@ -4032,11 +4051,23 @@ sub get_course_users { my $now = time; foreach my $student (keys(%{$classlist})) { my $match = 0; + my $secmatch = 0; if ((ref($sections) eq 'ARRAY') && (@{$sections} > 0)) { - unless(grep(/^\Q$$classlist{$student}[$idx{section}]\E$/, + if (grep/^all$/,@{$sections}) { + $secmatch = 1; + } elsif ($$classlist{$student}[$idx{section}] eq '') { + if (grep/^none$/,@{$sections}) { + $secmatch = 1; + } + } else { + if (grep(/^\Q$$classlist{$student}[$idx{section}]\E$/, @{$sections})) { - next; + $secmatch = 1; + } } + if (!$secmatch) { + next; + } } if (defined($$types{'active'})) { if ($$classlist{$student}[$idx{status}] eq 'Active') { @@ -4056,35 +4087,47 @@ sub get_course_users { $match = 1; } } - if ($match && defined($userdata)) { + if ($match && ref($userdata) eq 'HASH') { $$userdata{$student} = $$classlist{$student}; } } } - if ((@{$roles} > 0) && (@{$roles} ne "st")) { + if ((@{$roles} > 1) || ((@{$roles} == 1) && ($$roles[0] ne "st"))) { my @coursepersonnel = &Apache::lonnet::getkeys('nohist_userroles',$cdom,$cnum); foreach my $person (@coursepersonnel) { my $match = 0; - my ($role,$user) = ($person =~ /^([^:]*):([^:]+:[^:]+)/); + my $secmatch = 0; + my ($role,$user,$usec) = ($person =~ /^([^:]*):([^:]+:[^:]+):([^:]*)/); $user =~ s/:$//; if (($role) && (grep(/^\Q$role\E$/,@{$roles}))) { - my ($uname,$udom,$usec) = split(/:/,$user); - if ($usec ne '' && (ref($sections) eq 'ARRAY') && - @{$sections} > 0) { - unless(grep(/^\Q$usec\E$/,@{$sections})) { - next; - } + my ($uname,$udom) = split(/:/,$user); + if ((ref($sections) eq 'ARRAY') && (@{$sections} > 0)) { + if (grep/^all$/,@{$sections}) { + $secmatch = 1; + } elsif ($usec eq '') { + if (grep/^none$/,@{$sections}) { + $secmatch = 1; + } + } else { + if (grep(/^\Q$usec\E$/,@{$sections})) { + $secmatch = 1; + } + } + if (!$secmatch) { + next; + } } if ($uname ne '' && $udom ne '') { - my $status = &check_user_status($udom,$uname,$cdom,$cnum,$role); + my $status = &check_user_status($udom,$uname,$cdom,$cnum,$role, + $usec); foreach my $type (keys(%{$types})) { if ($status eq $type) { @{$$users{$role}{$user}} = $type; $match = 1; } } - if ($match && defined($userdata) && - !exists($$userdata{$uname.':'.$udom})) { + if (($match) && (ref($userdata) eq 'HASH') && + (!exists($$userdata{$uname.':'.$udom}))) { &get_user_info($udom,$uname,\%idx,$userdata); } }