--- loncom/interface/lonhtmlcommon.pm 2012/11/16 23:37:16 1.331
+++ loncom/interface/lonhtmlcommon.pm 2012/11/29 20:13:43 1.333
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.331 2012/11/16 23:37:16 raeburn Exp $
+# $Id: lonhtmlcommon.pm,v 1.333 2012/11/29 20:13:43 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1505,6 +1505,7 @@ sub show_return_link {
unless ($env{'request.course.id'}) { return 0; }
if ($env{'request.noversionuri'}=~m{^/priv/} ||
$env{'request.uri'}=~m{^/priv/}) { return 1; }
+ return if ($env{'request.noversionuri'} eq '/adm/supplemental');
if (($env{'request.noversionuri'} =~ m{^/adm/(viewclasslist|navmaps)($|\?)})
|| ($env{'request.noversionuri'} =~ m{^/adm/.*/aboutme($|\?)})) {
@@ -1654,7 +1655,7 @@ returns: nothing
if ($env{'request.noversionuri'} =~
m{^/public/($match_domain)/($match_courseid)/syllabus$}) {
unless (($env{'course.'.$env{'request.course.id'}.'.domain'} eq $1) &&
- ($env{'course.'.$env{'request.course.id'}.'.num'} eq $2)) {
+ ($env{'course.'.$env{'request.course.id'}.'.num'} eq $2)) {
$description = 'Menu';
$no_mt_descr = 0;
}
@@ -1883,16 +1884,16 @@ returns: nothing
} # End of scope for @Crumbs
sub docs_breadcrumbs {
- my ($allowed,$crstype,$contenteditor)=@_;
+ my ($allowed,$crstype,$contenteditor,$title,$precleared)=@_;
my ($folderpath,@folders);
if ($env{'form.pagepath'}) {
@folders = split('&',$env{'form.pagepath'});
} else {
- @folders=split('&',$env{'form.folderpath'});
+ @folders = split('&',$env{'form.folderpath'});
}
my $plain='';
my ($randompick,$isencrypted,$ishidden,$is_random_order) = (-1,0,0,0);
- &clear_breadcrumbs();
+ my @docs_crumbs;
while (@folders) {
my $folder=shift(@folders);
my $foldername=shift(@folders);
@@ -1920,28 +1921,44 @@ sub docs_breadcrumbs {
if ($4 ne '') { $is_random_order = 1; }
}
if ($folder eq 'supplemental') {
- $name = &mt('Supplemental '.$crstype.' Content');
+ $name = &mt('Supplemental '.$crstype.' Contents');
}
if ($contenteditor) {
$plain.=$name.' > ';
}
- &add_breadcrumb(
+ push(@docs_crumbs,
{'href' => $url,
'title' => $name,
'text' => $name,
'no_mt' => 1,
});
}
- unless ($contenteditor) {
- if ($env{'httpref.'.$env{'request.noversionuri'}} ne '') {
- &add_breadcrumb({text => 'View Resource'});
+ if ($title) {
+ push(@docs_crumbs,
+ {'title' => $title,
+ 'text' => $title,
+ 'no_mt' => 1,}
+ );
+ }
+ if (wantarray) {
+ unless ($precleared) {
+ &clear_breadcrumbs();
}
+ &add_breadcrumb(@docs_crumbs);
+ if ($contenteditor) {
+ $plain=~s/\>\;\s*$//;
+ }
+ my $menulink = 0;
+ if (!$allowed && !$contenteditor) {
+ $menulink = 1;
+ }
+ return (&breadcrumbs(undef,undef,$menulink,'nohelp',undef,undef,
+ $contenteditor),
+ $randompick,$ishidden,$isencrypted,$plain,
+ $is_random_order);
} else {
- $plain=~s/\>\;\s*$//;
+ return \@docs_crumbs;
}
- return (&breadcrumbs(undef,undef,0,'nohelp',undef,undef,$contenteditor),
- $randompick,$ishidden,$isencrypted,$plain,
- $is_random_order);
}
############################################################
@@ -3091,13 +3108,18 @@ ENDUTILITY
}
sub jump_to_editres {
- my ($cfile,$home,$switchserver,$forceedit,$forcereg,$symb) = @_;
+ my ($cfile,$home,$switchserver,$forceedit,$forcereg,$symb,$folderpath,
+ $title,$idx,$suppurl) = @_;
my $jscall;
if ($switchserver) {
- if ($symb && $home) {
+ if ($home) {
$cfile = '/adm/switchserver?otherserver='.$home.'&role='.
- &HTML::Entities::encode($env{'request.role'},'"<>&').
- '&symb='.&HTML::Entities::encode($symb,'"<>&');
+ &HTML::Entities::encode($env{'request.role'},'"<>&');
+ if ($symb) {
+ $cfile .= '&symb='.&HTML::Entities::encode($symb,'"<>&');
+ } elsif ($folderpath) {
+ $cfile .= '&folderpath='.&HTML::Entities::encode($folderpath,'"<>&');
+ }
if ($forceedit) {
$cfile .= '&forceedit=1';
}
@@ -3109,7 +3131,21 @@ sub jump_to_editres {
} else {
unless ($cfile =~ m{^/priv/}) {
if ($symb) {
- $cfile .= (($cfile=~/\?/)?'&':'?')."symb=$symb";
+ $cfile .= (($cfile=~/\?/)?'&':'?')."symb=$symb";
+ } elsif ($folderpath) {
+ $cfile .= (($cfile=~/\?/)?'&':'?').
+ 'folderpath='.&HTML::Entities::encode(&escape($folderpath),'"<>&');
+ if ($title) {
+ $cfile .= (($cfile=~/\?/)?'&':'?').
+ 'title='.&HTML::Entities::encode(&escape($title),'"<>&');
+ }
+ if ($idx) {
+ $cfile .= (($cfile=~/\?/)?'&':'?').'idx='.$idx;
+ }
+ if ($suppurl) {
+ $cfile .= (($cfile=~/\?/)?'&':'?').
+ 'suppurl='.&HTML::Entities::encode(&escape($suppurl));
+ }
}
if ($forceedit) {
$cfile .= (($cfile=~/\?/)?'&':'?').'forceedit=1';