version 1.465, 2017/01/02 19:44:06
|
version 1.467, 2017/02/18 23:39:16
|
Line 503 sub secondary_menu {
|
Line 503 sub secondary_menu {
|
} else { |
} else { |
$$menuitem[0] =~ s{\?register=1}{}; |
$$menuitem[0] =~ s{\?register=1}{}; |
} |
} |
|
if (($ENV{'SERVER_PORT'} == 443) && |
|
($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) { |
|
$$menuitem[0] .= ($$menuitem[0]=~/\?/) ? '&' : '?' . 'usehttp=1'; |
|
} |
} |
} |
$menu .= &prep_menuitem(\@$menuitem); |
$menu .= &prep_menuitem(\@$menuitem); |
} |
} |
Line 2340 sub get_customadhoc_roles {
|
Line 2344 sub get_customadhoc_roles {
|
(ref($courseprivs) eq 'HASH') && (ref($roledesc) eq 'HASH')) { |
(ref($courseprivs) eq 'HASH') && (ref($roledesc) eq 'HASH')) { |
return; |
return; |
} |
} |
if ($env{"user.role.dh./$cdom/"}) { |
my $is_helpdesk = 0; |
my ($start,$end)=split(/\./,$env{"user.role.dh./$cdom/"}); |
my $now = time; |
my $now = time; |
foreach my $role ('dh','da') { |
if (!($start && ($now<$start)) && !($end && ($now>$end))) { |
if ($env{"user.role.$role./$cdom/"}) { |
my ($possroles,$description) = &Apache::lonnet::get_my_adhocroles($cdom.'_'.$cnum); |
my ($start,$end)=split(/\./,$env{"user.role.$role./$cdom/"}); |
my %available; |
if (!($start && ($now<$start)) && !($end && ($now>$end))) { |
if (ref($possroles) eq 'ARRAY') { |
$is_helpdesk = 1; |
map { $available{$_} = 1; } @{$possroles}; |
last; |
} |
} |
my %domdefaults = &Apache::lonnet::get_domain_defaults($cdom); |
} |
if (ref($domdefaults{'adhocroles'}) eq 'HASH') { |
} |
if (keys(%{$domdefaults{'adhocroles'}})) { |
if ($is_helpdesk) { |
my $numsec = 1; |
my ($possroles,$description) = &Apache::lonnet::get_my_adhocroles($cdom.'_'.$cnum); |
my @sections; |
my %available; |
my ($allseclist,$cached) = |
if (ref($possroles) eq 'ARRAY') { |
&Apache::lonnet::is_cached_new('courseseclist',$cdom.'_'.$cnum); |
map { $available{$_} = 1; } @{$possroles}; |
if (defined($cached)) { |
} |
if ($allseclist ne '') { |
my %domdefaults = &Apache::lonnet::get_domain_defaults($cdom); |
@sections = split(/,/,$allseclist); |
if (ref($domdefaults{'adhocroles'}) eq 'HASH') { |
$numsec += scalar(@sections); |
if (keys(%{$domdefaults{'adhocroles'}})) { |
} |
my $numsec = 1; |
} else { |
my @sections; |
my %sections_count = &Apache::loncommon::get_sections($cdom,$cnum); |
my ($allseclist,$cached) = |
@sections = sort(keys(%sections_count)); |
&Apache::lonnet::is_cached_new('courseseclist',$cdom.'_'.$cnum); |
|
if (defined($cached)) { |
|
if ($allseclist ne '') { |
|
@sections = split(/,/,$allseclist); |
$numsec += scalar(@sections); |
$numsec += scalar(@sections); |
$allseclist = join(',',@sections); |
|
&Apache::lonnet::do_cache_new('courseseclist',$cdom.'_'.$cnum,$allseclist); |
|
} |
} |
my (%adhoc,$gotprivs); |
} else { |
my $prefix = "cr/$cdom/$cdom".'-domainconfig'; |
my %sections_count = &Apache::loncommon::get_sections($cdom,$cnum); |
foreach my $role (keys(%{$domdefaults{'adhocroles'}})) { |
@sections = sort(keys(%sections_count)); |
next if (($role eq '') || ($role =~ /\W/)); |
$numsec += scalar(@sections); |
$seccount->{"$prefix/$role"} = $numsec; |
$allseclist = join(',',@sections); |
$roledesc->{"$prefix/$role"} = $description->{$role}; |
&Apache::lonnet::do_cache_new('courseseclist',$cdom.'_'.$cnum,$allseclist); |
if ((ref($privref) eq 'ARRAY') && (@{$privref} > 0)) { |
} |
if (exists($env{"user.priv.$prefix/$role./$cdom/$cnum./"})) { |
my (%adhoc,$gotprivs); |
$courseprivs->{"$prefix/$role./$cdom/$cnum./"} = |
my $prefix = "cr/$cdom/$cdom".'-domainconfig'; |
$env{"user.priv.$prefix/$role./$cdom/$cnum./"}; |
foreach my $role (keys(%{$domdefaults{'adhocroles'}})) { |
$courseprivs->{"$prefix/$role./$cdom/$cnum./$cdom/"} = |
next if (($role eq '') || ($role =~ /\W/)); |
$env{"user.priv.$prefix/$role./$cdom/$cnum./$cdom/"}; |
$seccount->{"$prefix/$role"} = $numsec; |
$courseprivs->{"$prefix/$role./$cdom/$cnum./$cdom/$cnum"} = |
$roledesc->{"$prefix/$role"} = $description->{$role}; |
$env{"user.priv.$prefix/$role./$cdom/$cnum./$cdom/$cnum"}; |
if ((ref($privref) eq 'ARRAY') && (@{$privref} > 0)) { |
} else { |
if (exists($env{"user.priv.$prefix/$role./$cdom/$cnum./"})) { |
unless ($gotprivs) { |
$courseprivs->{"$prefix/$role./$cdom/$cnum./"} = |
my ($adhocroles,$privscached) = |
$env{"user.priv.$prefix/$role./$cdom/$cnum./"}; |
&Apache::lonnet::is_cached_new('adhocroles',$cdom); |
$courseprivs->{"$prefix/$role./$cdom/$cnum./$cdom/"} = |
if ((defined($privscached)) && (ref($adhocroles) eq 'HASH')) { |
$env{"user.priv.$prefix/$role./$cdom/$cnum./$cdom/"}; |
%adhoc = %{$adhocroles}; |
$courseprivs->{"$prefix/$role./$cdom/$cnum./$cdom/$cnum"} = |
} else { |
$env{"user.priv.$prefix/$role./$cdom/$cnum./$cdom/$cnum"}; |
my $confname = &Apache::lonnet::get_domainconfiguser($cdom); |
} else { |
my %roledefs = &Apache::lonnet::dump('roles',$cdom,$confname,'rolesdef_'); |
unless ($gotprivs) { |
foreach my $key (keys(%roledefs)) { |
my ($adhocroles,$privscached) = |
(undef,my $rolename) = split(/_/,$key); |
&Apache::lonnet::is_cached_new('adhocroles',$cdom); |
if ($rolename ne '') { |
if ((defined($privscached)) && (ref($adhocroles) eq 'HASH')) { |
my ($systempriv,$domainpriv,$coursepriv) = split(/\_/,$roledefs{$key}); |
%adhoc = %{$adhocroles}; |
$coursepriv = &Apache::lonnet::course_adhocrole_privs($rolename,$cdom,$cnum,$coursepriv); |
} else { |
$adhoc{$rolename} = join('_',($systempriv,$domainpriv,$coursepriv)); |
my $confname = &Apache::lonnet::get_domainconfiguser($cdom); |
} |
my %roledefs = &Apache::lonnet::dump('roles',$cdom,$confname,'rolesdef_'); |
|
foreach my $key (keys(%roledefs)) { |
|
(undef,my $rolename) = split(/_/,$key); |
|
if ($rolename ne '') { |
|
my ($systempriv,$domainpriv,$coursepriv) = split(/\_/,$roledefs{$key}); |
|
$coursepriv = &Apache::lonnet::course_adhocrole_privs($rolename,$cdom,$cnum,$coursepriv); |
|
$adhoc{$rolename} = join('_',($systempriv,$domainpriv,$coursepriv)); |
} |
} |
&Apache::lonnet::do_cache_new('adhocroles',$cdom,\%adhoc); |
|
} |
} |
$gotprivs = 1; |
&Apache::lonnet::do_cache_new('adhocroles',$cdom,\%adhoc); |
} |
} |
($courseprivs->{"$prefix/$role./$cdom/$cnum./"}, |
$gotprivs = 1; |
$courseprivs->{"$prefix/$role./$cdom/$cnum./$cdom/"}, |
|
$courseprivs->{"$prefix/$role./$cdom/$cnum./$cdom/$cnum"}) = |
|
split(/\_/,$adhoc{$role}); |
|
} |
} |
|
($courseprivs->{"$prefix/$role./$cdom/$cnum./"}, |
|
$courseprivs->{"$prefix/$role./$cdom/$cnum./$cdom/"}, |
|
$courseprivs->{"$prefix/$role./$cdom/$cnum./$cdom/$cnum"}) = |
|
split(/\_/,$adhoc{$role}); |
} |
} |
if ($available{$role}) { |
} |
$courseroles->{"$prefix/$role"} = \@sections; |
if ($available{$role}) { |
} |
$courseroles->{"$prefix/$role"} = \@sections; |
} |
} |
} |
} |
} |
} |