--- loncom/interface/lonhtmlcommon.pm 2012/11/08 18:37:44 1.330
+++ loncom/interface/lonhtmlcommon.pm 2012/11/16 23:37:16 1.331
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.330 2012/11/08 18:37:44 raeburn Exp $
+# $Id: lonhtmlcommon.pm,v 1.331 2012/11/16 23:37:16 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1882,6 +1882,68 @@ returns: nothing
} # End of scope for @Crumbs
+sub docs_breadcrumbs {
+ my ($allowed,$crstype,$contenteditor)=@_;
+ my ($folderpath,@folders);
+ if ($env{'form.pagepath'}) {
+ @folders = split('&',$env{'form.pagepath'});
+ } else {
+ @folders=split('&',$env{'form.folderpath'});
+ }
+ my $plain='';
+ my ($randompick,$isencrypted,$ishidden,$is_random_order) = (-1,0,0,0);
+ &clear_breadcrumbs();
+ while (@folders) {
+ my $folder=shift(@folders);
+ my $foldername=shift(@folders);
+ if ($folderpath) {$folderpath.='&';}
+ $folderpath.=$folder.'&'.$foldername;
+ my $url;
+ if ($allowed) {
+ $url = '/adm/coursedocs?folderpath=';
+ } else {
+ $url = '/adm/supplemental?folderpath=';
+ }
+ $url .= &escape($folderpath);
+ my $name=&unescape($foldername);
+# each of randompick number, hidden, encrypted, random order are
+# appended with ":"s to the foldername
+ $name=~s/\:(\d*)\:(\w*)\:(\w*):(\d*)$//;
+ if ($contenteditor) {
+ if ($1 ne '') {
+ $randompick=$1;
+ } else {
+ $randompick=-1;
+ }
+ if ($2) { $ishidden=1; }
+ if ($3) { $isencrypted=1; }
+ if ($4 ne '') { $is_random_order = 1; }
+ }
+ if ($folder eq 'supplemental') {
+ $name = &mt('Supplemental '.$crstype.' Content');
+ }
+ if ($contenteditor) {
+ $plain.=$name.' > ';
+ }
+ &add_breadcrumb(
+ {'href' => $url,
+ 'title' => $name,
+ 'text' => $name,
+ 'no_mt' => 1,
+ });
+ }
+ unless ($contenteditor) {
+ if ($env{'httpref.'.$env{'request.noversionuri'}} ne '') {
+ &add_breadcrumb({text => 'View Resource'});
+ }
+ } else {
+ $plain=~s/\>\;\s*$//;
+ }
+ return (&breadcrumbs(undef,undef,0,'nohelp',undef,undef,$contenteditor),
+ $randompick,$ishidden,$isencrypted,$plain,
+ $is_random_order);
+}
+
############################################################
############################################################