version 1.465, 2017/01/02 19:44:06
|
version 1.471, 2017/05/07 13:57:58
|
Line 497 sub secondary_menu {
|
Line 497 sub secondary_menu {
|
my $url = $$menuitem[0]; |
my $url = $$menuitem[0]; |
$url =~ s{\[cdom\]/\[cnum\]}{$cdom/$cnum}; |
$url =~ s{\[cdom\]/\[cnum\]}{$cdom/$cnum}; |
if (&Apache::lonnet::is_on_map($url)) { |
if (&Apache::lonnet::is_on_map($url)) { |
unless ($$menuitem[0] =~ /\?register=1/) { |
unless ($$menuitem[0] =~ /(\?|\&)register=1/) { |
$$menuitem[0] .= '?register=1'; |
$$menuitem[0] .= (($$menuitem[0]=~/\?/)? '&' : '?').'register=1'; |
} |
} |
} else { |
} else { |
$$menuitem[0] =~ s{\?register=1}{}; |
$$menuitem[0] =~ s{\&?register=1}{}; |
|
} |
|
if ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://}) { |
|
if (($ENV{'SERVER_PORT'} == 443) || ($env{'request.use_absolute'} =~ m{^https://})) { |
|
unless ($$menuitem[0] =~ m{^https?://}) { |
|
$$menuitem[0] = 'http://'.$ENV{'SERVER_NAME'}.$$menuitem[0]; |
|
} |
|
unless ($$menuitem[0] =~ /(\&|\?)usehttp=1/) { |
|
$$menuitem[0] .= (($$menuitem[0]=~/\?/) ? '&' : '?').'usehttp=1'; |
|
} |
|
} |
} |
} |
} |
} |
$menu .= &prep_menuitem(\@$menuitem); |
$menu .= &prep_menuitem(\@$menuitem); |
Line 625 sub build_submenu {
|
Line 635 sub build_submenu {
|
} |
} |
|
|
sub innerregister { |
sub innerregister { |
my ($forcereg,$bread_crumbs,$group,$pagebuttonshide) = @_; |
my ($forcereg,$bread_crumbs,$group,$pagebuttonshide,$hostname) = @_; |
my $const_space = ($env{'request.state'} eq 'construct'); |
my $const_space = ($env{'request.state'} eq 'construct'); |
my $is_const_dir = 0; |
my $is_const_dir = 0; |
|
|
Line 692 sub innerregister {
|
Line 702 sub innerregister {
|
} |
} |
my $trail; |
my $trail; |
if ($env{'form.folderpath'}) { |
if ($env{'form.folderpath'}) { |
&prepare_functions($resurl,$forcereg,$group,undef,undef,1); |
&prepare_functions($resurl,$forcereg,$group,undef,undef,1,$hostname); |
($trail) = |
($trail) = |
&Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1); |
&Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1); |
} else { |
} else { |
Line 707 sub innerregister {
|
Line 717 sub innerregister {
|
} elsif ($resurl =~ m{^\Q/uploaded$courseurl/portfolio/syllabus/}) { |
} elsif ($resurl =~ m{^\Q/uploaded$courseurl/portfolio/syllabus/}) { |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&prepare_functions('/public'.$courseurl."/syllabus", |
&prepare_functions('/public'.$courseurl."/syllabus", |
$forcereg,$group,undef,undef,1); |
$forcereg,$group,undef,undef,1,$hostname); |
$title = &mt('Syllabus File'); |
$title = &mt('Syllabus File'); |
my ($trail) = |
my ($trail) = |
&Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1); |
&Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1,$hostname); |
return $trail; |
return $trail; |
} |
} |
unless ($env{'request.state'} eq 'construct') { |
unless ($env{'request.state'} eq 'construct') { |
Line 734 sub innerregister {
|
Line 744 sub innerregister {
|
$forceview,$editbutton); |
$forceview,$editbutton); |
if (($resurl =~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) || |
if (($resurl =~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) || |
($env{'request.role'} !~/^(aa|ca|au)/)) { |
($env{'request.role'} !~/^(aa|ca|au)/)) { |
$editbutton = &prepare_functions($resurl,$forcereg,$group); |
$editbutton = &prepare_functions($resurl,$forcereg,$group,'','','',$hostname); |
} |
} |
if ($editbutton eq '') { |
if ($editbutton eq '') { |
$editbutton = &clear(6,1); |
$editbutton = &clear(6,1); |
Line 908 if ($env{'browser.mobile'}) {
|
Line 918 if ($env{'browser.mobile'}) {
|
$is_mobile = 1; |
$is_mobile = 1; |
} |
} |
|
|
unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme|viewclasslist|portfolio|exttools?)(\?|$)/) { |
unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme|viewclasslist|portfolio|exttool)(\?|$)/) { |
if ((!$env{'request.enc'}) && ($env{'request.noversionuri'} !~ m{^/adm/wrapper/ext/}) && ($env{'request.noversionuri'} !~ m{^/uploaded/$match_domain/$match_courseid/docs/})) { |
if ((!$env{'request.enc'}) && ($env{'request.noversionuri'} !~ m{^/adm/wrapper/ext/}) && ($env{'request.noversionuri'} !~ m{^/uploaded/$match_domain/$match_courseid/docs/})) { |
$menuitems.=(<<ENDREALRES); |
$menuitems.=(<<ENDREALRES); |
s&6&3&catalog.png&Info&info[_1]&catalog_info('$is_mobile')&Show Metadata |
s&6&3&catalog.png&Info&info[_1]&catalog_info('$is_mobile')&Show Metadata |
Line 1033 ENDMENUITEMS
|
Line 1043 ENDMENUITEMS
|
} |
} |
|
|
sub get_editbutton { |
sub get_editbutton { |
my ($cfile,$home,$switchserver,$forceedit,$forceview,$forcereg) = @_; |
my ($cfile,$home,$switchserver,$forceedit,$forceview,$forcereg,$hostname) = @_; |
my $jscall; |
my $jscall; |
if (($forceview) && ($env{'form.todocs'})) { |
if (($forceview) && ($env{'form.todocs'})) { |
my ($folderpath,$command,$navmap); |
my ($folderpath,$command,$navmap); |
Line 1053 sub get_editbutton {
|
Line 1063 sub get_editbutton {
|
$jscall = &Apache::lonhtmlcommon::jump_to_editres($cfile,$home,$switchserver, |
$jscall = &Apache::lonhtmlcommon::jump_to_editres($cfile,$home,$switchserver, |
$forceedit,$forcereg,$env{'request.symb'}, |
$forceedit,$forcereg,$env{'request.symb'}, |
&escape($env{'form.folderpath'}), |
&escape($env{'form.folderpath'}), |
&escape($env{'form.title'}),$env{'form.idx'}, |
&escape($env{'form.title'}),$hostname, |
&escape($env{'form.suppurl'}),$env{'form.todocs'}, |
$env{'form.idx'},&escape($env{'form.suppurl'}), |
$suppanchor); |
$env{'form.todocs'},$suppanchor); |
} |
} |
if ($jscall) { |
if ($jscall) { |
my $icon = 'pcstr.png'; |
my $icon = 'pcstr.png'; |
Line 1072 sub get_editbutton {
|
Line 1082 sub get_editbutton {
|
} |
} |
|
|
sub prepare_functions { |
sub prepare_functions { |
my ($resurl,$forcereg,$group,$bread_crumbs,$advtools,$docscrumbs) = @_; |
my ($resurl,$forcereg,$group,$bread_crumbs,$advtools,$docscrumbs,$hostname) = @_; |
unless ($env{'request.registered'}) { |
unless ($env{'request.registered'}) { |
undef(@inlineremote); |
undef(@inlineremote); |
} |
} |
Line 1118 sub prepare_functions {
|
Line 1128 sub prepare_functions {
|
# This applies in course context |
# This applies in course context |
# |
# |
if (($perms{'mdc'}) && |
if (($perms{'mdc'}) && |
(($resurl eq "/public/$cdom/$cnum/syllabus") || |
(($resurl =~ m{^/?public/$cdom/$cnum/syllabus}) || |
($resurl =~ m{^/uploaded/$cdom/$cnum/portfolio/syllabus/}))) { |
($resurl =~ m{^/?uploaded/$cdom/$cnum/portfolio/syllabus/}))) { |
$cfile = $resurl; |
if ($resurl =~ m{^/}) { |
|
$cfile = $resurl; |
|
} else { |
|
$cfile = "/$resurl"; |
|
} |
$home = &Apache::lonnet::homeserver($cnum,$cdom); |
$home = &Apache::lonnet::homeserver($cnum,$cdom); |
if ($env{'form.forceedit'}) { |
if ($env{'form.forceedit'}) { |
$forceview = 1; |
$forceview = 1; |
Line 1128 sub prepare_functions {
|
Line 1142 sub prepare_functions {
|
$forceedit = 1; |
$forceedit = 1; |
} |
} |
$editbutton = &get_editbutton($cfile,$home,$switchserver, |
$editbutton = &get_editbutton($cfile,$home,$switchserver, |
$forceedit,$forceview,$forcereg); |
$forceedit,$forceview,$forcereg, |
|
$hostname); |
} elsif (($resurl eq '/adm/extresedit') && |
} elsif (($resurl eq '/adm/extresedit') && |
(($env{'form.symb'}) || ($env{'form.folderpath'}))) { |
(($env{'form.symb'}) || ($env{'form.folderpath'}))) { |
($cfile,$home,$switchserver,$forceedit,$forceview) = |
($cfile,$home,$switchserver,$forceedit,$forceview) = |
Line 1136 sub prepare_functions {
|
Line 1151 sub prepare_functions {
|
$env{'form.symb'}); |
$env{'form.symb'}); |
if ($cfile ne '') { |
if ($cfile ne '') { |
$editbutton = &get_editbutton($cfile,$home,$switchserver, |
$editbutton = &get_editbutton($cfile,$home,$switchserver, |
$forceedit,$forceview,$forcereg, |
$forceedit,$forceview,$forcereg); |
$env{'form.title'},$env{'form.suppurl'}); |
|
} |
} |
} elsif (($resurl =~ m{^/?adm/viewclasslist$}) && |
} elsif (($resurl =~ m{^/?adm/viewclasslist$}) && |
(&Apache::lonnet::allowed('opa',$env{'request.course.id'}))) { |
(&Apache::lonnet::allowed('opa',$env{'request.course.id'}))) { |
Line 1155 sub prepare_functions {
|
Line 1169 sub prepare_functions {
|
&Apache::lonnet::clutter($resurl),$env{'request.symb'},$group); |
&Apache::lonnet::clutter($resurl),$env{'request.symb'},$group); |
if ($cfile ne '') { |
if ($cfile ne '') { |
$editbutton = &get_editbutton($cfile,$home,$switchserver, |
$editbutton = &get_editbutton($cfile,$home,$switchserver, |
$forceedit,$forceview,$forcereg); |
$forceedit,$forceview,$forcereg, |
|
$hostname); |
} |
} |
} |
} |
} |
} |
Line 1205 sub prepare_functions {
|
Line 1220 sub prepare_functions {
|
if (($env{'form.folderpath'} =~ /^supplemental/) && |
if (($env{'form.folderpath'} =~ /^supplemental/) && |
(&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) && |
(&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) && |
(($resurl =~ m{^/adm/wrapper/ext/}) || |
(($resurl =~ m{^/adm/wrapper/ext/}) || |
($resurl =~ m{^/adm/$cdom/$cnum/\d+/exttools?$}) || |
($resurl =~ m{^/adm/$cdom/$cnum/\d+/exttool$}) || |
($resurl =~ m{^/uploaded/$cdom/$cnum/supplemental/}) || |
($resurl =~ m{^/uploaded/$cdom/$cnum/supplemental/}) || |
($resurl eq '/adm/supplemental') || |
($resurl eq '/adm/supplemental') || |
($resurl =~ m{^/public/$cdom/$cnum/syllabus$}) || |
($resurl =~ m{^/public/$cdom/$cnum/syllabus$}) || |
Line 1217 sub prepare_functions {
|
Line 1232 sub prepare_functions {
|
$suppanchor = $env{'form.anchor'}; |
$suppanchor = $env{'form.anchor'}; |
} |
} |
my $esc_path=&escape(&HTML::Entities::encode(&escape($env{'form.folderpath'}),'<>&"')); |
my $esc_path=&escape(&HTML::Entities::encode(&escape($env{'form.folderpath'}),'<>&"')); |
|
my $link = '/adm/coursedocs?command=direct&forcesupplement=1&supppath='. |
|
"$esc_path&anchor=$suppanchor"; |
|
if ($env{'request.use_absolute'} ne '') { |
|
$link = $env{'request.use_absolute'}.$link; |
|
} |
&switch('','',7,4,'docs-22x22.png','Edit Folder','parms[_2]', |
&switch('','',7,4,'docs-22x22.png','Edit Folder','parms[_2]', |
"location.href='/adm/coursedocs?command=direct&forcesupplement=1&supppath=$esc_path&anchor=$suppanchor'", |
"location.href='$link'",'Folder/Page Content'); |
'Folder/Page Content'); |
|
} |
} |
} |
} |
} |
} |
Line 2110 sub roles_selector {
|
Line 2129 sub roles_selector {
|
} |
} |
my ($privref,$gotsymb,$destsymb); |
my ($privref,$gotsymb,$destsymb); |
my $destinationurl = $ENV{'REQUEST_URI'}; |
my $destinationurl = $ENV{'REQUEST_URI'}; |
if ($destinationurl =~ /\?symb=/) { |
if ($destinationurl =~ /(\?|\&)symb=/) { |
$gotsymb = 1; |
$gotsymb = 1; |
} elsif ($destinationurl =~ m{^/enc/}) { |
} elsif ($destinationurl =~ m{^/enc/}) { |
my $plainurl = &Apache::lonenc::unencrypted($destinationurl); |
my $plainurl = &Apache::lonenc::unencrypted($destinationurl); |
if ($plainurl =~ /\?symb=/) { |
if ($plainurl =~ /(\?|\&)symb=/) { |
$gotsymb = 1; |
$gotsymb = 1; |
} |
} |
} |
} |
Line 2340 sub get_customadhoc_roles {
|
Line 2359 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; |
} |
} |
} |
} |
} |
} |