version 1.209, 2008/10/20 03:25:48
|
version 1.209.4.1, 2009/09/23 16:55:53
|
Line 548 ENDHEADER
|
Line 548 ENDHEADER
|
my $possiblerole=''; |
my $possiblerole=''; |
my %futureroles; |
my %futureroles; |
my %roles_nextlogin; |
my %roles_nextlogin; |
|
my %timezones; |
foreach $envkey (sort keys %env) { |
foreach $envkey (sort keys %env) { |
my $button = 1; |
my $button = 1; |
my $switchserver=''; |
my $switchserver=''; |
Line 557 ENDHEADER
|
Line 558 ENDHEADER
|
my ($role,$where,$trolecode,$tstart,$tend,$tremark,$tstatus,$tpstart,$tpend,$tfont); |
my ($role,$where,$trolecode,$tstart,$tend,$tremark,$tstatus,$tpstart,$tpend,$tfont); |
&role_status($envkey,$then,$now,\$role,\$where,\$trolecode,\$tstatus,\$tstart,\$tend); |
&role_status($envkey,$then,$now,\$role,\$where,\$trolecode,\$tstatus,\$tstart,\$tend); |
next if (!defined($role) || $role eq '' || $role =~ /^gr/); |
next if (!defined($role) || $role eq '' || $role =~ /^gr/); |
|
my $timezone = &role_timezone($where,\%timezones); |
$tremark=''; |
$tremark=''; |
$tpstart=' '; |
$tpstart=' '; |
$tpend=' '; |
$tpend=' '; |
$tfont='#000000'; |
$tfont='#000000'; |
if ($tstart) { |
if ($tstart) { |
$tpstart=&Apache::lonlocal::locallocaltime($tstart); |
$tpstart=&Apache::lonlocal::locallocaltime($tstart,$timezone); |
} |
} |
if ($tend) { |
if ($tend) { |
$tpend=&Apache::lonlocal::locallocaltime($tend); |
$tpend=&Apache::lonlocal::locallocaltime($tend,$timezone); |
} |
} |
if ($env{'request.role'} eq $trolecode) { |
if ($env{'request.role'} eq $trolecode) { |
$tstatus='selected'; |
$tstatus='selected'; |
Line 833 ENDHEADER
|
Line 835 ENDHEADER
|
return OK; |
return OK; |
} |
} |
|
|
|
sub role_timezone { |
|
my ($where,$timezones) = @_; |
|
my $timezone; |
|
if (ref($timezones) eq 'HASH') { |
|
if ($where =~ m{^/($match_domain)/($match_courseid)}) { |
|
my $cdom = $1; |
|
my $cnum = $2; |
|
if ($cdom && $cnum) { |
|
if (!exists($timezones->{$cdom.'_'.$cnum})) { |
|
my %timehash = |
|
&Apache::lonnet::get('environment',['timezone'],$cdom,$cnum); |
|
if ($timehash{'timezone'} eq '') { |
|
if (!exists($timezones->{$cdom})) { |
|
my %domdefaults = |
|
&Apache::lonnet::get_domain_defaults($cdom); |
|
if ($domdefaults{'timezone_def'} eq '') { |
|
$timezones->{$cdom} = 'local'; |
|
} else { |
|
$timezones->{$cdom} = $domdefaults{'timezone_def'}; |
|
} |
|
} |
|
$timezones->{$cdom.'_'.$cnum} = $timezones->{$cdom}; |
|
} else { |
|
$timezones->{$cdom.'_'.$cnum} = |
|
&Apache::lonlocal::gettimezone($timehash{'timezone'}); |
|
} |
|
} |
|
$timezone = $timezones->{$cdom.'_'.$cnum}; |
|
} |
|
} else { |
|
my ($tdom) = ($where =~ m{^/($match_domain)}); |
|
if ($tdom) { |
|
if (!exists($timezones->{$tdom})) { |
|
my %domdefaults = &Apache::lonnet::get_domain_defaults($tdom); |
|
if ($domdefaults{'timezone_def'} eq '') { |
|
$timezones->{$tdom} = 'local'; |
|
} else { |
|
$timezones->{$tdom} = $domdefaults{'timezone_def'}; |
|
} |
|
} |
|
$timezone = $timezones->{$tdom}; |
|
} |
|
} |
|
if ($timezone eq 'local') { |
|
$timezone = undef; |
|
} |
|
} |
|
return $timezone; |
|
} |
|
|
sub roletable_headers { |
sub roletable_headers { |
my ($r,$roleclass,$sortrole,$nochoose) = @_; |
my ($r,$roleclass,$sortrole,$nochoose) = @_; |
my $doheaders; |
my $doheaders; |