--- loncom/interface/londocs.pm 2006/07/20 20:42:48 1.242 +++ loncom/interface/londocs.pm 2006/11/30 23:34:38 1.262 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.242 2006/07/20 20:42:48 www Exp $ +# $Id: londocs.pm,v 1.262 2006/11/30 23:34:38 banghart Exp $ # # Copyright Michigan State University Board of Trustees # @@ -33,16 +33,15 @@ use Apache::Constants qw(:common :http); use Apache::imsexport; use Apache::lonnet; use Apache::loncommon; -use Apache::lonratedt; -use Apache::lonratsrv; +use LONCAPA::map(); +use Apache::lonratedt(); use Apache::lonxml; -use Apache::loncreatecourse; +use Apache::lonclonecourse; use Apache::lonnavmaps; use HTML::Entities; use GDBM_File; use Apache::lonlocal; use Cwd; -use lib '/home/httpd/lib/perl/'; use LONCAPA; my $iconpath; @@ -58,7 +57,7 @@ my $hadchanges; my %help=(); -# Mapread read maps into lonratedt::global arrays +# Mapread read maps into LONCAPA::map:: global arrays # @order and @resources, determines status # sets @order - pointer to resources in right order # sets @resources - array with the resources with correct idx @@ -67,15 +66,15 @@ my %help=(); sub mapread { my ($coursenum,$coursedom,$map)=@_; return - &Apache::lonratedt::mapread('/uploaded/'.$coursedom.'/'.$coursenum.'/'. - $map); + &LONCAPA::map::mapread('/uploaded/'.$coursedom.'/'.$coursenum.'/'. + $map); } sub storemap { my ($coursenum,$coursedom,$map)=@_; my ($outtext,$errtext)= - &Apache::lonratedt::storemap('/uploaded/'.$coursedom.'/'.$coursenum.'/'. - $map,1); + &LONCAPA::map::storemap('/uploaded/'.$coursedom.'/'.$coursenum.'/'. + $map,1); if ($errtext) { return ($errtext,2); } $hadchanges=1; @@ -148,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'}; @@ -186,13 +186,13 @@ sub dumpcourse { $r->print('
'.$_.' => '.$newfilename.': '); if (my $fh=Apache::File->new('>'.$path.'/'.$newfilename)) { if ($_=~/\.(sequence|page|html|htm|xml|xhtml)$/) { - print $fh &Apache::loncreatecourse::rewritefile( - &Apache::loncreatecourse::readfile($env{'request.course.id'},$_), + print $fh &Apache::lonclonecourse::rewritefile( + &Apache::lonclonecourse::readfile($env{'request.course.id'},$_), (%replacehash,$crs => '') ); } else { print $fh - &Apache::loncreatecourse::readfile($env{'request.course.id'},$_); + &Apache::lonclonecourse::readfile($env{'request.course.id'},$_); } $fh->close(); } else { @@ -230,7 +230,7 @@ sub dumpcourse { $r->print('

'.&mt('Folder in Construction Space').'


'); &tiehash(); $r->print('

'.&mt('Filenames in Construction Space').'

'); - foreach (&Apache::loncreatecourse::crsdirlist($origcrsid,'userfiles')) { + foreach (&Apache::lonclonecourse::crsdirlist($origcrsid,'userfiles')) { $r->print(''); my ($ext)=($_=~/\.(\w+)$/); my $title=$hash{'title_'.$hash{ @@ -316,6 +316,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 { @@ -457,6 +458,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.'
'.&mt('Internal Filename').''.&mt('Title').''.&mt('Save as ...').'
'.$_.'
'. '

