' + .&mt('Please select at least one option.') + .'
' + .'' + ); + return; } - close(IN); - my $uri='/~'.$uname.$fn; + + my $uri="/priv/$udom/$uname".$fn; my $result=&Apache::lonnet::ssi_body($uri, ('grade_target'=>'web', 'return_only_error_and_warning_counts' => 1)); @@ -310,10 +331,11 @@ sub phasetwo { ($env{'form.symbol'} ne 'on')); my ($main,$ext)=($fn=~/^(.*)\.(\w+)/); my $newfn=$main.'_Auto_Cleaned_Up.'.$ext; - open(OUT,'>/home/httpd/html/priv/'.$udom.'/'.$uname.'/'.$newfn); - print OUT $text; - close(OUT); - my $newuri='/~'.$uname.$newfn; + if (open(OUT,">$londocroot/priv/$udom/$uname".$newfn)) { + print OUT $text; + close(OUT); + } + my $newuri="/priv/$udom/$uname".$newfn; $result=&Apache::lonnet::ssi_body($newuri, ('grade_target'=>'web', 'return_only_error_and_warning_counts' => 1)); @@ -337,8 +359,11 @@ sub phasetwo { .'' - .&mt('Accepting changes') + .&mt('Accepting changes...') .'
' ); move($new,$old); } else { - $r->print( + $r->print( '' - .&mt('Rejecting changes') + .&mt('Rejecting changes...') .'
' - ); + ); unlink($new); } + $r->print( + '' + .&Apache::lonhtmlcommon::confirm_success(&mt('Done'))); + '
' } # ---------------------------------------------------------------- Main Handler @@ -390,7 +419,7 @@ sub handler { if ($env{'form.filename'}) { $fn=$env{'form.filename'}; - $fn=~s/^https?\:\/\/[^\/]+//; + $fn=~s{^https?\://[^/]+}{}; } else { $r->log_reason($env{'user.name'}.' at '.$env{'user.domain'}. ' unspecified filename for cleanup', $r->filename); @@ -407,8 +436,7 @@ sub handler { my $uname; my $udom; - ($uname,$udom)= - &Apache::loncacc::constructaccess($fn,$r->dir_config('lonDefDomain')); + ($uname,$udom)=&Apache::lonnet::constructaccess($fn); unless (($uname) && ($udom)) { $r->log_reason($uname.' at '.$udom. ' trying to cleanup file '.$env{'form.filename'}. @@ -417,17 +445,26 @@ sub handler { return HTTP_NOT_ACCEPTABLE; } - $fn=~s{/~($LONCAPA::username_re)}{}; - &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; # Breadcrumbs - my $brcrum = [{'href' => &Apache::loncommon::authorspace(), - 'text' => 'Construction Space'}, + my $text = 'Authoring Space'; + my $href = &Apache::loncommon::authorspace($fn); + if ($env{'request.course.id'}) { + my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; + my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + if ($href eq "/priv/$cdom/$cnum/") { + $text = 'Course Authoring Space'; + } + } + my $brcrum = [{'href' => $href, + 'text' => $text}, {'href' => '', 'text' => 'Cleanup XML Document'}]; + $fn=~s{^/priv/$LONCAPA::domain_re/$LONCAPA::username_re}{}; + $r->print(&Apache::loncommon::start_page('Cleanup XML Document', undef, {'bread_crumbs' => $brcrum,})); @@ -435,7 +472,7 @@ sub handler { '' - .&Apache::lonhtmlcommon::start_funclist() - .&Apache::lonhtmlcommon::add_item_funclist( - ''.&mt('Back to Source File').'') - .&Apache::lonhtmlcommon::add_item_funclist( - ''.&mt('Back to Source Directory').'') - .&Apache::lonhtmlcommon::end_funclist() + .&Apache::lonhtmlcommon::actionbox( + [''. + &mt('Back to Source File').'', + ''. + &mt('Back to Source Directory').'']) .&Apache::loncommon::end_page() );