--- loncom/interface/londocs.pm 2004/02/27 19:11:08 1.109 +++ loncom/interface/londocs.pm 2004/04/07 21:40:21 1.115 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.109 2004/02/27 19:11:08 albertel Exp $ +# $Id: londocs.pm,v 1.115 2004/04/07 21:40:21 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -258,11 +258,54 @@ sub group_import { 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('

Folder: '.$ENV{'form.foldername'}.'

'); + 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)= @@ -280,7 +323,7 @@ sub editor { # upload a file, if present if (($ENV{'form.uploaddoc.filename'}) && ($ENV{'form.cmd'}=~/^upload_(\w+)/)) { - if ($folder=~/^$1/) { + if ( ($folder=~/^$1/) || ($1 eq 'default') ) { # this is for a course, not a user, so set coursedoc flag # probably the only place in the system where this should be "1" my $url=&Apache::lonnet::userfileupload('uploaddoc',1); @@ -398,7 +441,7 @@ sub editor { my ($name,$url)=split(/\:/,$Apache::lonratedt::resources[$_]); unless ($name) { $name=(split(/\//,$url))[-1]; } unless ($name) { next; } - $r->print(&entryline($idx,$name,$url,$folder,$allowed,$_)); + $r->print(&entryline($idx,$name,$url,$folder,$allowed,$_,$coursenum)); $idx++; } $r->print(''); @@ -408,7 +451,7 @@ sub editor { # --------------------------------------------------------------- An entry line sub entryline { - my ($index,$title,$url,$folder,$allowed,$residx)=@_; + my ($index,$title,$url,$folder,$allowed,$residx,$coursenum)=@_; $title=~s/\&colon\;/\:/g; $title=&HTML::Entities::encode(&HTML::Entities::decode( &Apache::lonnet::unescape($title)),'"<>&\''); @@ -429,24 +472,23 @@ sub entryline { 'dw' => 'Move Down', 'rm' => 'Remove', 'rn' => 'Rename'); - my ($foldername,$htmlfoldername); - if ($ENV{'form.foldername'}) { - $foldername='&foldername='. - &Apache::lonnet::escape($ENV{'form.foldername'}); - $htmlfoldername=&HTML::Entities::encode($ENV{'form.foldername'}); + my $folderpath; + if ($ENV{'form.folderpath'}) { + $folderpath=&Apache::lonnet::escape($ENV{'form.folderpath'}); + # $htmlfoldername=&HTML::Entities::encode($ENV{'form.foldername'},'<>&"'); } $line.=(<
- + $lt{
- + $lt{
- + $lt{'rm'} - + $lt{'rn'} END } @@ -455,32 +497,41 @@ END 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=~/\/(\w+)\.sequence/; - $url='/adm/coursedocs?folder='.$1; + $url=~/$coursenum\/([\/\w]+)\.sequence$/; + $url='/adm/coursedocs?'; + $folderarg=$1; $isfolder=1; } else { $url=&Apache::lonnet::tokenwrapper($url); } } $url=~s/^http\&colon\;\/\//\/adm\/wrapper\/ext\//; - if (($residx) && ($folder!~/supplemental/)) { - $url.=(($url=~/\?/)?'&':'?').'symb='. - &Apache::lonnet::escape(&Apache::lonnet::symbclean( + if ((!$isfolder) && ($residx) && ($folder!~/supplemental/)) { + my $symb=&Apache::lonnet::symbclean( &Apache::lonnet::declutter('uploaded/'. $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}.'/'. $ENV{'course.'.$ENV{'request.course.id'}.'.num'}.'/'.$folder. '.sequence'). '___'.$residx.'___'. - &Apache::lonnet::declutter($url))); - } - if ($isfolder) { $url.='&foldername='. - &Apache::lonnet::escape($foldertitle); } - $line.=''. - "$title"; + &Apache::lonnet::declutter($url)); + (undef,undef,$url)=&Apache::lonnet::decode_symb($symb); + $url=&Apache::lonnet::clutter($url); + $url.=(($url=~/\?/)?'&':'?').'symb='.&Apache::lonnet::escape($symb); + } + 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.=''. + "$title"; return $line; } @@ -644,7 +695,6 @@ sub checkversions { foreach (keys %ENV) { if ($_=~/^form\.set_version_(.+)$/) { my $src=$1; - &Apache::lonnet::logthis('Found: '.$1.' '.$ENV{$_}); if (($ENV{$_}) && ($ENV{$_} ne $setversions{$src})) { $newsetversions{$src}=$ENV{$_}; } @@ -899,7 +949,13 @@ sub handler { 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; } @@ -1013,6 +1069,14 @@ function makeabout() { } } +function makeims() { + var caller = document.forms.ims.folder.value + var newlocation = "/adm/imsimportdocs?folder="+caller+"&phase=one" + newWindow = window.open("","IMSimport","HEIGHT=700,WIDTH=750,scrollbars=yes") + newWindow.location.href = newlocation +} + + function finishpick() { var title=this.document.forms.extimport.title.value; var url=this.document.forms.extimport.url.value; @@ -1022,22 +1086,20 @@ function finishpick() { '";this.document.forms.'+form+'.submit();'); } -function changename(folder,index,oldtitle,foldername) { +function changename(folderpath,index,oldtitle) { var title=prompt('New Title',oldtitle); if (title) { this.document.forms.renameform.title.value=title; this.document.forms.renameform.cmd.value='rename_'+index; - this.document.forms.renameform.folder.value=folder; - this.document.forms.renameform.foldername.value=foldername; + this.document.forms.renameform.folderpath.value=folderpath; this.document.forms.renameform.submit(); } } -function removeres(folder,index,oldtitle,foldername) { +function removeres(folderpath,index,oldtitle) { if (confirm('Remove "'+oldtitle+'"?')) { this.document.forms.renameform.cmd.value='del_'+index; - this.document.forms.renameform.folder.value=folder; - this.document.forms.renameform.foldername.value=foldername; + this.document.forms.renameform.folderpath.value=folderpath; this.document.forms.renameform.submit(); } } @@ -1073,6 +1135,7 @@ ENDNEWSCRIPT 'bull' => 'Bulletin Board', 'mypi' => 'My Personal Info', 'abou' => 'About User', + 'imsf' => 'Import IMS package', 'file' => 'File', 'title' => 'Title', 'comment' => 'Comment' @@ -1088,13 +1151,11 @@ ENDNEWSCRIPT
- - +
- - +
@@ -1110,13 +1171,15 @@ ENDCOURSEVERIFY &mt('Editing the Table of Contents for your Course'))); } # --------------------------------------------------------- Standard documents - my $htmlfoldername=&HTML::Entities::encode($ENV{'form.foldername'}); + #my $htmlfoldername=&HTML::Entities::encode($ENV{'form.foldername'},'<>&"'); $r->print('
'); if (($standard) && ($allowed) && (!$forcesupplement)) { $r->print('

