version 1.390, 2012/11/08 18:37:44
|
version 1.393, 2012/11/27 23:45:08
|
Line 441 sub innerregister {
|
Line 441 sub innerregister {
|
|
|
undef(@inlineremote); |
undef(@inlineremote); |
|
|
my $resurl; |
my ($mapurl,$resurl); |
|
|
if ($env{'request.course.id'} && $env{'request.symb'} eq '') { |
if ($env{'request.course.id'}) { |
$resurl = $env{'request.noversionuri'}; |
if ($env{'request.symb'}) { |
} |
($mapurl, my $rid, $resurl) = &Apache::lonnet::decode_symb(&Apache::lonnet::symbread()); |
|
my $coursetitle = $env{'course.'.$env{'request.course.id'}.'.description'}; |
if ( $env{'request.symb'} && $env{'request.course.id'} ) { |
|
|
|
(my $mapurl, my $rid, $resurl) = &Apache::lonnet::decode_symb(&Apache::lonnet::symbread()); |
|
my $coursetitle = $env{'course.'.$env{'request.course.id'}.'.description'}; |
|
|
|
my $maptitle = &Apache::lonnet::gettitle($mapurl); |
my $maptitle = &Apache::lonnet::gettitle($mapurl); |
my $restitle = &Apache::lonnet::gettitle(&Apache::lonnet::symbread()); |
my $restitle = &Apache::lonnet::gettitle(&Apache::lonnet::symbread()); |
|
|
#SD |
#SD |
#course_type only Course and Community? |
#course_type only Course and Community? |
# |
# |
my @crumbs; |
my @crumbs; |
unless (($forcereg) && ($env{'request.noversionuri'} eq '/adm/navmaps') |
unless (($forcereg) && |
&& ($mapurl eq $env{'course.'.$env{'request.course.id'}.'.url'})) { |
($env{'request.noversionuri'} eq '/adm/navmaps') && |
@crumbs = ({text => Apache::loncommon::course_type() |
($mapurl eq $env{'course.'.$env{'request.course.id'}.'.url'})) { |
. ' Contents', |
@crumbs = ({text => Apache::loncommon::course_type() |
href => "Javascript:gopost('/adm/navmaps','')"}); |
. ' Contents', |
} |
href => "Javascript:gopost('/adm/navmaps','')"}); |
if ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) { |
} |
push(@crumbs, {text => '...', |
if ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) { |
no_mt => 1}); |
push(@crumbs, {text => '...', |
} |
no_mt => 1}); |
|
} |
push @crumbs, {text => $maptitle, no_mt => 1} if ($maptitle |
|
&& $maptitle ne 'default.sequence' |
push @crumbs, {text => $maptitle, no_mt => 1} if ($maptitle |
&& $maptitle ne $coursetitle); |
&& $maptitle ne 'default.sequence' |
|
&& $maptitle ne $coursetitle); |
push @crumbs, {text => $restitle, no_mt => 1} if $restitle; |
|
|
push @crumbs, {text => $restitle, no_mt => 1} if $restitle; |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::add_breadcrumb(@crumbs); |
&Apache::lonhtmlcommon::add_breadcrumb(@crumbs); |
|
} else { |
|
$resurl = $env{'request.noversionuri'}; |
|
my $courseurl = &Apache::lonnet::courseid_to_courseurl($env{'request.course.id'}); |
|
my $crstype = &Apache::loncommon::course_type(); |
|
my $title = &mt('View Resource'); |
|
if ($resurl =~ m{^\Q/uploaded$courseurl/supplemental/\E(default|\d+)/}) { |
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['folderpath','title']); |
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
|
if ($env{'form.title'}) { |
|
$title = $env{'form.title'}; |
|
} |
|
if ($env{'form.folderpath'}) { |
|
my $editbutton = |
|
&prepare_functions($resurl,$forcereg,$group,undef,undef,1); |
|
my ($trail) = |
|
&Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1); |
|
return $trail; |
|
} else { |
|
&Apache::lonhtmlcommon::add_breadcrumb( |
|
{text => "Supplemental $crstype Content", |
|
href => "javascript:gopost('/adm/supplemental','')"}); |
|
$title = &mt('View Resource'); |
|
return &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1); |
|
} |
|
} |
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
|
&Apache::lonhtmlcommon::add_breadcrumb({text => 'View Resource'}); |
|
} |
} elsif (! $const_space){ |
} elsif (! $const_space){ |
#a situation when we're looking at a resource outside of context of a |
#a situation when we're looking at a resource outside of context of a |
#course or construction space (e.g. with cumulative rights) |
#course or construction space (e.g. with cumulative rights) |
Line 492 sub innerregister {
|
Line 516 sub innerregister {
|
|| $forcereg ); |
|| $forcereg ); |
my ($cdom,$cnum,%perms,$cfile,$switchserver,$home,$forceedit, |
my ($cdom,$cnum,%perms,$cfile,$switchserver,$home,$forceedit, |
$forceview,$editbutton); |
$forceview,$editbutton); |
if ($env{'request.noversionuri'} =~ m{^/adm/($match_domain)/($match_username)/aboutme$}) { |
if (($resurl =~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) || |
($cfile,$home,$switchserver,$forceedit,$forceview) = |
($env{'request.role'} !~/^(aa|ca|au)/)) { |
&Apache::lonnet::can_edit_resource($env{'request.noversionuri'},$cnum,$cdom, |
|
&Apache::lonnet::clutter($resurl),$env{'request.symb'},$group); |
|
if (($cfile) && ($home ne '') && ($home ne 'no_host')) { |
|
$editbutton = &get_editbutton($cfile,$home,$switchserver, |
|
$forceedit,$forceview,$forcereg); |
|
} |
|
} elsif ($env{'request.role'} !~/^(aa|ca|au)/) { |
|
$editbutton = &prepare_functions($resurl,$forcereg,$group); |
$editbutton = &prepare_functions($resurl,$forcereg,$group); |
} |
} |
if ($editbutton eq '') { |
if ($editbutton eq '') { |
Line 548 sub innerregister {
|
Line 565 sub innerregister {
|
"gocmd('/adm/parmset','set')", |
"gocmd('/adm/parmset','set')", |
'Content Settings'); |
'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'})) { |
&switch('','',7,4,'docs-22x22.png','Folder/Page Content','parms[_2]', |
my $text = 'Edit Folder'; |
|
if ($mapurl =~ /\.page$/) { |
|
$text = 'Edit Page'; |
|
} |
|
&switch('','',7,4,'docs-22x22.png',$text,'parms[_2]', |
"gocmd('/adm/coursedocs','direct')", |
"gocmd('/adm/coursedocs','direct')", |
'Folder/Page Content'); |
'Folder/Page Content'); |
} |
} |
Line 729 sub get_editbutton {
|
Line 750 sub get_editbutton {
|
my ($cfile,$home,$switchserver,$forceedit,$forceview,$forcereg) = @_; |
my ($cfile,$home,$switchserver,$forceedit,$forceview,$forcereg) = @_; |
my $jscall = |
my $jscall = |
&Apache::lonhtmlcommon::jump_to_editres($cfile,$home,$switchserver, |
&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.title'}),$env{'form.idx'}, |
|
&escape($env{'form.suppurl'})); |
if ($jscall) { |
if ($jscall) { |
my $icon = 'pcstr.png'; |
my $icon = 'pcstr.png'; |
my $label = 'Edit'; |
my $label = 'Edit'; |
Line 745 sub get_editbutton {
|
Line 769 sub get_editbutton {
|
} |
} |
|
|
sub prepare_functions { |
sub prepare_functions { |
my ($resurl,$forcereg,$group,$bread_crumbs,$advtools) = @_; |
my ($resurl,$forcereg,$group,$bread_crumbs,$advtools,$docscrumbs) = @_; |
unless ($env{'request.registered'}) { |
unless ($env{'request.registered'}) { |
undef(@inlineremote); |
undef(@inlineremote); |
} |
} |
Line 763 sub prepare_functions {
|
Line 787 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$}) { |
# |
|
# This applies to a user's own about me page |
|
# |
|
my ($sdom,$sname) = ($1,$2); |
|
my $file=&Apache::lonnet::declutter($env{'request.filename'}); |
my $file=&Apache::lonnet::declutter($env{'request.filename'}); |
if (($sdom eq $env{'user.domain'}) && ($sname eq $env{'user.name'})) { |
($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, |
&Apache::lonnet::clutter($resurl),$env{'request.symb'},$group); |
&Apache::lonnet::clutter($resurl),$env{'request.symb'},$group); |
if (($cfile) && ($home ne '') && ($home ne 'no_host')) { |
$editbutton = &get_editbutton($cfile,$env{'user.home'},$switchserver, |
$editbutton = &get_editbutton($cfile,$home,$switchserver, |
$forceedit,$forceview,$forcereg); |
$forceedit,$forceview,$forcereg); |
} |
} |
} elsif ((!$editbutton) && (!$env{'request.course.id'}) && |
} elsif ((!$env{'request.course.id'}) && |
($env{'user.author'}) && ($env{'request.filename'}) && |
($env{'user.author'}) && ($env{'request.filename'}) && |
($env{'request.role'} !~/^(aa|ca|au)/)) { |
($env{'request.role'} !~/^(aa|ca|au)/)) { |
# |
# |
Line 786 sub prepare_functions {
|
Line 806 sub prepare_functions {
|
($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, |
&Apache::lonnet::clutter($resurl),$env{'request.symb'},$group); |
&Apache::lonnet::clutter($resurl),$env{'request.symb'},$group); |
# Turn the button on or off |
|
if (($cfile) && ($home ne '') && ($home ne 'no_host')) { |
if (($cfile) && ($home ne '') && ($home ne 'no_host')) { |
$editbutton = &get_editbutton($cfile,$home,$switchserver, |
$editbutton = &get_editbutton($cfile,$home,$switchserver, |
$forceedit,$forceview,$forcereg); |
$forceedit,$forceview,$forcereg); |
Line 813 sub prepare_functions {
|
Line 832 sub prepare_functions {
|
$editbutton = &get_editbutton($cfile,$home,$switchserver, |
$editbutton = &get_editbutton($cfile,$home,$switchserver, |
$forceedit,$forceview,$forcereg); |
$forceedit,$forceview,$forcereg); |
} |
} |
|
} elsif (($resurl eq '/adm/extresedit') && |
|
(($env{'form.symb'}) || ($env{'form.folderpath'}))) { |
|
($cfile,$home,$switchserver,$forceedit,$forceview) = |
|
&Apache::lonnet::can_edit_resource($resurl,$cnum,$cdom,$resurl, |
|
$env{'form.symb'}); |
|
if ($cfile ne '') { |
|
$editbutton = &get_editbutton($cfile,$home,$switchserver, |
|
$forceedit,$forceview,$forcereg, |
|
$env{'form.title'},$env{'form.suppurl'}); |
|
} |
} elsif ($resurl !~ m{^adm/($match_domain)/($match_username)/aboutme$}) { |
} elsif ($resurl !~ m{^adm/($match_domain)/($match_username)/aboutme$}) { |
if ($env{'request.filename'}) { |
if ($env{'request.filename'}) { |
my $file=&Apache::lonnet::declutter($env{'request.filename'}); |
my $file=&Apache::lonnet::declutter($env{'request.filename'}); |
Line 828 sub prepare_functions {
|
Line 857 sub prepare_functions {
|
} |
} |
# End determination of 'Edit' icon/button display |
# End determination of 'Edit' icon/button display |
|
|
# This applies to about me page for users in a course |
|
if ($env{'request.course.id'}) { |
if ($env{'request.course.id'}) { |
if ($resurl =~ m{^adm/($match_domain)/($match_username)/aboutme$}) { |
# This applies to about me page for users in a course |
|
if ($resurl =~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) { |
my ($sdom,$sname) = ($1,$2); |
my ($sdom,$sname) = ($1,$2); |
unless (&Apache::lonnet::is_course($sdom,$sname)) { |
unless (&Apache::lonnet::is_course($sdom,$sname)) { |
&switch('','',6,4,'mail-message-new-22x22.png','Message to user', |
&switch('','',6,4,'mail-message-new-22x22.png','Message to user', |
Line 838 sub prepare_functions {
|
Line 867 sub prepare_functions {
|
"go('/adm/email?compose=individual&recname=$sname&recdom=$sdom')", |
"go('/adm/email?compose=individual&recname=$sname&recdom=$sdom')", |
'Send message to specific user'); |
'Send message to specific user'); |
} |
} |
if (&Apache::lonnet::in_course($sdom,$sname,$cdom,$cnum)) { |
my $hideprivileged = 1; |
|
if (&Apache::lonnet::in_course($sdom,$sname,$cdom,$cnum,undef, |
|
$hideprivileged)) { |
foreach my $priv ('vsa','vgr','srm') { |
foreach my $priv ('vsa','vgr','srm') { |
$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 '') { |
Line 865 sub prepare_functions {
|
Line 896 sub prepare_functions {
|
'Add records'); |
'Add records'); |
} |
} |
} |
} |
|
} elsif ($resurl =~ m{^/?adm/viewclasslist}) { |
|
# This applies to viewclasslist page for users in a course |
|
if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) { |
|
&switch('','',6,4,'pparm.png','Settings', |
|
'', |
|
"go('/adm/courseprefs?actions=classlists&phase=display')", |
|
'Student-viewable classlist options'); |
|
} |
|
} |
|
if (($env{'form.folderpath'} =~ /^supplemental/) && |
|
(&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) && |
|
(($resurl =~ m{^/adm/wrapper/ext/}) || |
|
($resurl =~ m{^/uploaded/$cdom/$cnum/supplemental/}) || |
|
($resurl eq '/adm/supplemental'))) { |
|
my @folders=split('&',$env{'form.folderpath'}); |
|
if (@folders > 2) { |
|
my $esc_path=&escape(&HTML::Entities::encode(&escape($env{'form.folderpath'}),'<>&"')); |
|
&switch('','',7,4,'docs-22x22.png','Edit Folder','parms[_2]', |
|
"location.href='/adm/coursedocs?command=direct&forcesupplement=1&supppath=$esc_path'", |
|
'Folder/Page Content'); |
|
} |
} |
} |
} |
} |
|
|
# End checking for items for about me page for users in a course |
# End checking for items for about me page for users in a course |
|
if ($docscrumbs) { |
if ($env{'request.registered'}) { |
&Apache::lonhtmlcommon::clear_breadcrumb_tools(); |
|
&advtools_crumbs(@inlineremote); |
|
return $editbutton; |
|
} elsif ($env{'request.registered'}) { |
return $editbutton; |
return $editbutton; |
} else { |
} else { |
if (ref($bread_crumbs) eq 'ARRAY') { |
if (ref($bread_crumbs) eq 'ARRAY') { |
Line 898 sub advtools_crumbs {
|
Line 953 sub advtools_crumbs {
|
} elsif ($env{'request.noversionuri'} !~ m{^/adm/(navmaps|viewclasslist)(\?|$)}) { |
} elsif ($env{'request.noversionuri'} !~ m{^/adm/(navmaps|viewclasslist)(\?|$)}) { |
&Apache::lonhtmlcommon::add_breadcrumb_tool( |
&Apache::lonhtmlcommon::add_breadcrumb_tool( |
'advtools', @funcs[61,71,72,73,74,92]); |
'advtools', @funcs[61,71,72,73,74,92]); |
|
} elsif ($env{'request.noversionuri'} eq '/adm/viewclasslist') { |
|
&Apache::lonhtmlcommon::add_breadcrumb_tool( |
|
'advtools', @funcs[64]); |
} |
} |
} |
} |
|
|