--- loncom/interface/londocs.pm 2006/11/20 17:45:11 1.254 +++ loncom/interface/londocs.pm 2007/07/18 18:36:52 1.278.2.3 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.254 2006/11/20 17:45:11 albertel Exp $ +# $Id: londocs.pm,v 1.278.2.3 2007/07/18 18:36:52 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -42,7 +42,7 @@ use HTML::Entities; use GDBM_File; use Apache::lonlocal; use Cwd; -use LONCAPA; +use LONCAPA qw(:DEFAULT :match); my $iconpath; @@ -99,7 +99,7 @@ sub authorhosts { $ca=$env{'user.name'}; $cd=$env{'user.domain'}; } else { - ($cd,$ca)=($realm=~/^\/(\w+)\/(\w+)$/); + ($cd,$ca)=($realm=~/^\/($match_domain)\/($match_username)$/); } my $allowed=0; my $myhome=&Apache::lonnet::homeserver($ca,$cd); @@ -147,6 +147,7 @@ sub dumpcourse { my $type = &Apache::loncommon::course_type(); $r->print(&Apache::loncommon::start_page('Dump '.$type.' DOCS to Construction Space'). '
'); + $r->print(&Apache::lonhtmlcommon::breadcrumbs('Dump '.$type.' DOCS to Construction Space')); my ($home,$other,%outhash)=&authorhosts(); unless ($home) { return ''; } my $origcrsid=$env{'request.course.id'}; @@ -234,7 +235,6 @@ sub dumpcourse { my ($ext)=($_=~/\.(\w+)$/); my $title=$hash{'title_'.$hash{ 'ids_/uploaded/'.$origcrsdata{'domain'}.'/'.$origcrsdata{'num'}.'/'.$_}}; - $title=~s/:/:/g; $r->print(''.($title?$title:' ').''); if (!$title) { $title=$_; @@ -315,6 +315,7 @@ sub exportcourse { } } $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package')); + $r->print(&Apache::lonhtmlcommon::breadcrumbs('Export '.lc($type).' to IMS content package')); $r->print($outcome); $r->print(&Apache::loncommon::end_page()); } else { @@ -364,7 +365,7 @@ sub exportcourse { if (ref($curRes)) { my $symb = $curRes->symb(); my $ressymb = $symb; - if ($ressymb =~ m|adm/(\w+)/(\w+)/(\d+)/bulletinboard$|) { + if ($ressymb =~ m|adm/($match_domain)/($match_username)/(\d+)/bulletinboard$|) { unless ($ressymb =~ m|adm/wrapper/adm|) { $ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.'/bulletinboard'; } @@ -456,6 +457,7 @@ function containerCheck(item) { |; $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package', $scripttag)); + $r->print(&Apache::lonhtmlcommon::breadcrumbs('Export '.lc($type).' to IMS content package')); $r->print($display.''. '

'. '$url.$cpinfo, 'title'=>$name, 'text'=>''. - $name.'' + $name.'', + 'no_mt'=>1, }); $plain.=$name.' > '; } $plain=~s/\>\;\s*$//; return (&Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'nohelp', - 'LC_docs_path'),$randompick,$ishidden,$isencrypted,$plain); + 'LC_docs_path'),$randompick,$ishidden,$isencrypted,$plain,$is_random_order); } sub log_docs { @@ -1025,7 +1031,8 @@ sub log_docs { sub log_differences { my ($plain)=@_; - my %storehash=('folder' => $plain); + my %storehash=('folder' => $plain, + 'currentfolder' => $env{'form.folder'}); if ($parmidx) { $storehash{'parameter_res'}=$oldresources[$parmidx]; foreach my $parm (keys %parmaction) { @@ -1060,9 +1067,9 @@ sub log_docs { # sub docs_change_log { my ($r)=@_; + my $folder=$env{'form.folder'}; $r->print(&Apache::loncommon::start_page('Course Document Change Log')); $r->print(&Apache::lonhtmlcommon::breadcrumbs('Course Document Change Log')); - my %docslog=&Apache::lonnet::dump('nohist_docslog', $env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'}); @@ -1081,14 +1088,11 @@ sub docs_change_log { my %lt=('hiddenresource' => 'Resources hidden', 'encrypturl' => 'URL hidden', 'randompick' => 'Randomly pick', + 'randomorder' => 'Randomly ordered', 'set' => 'set to', 'del' => 'deleted'); - - my $countselect = - &Apache::lonmeta::selectbox('show',$env{'form.show'},undef, - (&mt('all'),10,20,50,100,1000,10000)); - - $r->print(''.&mt('[_1] Records',$countselect).''. + $r->print(&Apache::loncommon::display_filter(). + ''. '

'); $r->print(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row(). ''.&mt('Time').''.&mt('User').''.&mt('Folder').''.&mt('Before').''. @@ -1096,7 +1100,18 @@ sub docs_change_log { &Apache::loncommon::end_data_table_header_row()); my $shown=0; foreach my $id (sort { $docslog{$b}{'exe_time'}<=>$docslog{$a}{'exe_time'} } (keys(%docslog))) { + if ($env{'form.displayfilter'} eq 'currentfolder') { + if ($docslog{$id}{'logentry'}{'currentfolder'} ne $folder) { next; } + } my @changes=keys(%{$docslog{$id}{'logentry'}}); + if ($env{'form.displayfilter'} eq 'containing') { + my $wholeentry=$docslog{$id}{'exe_uname'}.':'.$docslog{$id}{'exe_udom'}.':'. + &Apache::loncommon::plainname($docslog{$id}{'exe_uname'},$docslog{$id}{'exe_udom'}); + foreach my $key (@changes) { + $wholeentry.=':'.$docslog{$id}{'logentry'}{$key}; + } + if ($wholeentry!~/\Q$env{'form.containingphrase'}\E/i) { next; } + } my $count = 0; my $time = &Apache::lonlocal::locallocaltime($docslog{$id}{'exe_time'}); @@ -1156,7 +1171,7 @@ sub docs_change_log { $r->print(''); if ($docslog{$id}{'logentry'}{'parameter_res'}) { $r->print(&LONCAPA::map::qtescape((split(/\:/,$docslog{$id}{'logentry'}{'parameter_res'}))[0]).':