'. ''. $name.'' }); + $plain.=$name.' > '; } + $plain=~s/\>\;\s*$//; return (&Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'nohelp', - 'LC_docs_path'),$randompick,$ishidden,$isencrypted); + 'LC_docs_path'),$randompick,$ishidden,$isencrypted,$plain); +} + +sub log_docs { + return &Apache::lonnet::instructor_log('docslog',@_); +} + +{ + my @oldresources=(); + my @oldorder=(); + my $parmidx; + my %parmaction=(); + my %parmvalue=(); + my $changedflag; + + sub snapshotbefore { + @oldresources=@LONCAPA::map::resources; + @oldorder=@LONCAPA::map::order; + $parmidx=undef; + %parmaction=(); + %parmvalue=(); + $changedflag=0; + } + + sub remember_parms { + my ($idx,$parameter,$action,$value)=@_; + $parmidx=$idx; + $parmaction{$parameter}=$action; + $parmvalue{$parameter}=$value; + $changedflag=1; + } + + sub log_differences { + my ($plain)=@_; + my %storehash=('folder' => $plain, + 'currentfolder' => $env{'form.folder'}); + if ($parmidx) { + $storehash{'parameter_res'}=$oldresources[$parmidx]; + foreach my $parm (keys %parmaction) { + $storehash{'parameter_action_'.$parm}=$parmaction{$parm}; + $storehash{'parameter_value_'.$parm}=$parmvalue{$parm}; + } + } + my $maxidx=$#oldresources; + if ($#LONCAPA::map::resources>$#oldresources) { + $maxidx=$#LONCAPA::map::resources; + } + for (my $idx=0; $idx<=$maxidx; $idx++) { + if ($LONCAPA::map::resources[$idx] ne $oldresources[$idx]) { + $storehash{'before_resources_'.$idx}=$oldresources[$idx]; + $storehash{'after_resources_'.$idx}=$LONCAPA::map::resources[$idx]; + $changedflag=1; + } + if ($LONCAPA::map::order[$idx] ne $oldorder[$idx]) { + $storehash{'before_order_res_'.$idx}=$oldresources[$oldorder[$idx]]; + $storehash{'after_order_res_'.$idx}=$LONCAPA::map::resources[$LONCAPA::map::order[$idx]]; + $changedflag=1; + } + } + $storehash{'maxidx'}=$maxidx; + if ($changedflag) { &log_docs(\%storehash); } + } +} + + +# +# Docs Change Log +# +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'}); + + if ((keys(%docslog))[0]=~/^error\:/) { undef(%docslog); } + + $r->print(''. + ''); + + my %saveable_parameters = ('show' => 'scalar',); + &Apache::loncommon::store_course_settings('docs_log', + \%saveable_parameters); + &Apache::loncommon::restore_course_settings('docs_log', + \%saveable_parameters); + if (!$env{'form.show'}) { $env{'form.show'}=10; } + my %lt=('hiddenresource' => 'Resources hidden', + 'encrypturl' => 'URL hidden', + 'randompick' => 'Randomly pick', + 'set' => 'set to', + 'del' => 'deleted'); + $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').''. + &mt('After').''. + &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'}); + my $plainname = + &Apache::loncommon::plainname($docslog{$id}{'exe_uname'}, + $docslog{$id}{'exe_udom'}); + my $about_me_link = + &Apache::loncommon::aboutmewrapper($plainname, + $docslog{$id}{'exe_uname'}, + $docslog{$id}{'exe_udom'}); + my $send_msg_link=''; + if ((($docslog{$id}{'exe_uname'} ne $env{'user.name'}) + || ($docslog{$id}{'exe_udom'} ne $env{'user.domain'}))) { + $send_msg_link ='
'. + &Apache::loncommon::messagewrapper(&mt('Send message'), + $docslog{$id}{'exe_uname'}, + $docslog{$id}{'exe_udom'}); + } + $r->print(&Apache::loncommon::start_data_table_row()); + $r->print(''.$time.' + '.$about_me_link. + '
'.$docslog{$id}{'exe_uname'}. + ':'.$docslog{$id}{'exe_udom'}.''. + $send_msg_link.''. + $docslog{$id}{'logentry'}{'folder'}.''); +# Before + for (my $idx=0;$idx<=$docslog{$id}{'logentry'}{'maxidx'};$idx++) { + my $oldname=(split(/\:/,$docslog{$id}{'logentry'}{'before_resources_'.$idx}))[0]; + my $newname=(split(/\:/,$docslog{$id}{'logentry'}{'after_resources_'.$idx}))[0]; + if ($oldname ne $newname) { + $r->print(&LONCAPA::map::qtescape($oldname)); + } + } + $r->print(''); +# After + $r->print(''); + + for (my $idx=0;$idx<=$docslog{$id}{'logentry'}{'maxidx'};$idx++) { + my $oldname=(split(/\:/,$docslog{$id}{'logentry'}{'before_resources_'.$idx}))[0]; + my $newname=(split(/\:/,$docslog{$id}{'logentry'}{'after_resources_'.$idx}))[0]; + if ($oldname ne $newname) { + $r->print(&LONCAPA::map::qtescape($newname)); + } + } + $r->print(''); + if ($docslog{$id}{'logentry'}{'parameter_res'}) { + $r->print(&LONCAPA::map::qtescape((split(/\:/,$docslog{$id}{'logentry'}{'parameter_res'}))[0]).':'); + } +# End + $r->print(''.&Apache::loncommon::end_data_table_row()); + $shown++; + if (!($env{'form.show'} eq &mt('all') + || $shown<=$env{'form.show'})) { last; } + } + $r->print(&Apache::loncommon::end_data_table()); + $r->print(&Apache::loncommon::end_page()); } sub editor { @@ -1002,19 +1197,19 @@ sub editor { } ($errtext,$fatal)= &mapread($coursenum,$coursedom,$folder.'.'.$container); - if ($#Apache::lonratedt::order<1) { - my $idx=&Apache::lonratedt::getresidx(); + if ($#LONCAPA::map::order<1) { + my $idx=&LONCAPA::map::getresidx(); if ($idx<=0) { $idx=1; } - $Apache::lonratedt::order[0]=$idx; - $Apache::lonratedt::resources[$idx]=''; + $LONCAPA::map::order[0]=$idx; + $LONCAPA::map::resources[$idx]=''; } if (defined($env{'form.markcopy'})) { # Mark for copying - my ($title,$url)=split(':',$Apache::lonratedt::resources[$Apache::lonratedt::order[$env{'form.markcopy'}]]); + my ($title,$url)=split(':',$LONCAPA::map::resources[$LONCAPA::map::order[$env{'form.markcopy'}]]); $env{'form.markedcopy_title'}=$title; $env{'form.markedcopy_url'}=$url; } - my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted)=&breadcrumbs($folder); + my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain)=&breadcrumbs($folder); $r->print($breadcrumbtrail); if ($fatal) { $r->print('

'.$errtext.'

'); @@ -1024,68 +1219,85 @@ sub editor { # ---------------- if they are for this folder and user allowed to make changes if (($allowed) && ($env{'form.folder'} eq $folder)) { # set parameters and change order - if (defined($env{'form.setparms'})) { + &snapshotbefore(); + if ($env{'form.changeparms'}) { my $idx=$env{'form.setparms'}; # set parameters - if ($env{'form.randpick_'.$idx}) { - &Apache::lonratedt::storeparameter($idx,'parameter_randompick',$env{'form.randpick_'.$idx},'int_pos'); - } else { - &Apache::lonratedt::delparameter($idx,'parameter_randompick'); + if ($env{'form.changeparms'} eq 'randompick') { + if ($env{'form.randpick_'.$idx}) { + &LONCAPA::map::storeparameter($idx,'parameter_randompick',$env{'form.randpick_'.$idx},'int_pos'); + &remember_parms($idx,'randompick','set',$env{'form.randpick_'.$idx}); + } else { + &LONCAPA::map::delparameter($idx,'parameter_randompick'); + &remember_parms($idx,'randompick','del'); + } } - if ($env{'form.hidprs_'.$idx}) { - &Apache::lonratedt::storeparameter($idx,'parameter_hiddenresource','yes','string_yesno'); - } else { - &Apache::lonratedt::delparameter($idx,'parameter_hiddenresource'); + if ($env{'form.changeparms'} eq 'hiddenresource') { + if ($env{'form.hidprs_'.$idx}) { + &LONCAPA::map::storeparameter($idx,'parameter_hiddenresource','yes','string_yesno'); + &remember_parms($idx,'hiddenresource','set',$env{'form.hidprs_'.$idx}); + } else { + &LONCAPA::map::delparameter($idx,'parameter_hiddenresource'); + &remember_parms($idx,'hiddenresource','del'); + } } - if ($env{'form.encprs_'.$idx}) { - &Apache::lonratedt::storeparameter($idx,'parameter_encrypturl','yes','string_yesno'); - } else { - &Apache::lonratedt::delparameter($idx,'parameter_encrypturl'); + if ($env{'form.changeparms'} eq 'encrypturl') { + if ($env{'form.encprs_'.$idx}) { + &LONCAPA::map::storeparameter($idx,'parameter_encrypturl','yes','string_yesno'); + &remember_parms($idx,'encrypturl','set',$env{'form.encprs_'.$idx}); + } else { + &LONCAPA::map::delparameter($idx,'parameter_encrypturl'); + &remember_parms($idx,'encrypturl','del'); + } + } +# store the changed version + ($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container); + if ($fatal) { + $r->print('

'.$errtext.'

'); + return; } + } - if ($env{'form.newpos'}) { + if ($env{'form.newpos'}) { # change order - - my $newpos=$env{'form.newpos'}-1; - my $currentpos=$env{'form.currentpos'}-1; - my $i; - my @neworder=(); - if ($newpos>$currentpos) { + my $newpos=$env{'form.newpos'}-1; + my $currentpos=$env{'form.currentpos'}-1; + my $i; + my @neworder=(); + if ($newpos>$currentpos) { # moving stuff up - for ($i=0;$i<$currentpos;$i++) { - $neworder[$i]=$Apache::lonratedt::order[$i]; - } - for ($i=$currentpos;$i<$newpos;$i++) { - $neworder[$i]=$Apache::lonratedt::order[$i+1]; - } - $neworder[$newpos]=$Apache::lonratedt::order[$currentpos]; - for ($i=$newpos+1;$i<=$#Apache::lonratedt::order;$i++) { - $neworder[$i]=$Apache::lonratedt::order[$i]; - } - } else { + for ($i=0;$i<$currentpos;$i++) { + $neworder[$i]=$LONCAPA::map::order[$i]; + } + for ($i=$currentpos;$i<$newpos;$i++) { + $neworder[$i]=$LONCAPA::map::order[$i+1]; + } + $neworder[$newpos]=$LONCAPA::map::order[$currentpos]; + for ($i=$newpos+1;$i<=$#LONCAPA::map::order;$i++) { + $neworder[$i]=$LONCAPA::map::order[$i]; + } + } else { # moving stuff down - for ($i=0;$i<$newpos;$i++) { - $neworder[$i]=$Apache::lonratedt::order[$i]; - } - $neworder[$newpos]=$Apache::lonratedt::order[$currentpos]; - for ($i=$newpos+1;$i<$currentpos+1;$i++) { - $neworder[$i]=$Apache::lonratedt::order[$i-1]; - } - for ($i=$currentpos+1;$i<=$#Apache::lonratedt::order;$i++) { - $neworder[$i]=$Apache::lonratedt::order[$i]; - } + for ($i=0;$i<$newpos;$i++) { + $neworder[$i]=$LONCAPA::map::order[$i]; + } + $neworder[$newpos]=$LONCAPA::map::order[$currentpos]; + for ($i=$newpos+1;$i<$currentpos+1;$i++) { + $neworder[$i]=$LONCAPA::map::order[$i-1]; + } + for ($i=$currentpos+1;$i<=$#LONCAPA::map::order;$i++) { + $neworder[$i]=$LONCAPA::map::order[$i]; } - @Apache::lonratedt::order=@neworder; } + @LONCAPA::map::order=@neworder; # store the changed version - ($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container); if ($fatal) { $r->print('

'.$errtext.'

'); return; } - } + if ($env{'form.pastemarked'}) { # paste resource to end of list my $url=$env{'form.markedcopy_url'}; @@ -1098,7 +1310,7 @@ sub editor { my $newurl=$1.$newid.'.'.$2; my $storefn=$newurl; $storefn=~s/^\/\w+\/\w+\/\w+\///; - &Apache::loncreatecourse::writefile + &Apache::lonclonecourse::writefile ($env{'request.course.id'},$storefn, &Apache::lonnet::getfile($url)); $url=$newurl; @@ -1110,10 +1322,10 @@ sub editor { if ($url=~/^http\:\/\//) { $ext='true'; } $url=~s/\:/\:/g; # Now insert the URL at the bottom - my $newidx=&Apache::lonratedt::getresidx($url); - $Apache::lonratedt::resources[$newidx]= + my $newidx=&LONCAPA::map::getresidx($url); + $LONCAPA::map::resources[$newidx]= $title.':'.$url.':'.$ext.':normal:res'; - $Apache::lonratedt::order[1+$#Apache::lonratedt::order]=$newidx; + $LONCAPA::map::order[1+$#LONCAPA::map::order]=$newidx; # Store the result ($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container); if ($fatal) { @@ -1126,54 +1338,48 @@ sub editor { if ($env{'form.cmd'}) { my ($cmd,$idx)=split(/\_/,$env{'form.cmd'}); if ($cmd eq 'del') { - my (undef,$url)=split(':',$Apache::lonratedt::resources[$Apache::lonratedt::order[$idx]]); + my (undef,$url)=split(':',$LONCAPA::map::resources[$LONCAPA::map::order[$idx]]); if (($url=~m|/+uploaded/\Q$coursedom\E/\Q$coursenum\E/|) && ($url!~/\.(page|sequence|problem|exam|quiz|assess|survey|form|library|task)$/)) { &Apache::lonnet::removeuploadedurl($url); } else { - &Apache::lonratedt::makezombie($Apache::lonratedt::order[$idx]); + &LONCAPA::map::makezombie($LONCAPA::map::order[$idx]); } - for (my $i=$idx;$i<$#Apache::lonratedt::order;$i++) { - $Apache::lonratedt::order[$i]= - $Apache::lonratedt::order[$i+1]; + for (my $i=$idx;$i<$#LONCAPA::map::order;$i++) { + $LONCAPA::map::order[$i] = $LONCAPA::map::order[$i+1]; } - $#Apache::lonratedt::order--; + $#LONCAPA::map::order--; } elsif ($cmd eq 'cut') { - my (undef,$url)=split(':',$Apache::lonratedt::resources[$Apache::lonratedt::order[$idx]]); - &Apache::lonratedt::makezombie($Apache::lonratedt::order[$idx]); - for (my $i=$idx;$i<$#Apache::lonratedt::order;$i++) { - $Apache::lonratedt::order[$i]= - $Apache::lonratedt::order[$i+1]; + my (undef,$url)=split(':',$LONCAPA::map::resources[$LONCAPA::map::order[$idx]]); + &LONCAPA::map::makezombie($LONCAPA::map::order[$idx]); + for (my $i=$idx;$i<$#LONCAPA::map::order;$i++) { + $LONCAPA::map::order[$i] = $LONCAPA::map::order[$i+1]; } - $#Apache::lonratedt::order--; + $#LONCAPA::map::order--; } elsif ($cmd eq 'up') { - if (($idx) && (defined($Apache::lonratedt::order[$idx-1]))) { - my $i=$Apache::lonratedt::order[$idx-1]; - $Apache::lonratedt::order[$idx-1]= - $Apache::lonratedt::order[$idx]; - $Apache::lonratedt::order[$idx]=$i; + if (($idx) && (defined($LONCAPA::map::order[$idx-1]))) { + my $i=$LONCAPA::map::order[$idx-1]; + $LONCAPA::map::order[$idx-1] = $LONCAPA::map::order[$idx]; + $LONCAPA::map::order[$idx] = $i; } } elsif ($cmd eq 'down') { - if (defined($Apache::lonratedt::order[$idx+1])) { - my $i=$Apache::lonratedt::order[$idx+1]; - $Apache::lonratedt::order[$idx+1]= - $Apache::lonratedt::order[$idx]; - $Apache::lonratedt::order[$idx]=$i; + if (defined($LONCAPA::map::order[$idx+1])) { + my $i=$LONCAPA::map::order[$idx+1]; + $LONCAPA::map::order[$idx+1] = $LONCAPA::map::order[$idx]; + $LONCAPA::map::order[$idx] = $i; } } elsif ($cmd eq 'rename') { - my $ratstr = $Apache::lonratedt::resources[$Apache::lonratedt::order[$idx]]; + my $ratstr = $LONCAPA::map::resources[$LONCAPA::map::order[$idx]]; my ($rtitle,@rrest)=split(/\:/, - $Apache::lonratedt::resources[ - $Apache::lonratedt::order[$idx]]); + $LONCAPA::map::resources[$LONCAPA::map::order[$idx]]); my $comment= &HTML::Entities::decode($env{'form.title'}); $comment=~s/\/\>\;/g; $comment=~s/\:/\:/g; if ($comment=~/\S/) { - $Apache::lonratedt::resources[ - $Apache::lonratedt::order[$idx]]= - $comment.':'.join(':',@rrest); + $LONCAPA::map::resources[$LONCAPA::map::order[$idx]]= + $comment.':'.join(':',@rrest); } # Devalidate title cache my $renamed_url=$rrest[0]; @@ -1192,7 +1398,7 @@ sub editor { # Group import/search if ($env{'form.importdetail'}) { my @imports; - &Apache::lonnet::logthis("imp detail ".$env{'form.importdetail'}); +# &Apache::lonnet::logthis("imp detail ".$env{'form.importdetail'}); foreach (split(/\&/,$env{'form.importdetail'})) { if (defined($_)) { my ($name,$url)=split(/\=/,$_); @@ -1202,7 +1408,7 @@ sub editor { } } # Store the changed version - ($errtext,$fatal)=group_import($coursenum, $coursedom, $folder, + ($errtext,$fatal)=&group_import($coursenum, $coursedom, $folder, $container,'londocs',@imports); if ($fatal) { $r->print('

'.$errtext.'

'); @@ -1214,10 +1420,9 @@ sub editor { if ($env{'form.importmap'}=~/\w/) { foreach (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$env{'form.importmap'}))) { my ($title,$url,$ext,$type)=split(/\:/,$_); - my $idx=&Apache::lonratedt::getresidx($url); - $Apache::lonratedt::resources[$idx]=$_; - $Apache::lonratedt::order - [$#Apache::lonratedt::order+1]=$idx; + my $idx=&LONCAPA::map::getresidx($url); + $LONCAPA::map::resources[$idx]=$_; + $LONCAPA::map::order[$#LONCAPA::map::order+1]=$idx; } # Store the changed version ($errtext,$fatal)=&storemap($coursenum,$coursedom, @@ -1230,6 +1435,7 @@ sub editor { $r->print('

'.&mt('No map selected.').'

'); } } + &log_differences($plain); } # ---------------------------------------------------------------- End commands # ---------------------------------------------------------------- Print screen @@ -1246,10 +1452,10 @@ sub editor { $r->print('

'.&mt('Caution: this folder is set to randomly pick a subset of resources. Adding or removing resources from this folder will change the set of resources that the students see, resulting in spurious or missing credit for completed problems, not limited to ones you modify. Do not modify the contents of this folder if it is in active student use.').'

'); } $r->print(''); - foreach (@Apache::lonratedt::order) { - my ($name,$url)=split(/\:/,$Apache::lonratedt::resources[$_]); - $name=&Apache::lonratsrv::qtescape($name); - $url=&Apache::lonratsrv::qtescape($url); + foreach (@LONCAPA::map::order) { + my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$_]); + $name=&LONCAPA::map::qtescape($name); + $url=&LONCAPA::map::qtescape($url); unless ($name) { $name=(split(/\//,$url))[-1]; } unless ($name) { $idx++; next; } $r->print(&entryline($idx,$name,$url,$folder,$allowed,$_,$coursenum)); @@ -1307,9 +1513,9 @@ sub process_file_upload { } ($errtext,$fatal)= &mapread($coursenum,$coursedom,$folder.'.'.$container); - if ($#Apache::lonratedt::order<1) { - $Apache::lonratedt::order[0]=1; - $Apache::lonratedt::resources[1]=''; + if ($#LONCAPA::map::order<1) { + $LONCAPA::map::order[0]=1; + $LONCAPA::map::resources[1]=''; } if ($fatal) { return 'failed'; @@ -1325,7 +1531,7 @@ sub process_file_upload { } # 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 $newidx=&Apache::lonratedt::getresidx(); + my $newidx=&LONCAPA::map::getresidx(); $destination .= $newidx; my $url=&Apache::lonnet::userfileupload('uploaddoc',1,$destination, $parseaction,$allfiles, @@ -1342,9 +1548,9 @@ sub process_file_upload { $env{'user.domain'}.'___&&&___'.$comment; } - $Apache::lonratedt::resources[$newidx]= - $comment.':'.$url.':'.$ext.':normal:res'; - $Apache::lonratedt::order[$#Apache::lonratedt::order+1]= $newidx; + $LONCAPA::map::resources[$newidx]= + $comment.':'.$url.':'.$ext.':normal:res'; + $LONCAPA::map::order[$#LONCAPA::map::order+1]= $newidx; ($errtext,$fatal)=&storemap($coursenum,$coursedom, $folder.'.'.$container); if ($fatal) { @@ -1425,7 +1631,7 @@ sub entryline { my $renametitle=$title; my $foldertitle=$title; my $pagetitle=$title; - my $orderidx=$Apache::lonratedt::order[$index]; + my $orderidx=$LONCAPA::map::order[$index]; if ($title=~ /^(\d+)___&&&___(\w+)___&&&___(\w+)___&&&___(.*)$/ ) { $foldertitle=&Apache::lontexconvert::msgtexconverted($4); $renametitle=$4; @@ -1461,17 +1667,17 @@ sub entryline { my $incindex=$index+1; my $selectbox=''; if (($folder!~/^supplemental/) && - ($#Apache::lonratedt::order>0) && + ($#LONCAPA::map::order>0) && ((split(/\:/, - $Apache::lonratedt::resources[$Apache::lonratedt::order[0]]))[1] + $LONCAPA::map::resources[$LONCAPA::map::order[0]]))[1] ne '') && ((split(/\:/, - $Apache::lonratedt::resources[$Apache::lonratedt::order[1]]))[1] + $LONCAPA::map::resources[$LONCAPA::map::order[1]]))[1] ne '')) { $selectbox= ''. ' +
@@ -1543,6 +1750,7 @@ ENDCOPY + + + ENDPARMS } @@ -1795,6 +2003,7 @@ sub list_symbs { my ($r) = @_; $r->print(&Apache::loncommon::start_page('Symb List')); + $r->print(&Apache::lonhtmlcommon::breadcrumbs('Symb List')); my $navmap = Apache::lonnavmaps::navmap->new(); $r->print("
\n");
     foreach my $res ($navmap->retrieveResources()) {
@@ -1814,6 +2023,7 @@ sub verifycontent {
    my $loaderror=&Apache::lonnet::overloaderror($r);
    if ($loaderror) { return $loaderror; }
    $r->print(&Apache::loncommon::start_page('Verify '.$type.' Documents'));
+   $r->print(&Apache::lonhtmlcommon::breadcrumbs('Verify '.$type.' Documents'));
    $hashtied=0;
    undef %alreadyseen;
    %alreadyseen=();
@@ -1849,6 +2059,7 @@ sub checkversions {
     my ($r) = @_;
     my $type = &Apache::loncommon::course_type();
     $r->print(&Apache::loncommon::start_page("Check $type Document Versions"));
+    $r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $type Document Versions"));
     my $header='';
     my $startsel='';
     my $monthsel='';
@@ -2140,6 +2351,22 @@ sub changewarning {
 $help{'Caching'}.''."\n\n");
 }
 
+# =========================================== Breadcrumbs for special functions
+
+sub init_breadcrumbs {
+    my ($form,$text)=@_;
+    &Apache::lonhtmlcommon::clear_breadcrumbs();
+    &Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs",
+					    text=>&Apache::loncommon::course_type()." Documents",
+					    faq=>273,
+					    bug=>'Instructor Interface',
+                                            help => 'Docs_Adding_Course_Doc'});
+    &Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs?".$form.'=1',
+					    text=>$text,
+					    faq=>273,
+					    bug=>'Instructor Interface'});
+}
+
 # ================================================================ Main Handler
 sub handler {
     my $r = shift;
@@ -2168,20 +2395,28 @@ sub handler {
 		    'Docs_About_Bulletin_Board,Docs_Editing_Templated_Pages');
     $help{'My Personal Info'} = &Apache::loncommon::help_open_topic(
 		  'Docs_About_My_Personal_Info,Docs_Editing_Templated_Pages');
+    $help{'Group Files'} = &Apache::loncommon::help_open_topic('Docs_About_Group_Files');
     $help{'Caching'} = &Apache::loncommon::help_open_topic('Caching');
 
 # does this user have privileges to modify docs
     my $allowed=&Apache::lonnet::allowed('mdc',$env{'request.course.id'});
-
   if ($allowed && $env{'form.verify'}) {
+      &init_breadcrumbs('verify','Verify Content');
       &verifycontent($r);
   } elsif ($allowed && $env{'form.listsymbs'}) {
+      &init_breadcrumbs('listsymbs','List Symbs');
       &list_symbs($r);
+  } elsif ($allowed && $env{'form.docslog'}) {
+      &init_breadcrumbs('docslog','Show Log');
+      &docs_change_log($r);
   } elsif ($allowed && $env{'form.versions'}) {
+      &init_breadcrumbs('versions','Check/Set Resource Versions');
       &checkversions($r);
   } elsif ($allowed && $env{'form.dumpcourse'}) {
+      &init_breadcrumbs('dumpcourse','Dump '.&Apache::loncommon::course_type().' DOCS to Construction Space');
       &dumpcourse($r);
   } elsif ($allowed && $env{'form.exportcourse'}) {
+      &init_breadcrumbs('exportcourse','Export '.&Apache::loncommon::course_type().' to IMS');
       &exportcourse($r);
   } else {
 # is this a standard course?
@@ -2236,8 +2471,7 @@ sub handler {
 # get personal data 
     my $uname=$env{'user.name'};
     my $udom=$env{'user.domain'};
-    my $plainname=&escape(
-                     &Apache::loncommon::plainname($uname,$udom));
+    my $plainname=&escape(&Apache::loncommon::plainname($uname,$udom));
 
 # graphics settings
 
@@ -2361,6 +2595,7 @@ sub handler {
                 'scuf' => 'Score Upload Form',
                 'bull' => 'Bulletin Board',
                 'mypi' => 'My Personal Info',
+                'grpo' => 'Group Files',
 		'abou' => 'About User',
                 'imsf' => 'Import IMS package',
                 'file' =>  'File',
@@ -2376,6 +2611,7 @@ sub handler {
 					 'vc' => 'Verify Content',
 					 'cv' => 'Check/Set Resource Versions',
 					 'ls' => 'List Symbs',
+                                         'sl' => 'Show Log'
 					  );
 
        my $folderpath=$env{'form.folderpath'};
@@ -2399,7 +2635,7 @@ sub handler {
 $containertag
 
 
- + $uploadtag
@@ -2412,6 +2648,9 @@ $dumpbut $exportbut
@@ -1632,16 +1840,16 @@ END if ($folderpath) { $folderpath.='&' }; # Append randompick number, hidden, and encrypted with ":" to foldername, # so it gets transferred between levels - $folderpath.=$folderarg.'&'.$foldername.':'.(&Apache::lonratedt::getparameter($orderidx, + $folderpath.=$folderarg.'&'.$foldername.':'.(&LONCAPA::map::getparameter($orderidx, 'parameter_randompick'))[0] - .':'.((&Apache::lonratedt::getparameter($orderidx, + .':'.((&LONCAPA::map::getparameter($orderidx, 'parameter_hiddenresource'))[0]=~/^yes$/i) - .':'.((&Apache::lonratedt::getparameter($orderidx, + .':'.((&LONCAPA::map::getparameter($orderidx, 'parameter_encrypturl'))[0]=~/^yes$/i); $url.='folderpath='.&escape($folderpath).$cpinfo; $parameterset=''.&mt('Store').''; @@ -1674,14 +1882,14 @@ END 'hd' => 'Hidden', 'ec' => 'URL hidden'); my $enctext= - ((&Apache::lonratedt::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i?' checked="1"':''); + ((&LONCAPA::map::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i?' checked="1"':''); my $hidtext= - ((&Apache::lonratedt::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i?' checked="1"':''); + ((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i?' checked="1"':''); $line.=(< - - $parameterset + + +
ENDCOURSEVERIFY @@ -2511,7 +2750,7 @@ ENDFORM
$uploadtag - + $help{'Adding_External_Resource'} @@ -2529,7 +2768,7 @@ ENDFORM $r->print(< - + $help{'Adding_Fold
- + $help{'Adding_Page
$uploadtag - + $help{'Syllabus'} @@ -2556,8 +2795,8 @@ value="Syllabus=/public/$coursedom/$cour
$uploadtag - + $help{'Navigate_Content'} @@ -2565,7 +2804,7 @@ $help{'Navigate_Content'}
$uploadtag - + $help{'Simple Page'} @@ -2573,7 +2812,7 @@ onClick="javascript:makesmppage();" /> $
$uploadtag - + $help{'Simple Problem'} @@ -2581,7 +2820,7 @@ onClick="javascript:makesmpproblem();" /
$uploadtag - + @@ -2589,7 +2828,7 @@ onClick="javascript:makedropbox();" />
$uploadtag - + @@ -2598,7 +2837,7 @@ $help{'Score_Upload_Form'}
$uploadtag - + @@ -2607,8 +2846,8 @@ $help{'Bulletin Board'}
$uploadtag - + $help{'My Personal Info'} @@ -2616,19 +2855,28 @@ $help{'My Personal Info'}
$uploadtag - +
+
+$uploadtag + + + +$help{'Group Files'} + +
ENDFORM } if ($env{'form.pagepath'}) { $r->print(< $uploadtag - + $help{'Simple Problem'} @@ -2636,7 +2884,7 @@ onClick="javascript:makesmpproblem();" /
$uploadtag - + @@ -2700,7 +2948,7 @@ $lt{'comment'}:
- + $help{'Adding_Fol
- + $help{'Adding_Ext
- + $help{'Syllabus'} @@ -2727,8 +2975,8 @@ $help{'Syllabus'}
- + $help{'My Personal Info'}