[LON-CAPA-cvs] cvs: loncom /interface londocs.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Wed, 07 Apr 2004 20:36:54 -0000
albertel Wed Apr 7 16:36:54 2004 EDT
Modified files:
/loncom/interface londocs.pm
Log:
- BUG#1331, now puts breadcrumb paths on DOCS, breaks lots of things (like all of the buttons) but tryin' to make an omlete here
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.113 loncom/interface/londocs.pm:1.114
--- loncom/interface/londocs.pm:1.113 Tue Apr 6 19:05:29 2004
+++ loncom/interface/londocs.pm Wed Apr 7 16:36:54 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.113 2004/04/06 23:05:29 albertel Exp $
+# $Id: londocs.pm,v 1.114 2004/04/07 20:36:54 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -258,11 +258,54 @@
return &storemap($coursenum, $coursedom, $folder.'.sequence');
}
-sub editor {
- my ($r,$coursenum,$coursedom,$folder,$allowed)=@_;
+sub breadcrumbs {
+ my ($where)=@_;
+ &Apache::lonhtmlcommon::clear_breadcrumbs();
+ if ($where =~ /^default/) {
+ &Apache::lonhtmlcommon::add_breadcrumb({'href'=>'/adm/coursedocs',
+ 'title'=>'Main Course Documents',
+ 'text' =>'Main Course Documents'});
+ } elsif ($where =~ /^supplemental/) {
+ &Apache::lonhtmlcommon::add_breadcrumb({'href'=>'/adm/coursedocs',
+ 'title'=>'Supplemental Course Documents',
+ 'text' =>'Supplemental Course Documents'});
+
+ } else {
+ &Apache::lonhtmlcommon::add_breadcrumb({'href'=>'/adm/coursedocs',
+ 'title'=>$where,
+ 'text' =>$where});
+ }
if ($ENV{'form.foldername'}) {
- $r->print('<h3>Folder: '.$ENV{'form.foldername'}.'</h3>');
+ my @folders;
+ if (defined($ENV{'form.folders'})) {
+ @folders=@{$ENV{'form.folders'}};
+ }
+ @folders=(@folders,$ENV{'form.folder'},
+ &Apache::lonnet::escape($ENV{'form.foldername'}));
+
+ my $folderpath;
+ while (@folders) {
+ my $folder=shift(@folders);
+ my $foldername=shift(@folders);
+ if ($folderpath) {$folderpath.='&';}
+ $folderpath.=$folder.'&'.$foldername;
+ my $url='/adm/coursedocs?folderpath='.
+ &Apache::lonnet::escape($folderpath);
+ &Apache::lonhtmlcommon::add_breadcrumb(
+ {'href'=>$url,
+ 'title'=>&Apache::lonnet::unescape($foldername),
+ 'text'=>&Apache::lonnet::unescape($foldername)});
+
+
+ }
}
+ return &Apache::lonhtmlcommon::breadcrumbs();
+}
+
+sub editor {
+ my ($r,$coursenum,$coursedom,$folder,$allowed)=@_;
+
+ $r->print(&breadcrumbs($folder));
my $errtext='';
my $fatal=0;
($errtext,$fatal)=
@@ -455,11 +498,13 @@
my $uploaded=($url=~/^\/*uploaded\//);
my $icon=&Apache::loncommon::icon($url);
my $isfolder=0;
+ my $folderarg;
if ($uploaded) {
if ($extension eq 'sequence') {
$icon=$iconpath.'/folder_closed.gif';
$url=~/$coursenum\/([\/\w]+)\.sequence$/;
- $url='/adm/coursedocs?folder='.$1;
+ $url='/adm/coursedocs?';
+ $folderarg=$1;
$isfolder=1;
} else {
$url=&Apache::lonnet::tokenwrapper($url);
@@ -478,8 +523,13 @@
$url=&Apache::lonnet::clutter($url);
$url.=(($url=~/\?/)?'&':'?').'symb='.&Apache::lonnet::escape($symb);
}
- if ($isfolder) { $url.='&foldername='.
- &Apache::lonnet::escape($foldertitle); }
+ if ($isfolder) {
+ my $foldername=&Apache::lonnet::escape($foldertitle);
+ my $folderpath=$ENV{'form.folderpath'};
+ if ($folderpath) { $folderpath.='&' };
+ $folderpath.=$folderarg.'&'.$foldername;
+ $url.='folderpath='.&Apache::lonnet::escape($folderpath);
+ }
$line.='<td bgcolor="#FFFFBB"><a href="'.$url.'"><img src="'.$icon.
'" border="0"></a></td>'.
"<td bgcolor='#FFFFBB'><a href='$url'>$title</a></td></tr>";
@@ -901,7 +951,13 @@
my $events='';
my $showdoc=0;
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
- ['folder','foldername']);
+ ['folderpath']);
+ if ($ENV{'form.folderpath'}) {
+ my (@folderpath)=split('&',$ENV{'form.folderpath'});
+ $ENV{'form.foldername'}=&Apache::lonnet::unescape(pop(@folderpath));
+ $ENV{'form.folder'}=pop(@folderpath);
+ $ENV{'form.folders'}=\@folderpath;
+ }
if ($r->uri=~/^\/adm\/coursedocs\/showdoc\/(.*)$/) {
$showdoc=$1;
}