version 1.369.2.27, 2012/12/13 17:38:40
|
version 1.369.2.28, 2012/12/14 14:21:55
|
Line 609 sub innerregister {
|
Line 609 sub innerregister {
|
# ============================ This is for URLs that actually can be registered |
# ============================ This is for URLs that actually can be registered |
if ( ($env{'request.noversionuri'}!~m{^/(res/)*adm/}) |
if ( ($env{'request.noversionuri'}!~m{^/(res/)*adm/}) |
|| ($forcereg)) { |
|| ($forcereg)) { |
my ($cdom,$cnum,%perms,$cfile,$switchserver,$home,$forceedit, |
|
$forceview,$editbutton); |
my %swtext; |
if (($resurl =~ m{^/adm/($match_domain)/($match_username)/aboutme$}) || |
if ($noremote) { |
($env{'request.role'} !~/^(aa|ca|au)/)) { |
%swtext = &get_inline_text(); |
$editbutton = &prepare_functions($resurl,$forcereg,$group); |
} else { |
} |
%swtext = &get_rc_text(); |
if ($editbutton eq '') { |
} |
&clear(6,1); |
my $hwkadd=''; |
} |
|
|
my ($cdom,$cnum,%perms,$cfile,$switchserver,$home,$forceedit, |
|
$forceview,$editbutton); |
|
if (($resurl =~ m{^/adm/($match_domain)/($match_username)/aboutme$}) || |
|
($env{'request.role'} !~/^(aa|ca|au)/)) { |
|
$editbutton = &prepare_functions($resurl,$forcereg,$group); |
|
} |
|
if ($editbutton eq '') { |
|
&clear(6,1); |
|
} |
|
|
# |
# |
# This applies in course context |
# This applies in course context |
# |
# |
if ($env{'request.course.id'}) { |
if ($env{'request.course.id'}) { |
$cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
$cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
$cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
$cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
$perms{'mdc'} = &Apache::lonnet::allowed('mdc',$env{'request.course.id'}); |
$perms{'mdc'} = &Apache::lonnet::allowed('mdc',$env{'request.course.id'}); |
my @privs; |
my @privs; |
if ($env{'request.symb'} ne '') { |
if ($env{'request.symb'} ne '') { |
if ($env{'request.filename'}=~/$LONCAPA::assess_re/) { |
if ($env{'request.filename'}=~/$LONCAPA::assess_re/) { |
push(@privs,('mgr','vgr')); |
push(@privs,('mgr','vgr')); |
} |
} |
push(@privs,'opa'); |
push(@privs,'opa'); |
} |
} |
foreach my $priv (@privs) { |
foreach my $priv (@privs) { |
$perms{$priv} = &Apache::lonnet::allowed($priv,$env{'request.course.id'}); |
$perms{$priv} = &Apache::lonnet::allowed($priv,$env{'request.course.id'}); |
if (!$perms{$priv} && $env{'request.course.sec'} ne '') { |
if (!$perms{$priv} && $env{'request.course.sec'} ne '') { |
$perms{$priv} = |
$perms{$priv} = |
&Apache::lonnet::allowed($priv,"$env{'request.course.id'}/$env{'request.course.sec'}"); |
&Apache::lonnet::allowed($priv,"$env{'request.course.id'}/$env{'request.course.sec'}"); |
|
} |
} |
} |
} |
|
# |
# |
# Determine whether or not to show Grades and Submissions buttons |
# Determine whether or not to show Grades and Submissions buttons |
# |
# |
if ($env{'request.symb'} ne '' && |
if ($env{'request.symb'} ne '' && |
$env{'request.filename'}=~/$LONCAPA::assess_re/) { |
$env{'request.filename'}=~/$LONCAPA::assess_re/) { |
if ($perms{'mgr'}) { |
if ($perms{'mgr'}) { |
&switch('','',7,2,'pgrd.png','Content Grades','grades[_4]', |
$hwkadd.= &switch('','',7,2,'pgrd.png','Content Grades', |
"gocmd('/adm/grades','gradingmenu')", |
'grades[_4]', |
'Content Grades'); |
"gocmd('/adm/grades','gradingmenu')", |
} elsif ($perms{'vgr'}) { |
'Content Grades'); |
&switch('','',7,2,'subm.png','Content Submissions','missions[_1]', |
} elsif ($perms{'vgr'}) { |
"gocmd('/adm/grades','submission')", |
$hwkadd .= &switch('','',7,2,'subm.png','Content Submissions', |
'Content Submissions'); |
'missions[_1]', |
} |
"gocmd('/adm/grades','submission')", |
} |
'Content Submissions'); |
if (($env{'request.symb'} ne '') && ($perms{'opa'})) { |
} |
&switch('','',7,3,'pparm.png','Content Settings','parms[_2]', |
} |
"gocmd('/adm/parmset','set')", |
if (($env{'request.symb'} ne '') && ($perms{'opa'})) { |
'Content Settings'); |
$hwkadd .= &switch('','',7,3,'pparm.png','Content Settings', |
} |
'parms[_2]',"gocmd('/adm/parmset','set')", |
|
'Content Settings'); |
|
} |
# End grades/submissions check |
# End grades/submissions check |
|
|
# |
# |
# This applies to items inside a folder/page modifiable in the course. |
# This applies to items inside a folder/page modifiable in the course. |
# |
# |
if (($env{'request.symb'}=~/^uploaded/) && ($perms{'mdc'})) { |
if (($env{'request.symb'}=~/^uploaded/) && ($perms{'mdc'})) { |
my $text = 'Edit Folder'; |
my $text = 'Edit Folder'; |
if (($mapurl =~ /\.page$/) || |
if (($mapurl =~ /\.page$/) || |
($env{'request.symb'}=~ |
($env{'request.symb'}=~ |
m{uploaded/$cdom/$cnum/default_\d+\.page$})) { |
m{uploaded/$cdom/$cnum/default_\d+\.page$})) { |
$text = 'Edit Page'; |
$text = 'Edit Page'; |
} |
} |
&switch('','',7,4,'docs-22x22.png',$text,'parms[_2]', |
$hwkadd .= &switch('','',7,4,'docs-22x22.png',$text,'parms[_2]', |
"gocmd('/adm/coursedocs','direct')", |
"gocmd('/adm/coursedocs','direct')", |
'Folder/Page Content'); |
'Folder/Page Content'); |
} |
} |
# End modifiable folder/page container check |
# End modifiable folder/page container check |
} |
} |
# End course context |
# End course context |
|
|
# Prepare the rest of the buttons |
# Prepare the rest of the buttons |
Line 712 ENDMENUITEMS
|
Line 723 ENDMENUITEMS
|
undef($menuitems); |
undef($menuitems); |
} |
} |
} |
} |
if (ref($bread_crumbs) eq 'ARRAY') { |
if (ref($bread_crumbs) eq 'ARRAY') { |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
foreach my $crumb (@{$bread_crumbs}){ |
foreach my $crumb (@{$bread_crumbs}){ |
&Apache::lonhtmlcommon::add_breadcrumb($crumb); |
&Apache::lonhtmlcommon::add_breadcrumb($crumb); |
} |
|
} |
} |
|
} |
} elsif ( defined($env{'request.course.id'}) && |
} elsif ( defined($env{'request.course.id'}) && |
$env{'request.symb'} ne '' ) { |
$env{'request.symb'} ne '' ) { |
# |
# |
Line 1221 sub prepare_functions {
|
Line 1232 sub prepare_functions {
|
# Determine whether or not to display 'Edit' icon/button |
# Determine whether or not to display 'Edit' icon/button |
# |
# |
if ($resurl =~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) { |
if ($resurl =~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) { |
if ($resurl =~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) { |
|
my $file=&Apache::lonnet::declutter($env{'request.filename'}); |
my $file=&Apache::lonnet::declutter($env{'request.filename'}); |
($cfile,$home,$switchserver,$forceedit,$forceview) = |
($cfile,$home,$switchserver,$forceedit,$forceview) = |
&Apache::lonnet::can_edit_resource($file,$cnum,$cdom, |
&Apache::lonnet::can_edit_resource($file,$cnum,$cdom, |