'.&mt('Main Course Documents'). ($allowed?' '.$help{'Main_Course_Documents'}:'').'

'); my $folder=$ENV{'form.folder'}; - unless ($folder=~/^default/) { $folder='default'; } + if ($folder eq '') { + $folder='default'; + } my $postexec=''; if ($folder eq 'default') { $r->print(''); @@ -1143,8 +1206,7 @@ $lt{'file'}:

$lt{'title'}:
- - + @@ -1154,13 +1216,10 @@ $lt{'title'}:
- - - + + - + $help{'Importing_LON-CAPA_Resource'}

@@ -1174,8 +1233,7 @@ $help{'Load_Map'}

- - + $help{'Adding_Fold
- - + $help{'Adding_Ext
- - + @@ -1203,8 +1259,7 @@ value="Syllabus=/public/$coursedom/$cour
- - + @@ -1213,8 +1268,7 @@ $help{'Navigate_Content'}
- - + $
- - +
- - +
- - +
- - + @@ -1261,14 +1311,18 @@ $help{'My Personal Info'}
- - +
+
+ + + +
ENDFORM @@ -1298,8 +1352,8 @@ ENDFORM
$lt{'comment'}:
- - +
+ @@ -1309,8 +1363,7 @@ ENDFORM
- - + $help{'Adding_Fol
- - + $help{'Adding_Ext
- - + @@ -1339,8 +1390,7 @@ $help{'Syllabus'}
- - +