--- loncom/publisher/lonpublisher.pm 2010/01/27 03:44:48 1.258.2.4 +++ loncom/publisher/lonpublisher.pm 2009/07/30 09:42:25 1.262 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Publication Handler # -# $Id: lonpublisher.pm,v 1.258.2.4 2010/01/27 03:44:48 raeburn Exp $ +# $Id: lonpublisher.pm,v 1.262 2009/07/30 09:42:25 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1668,10 +1668,11 @@ sub phasetwo { if (copy($target,$copyfile)) { print $logfile "Copied old target to ".$copyfile."\n"; - $r->print(&Apache::lonhtmlcommon::confirm_success(&mt('Copied old target file'))); + $r->print('

'.&mt('Copied old target file').'

'); } else { print $logfile "Unable to write ".$copyfile.':'.$!."\n"; - $r->print(&Apache::lonhtmlcommon::confirm_success(&mt('Failed to copy old target').", $!",1)); + $r->print("".&mt('Failed to copy old target'). + ", $!, ".&mt('FAIL').""); return 0; } @@ -1681,13 +1682,13 @@ sub phasetwo { if (copy($target.'.meta',$copyfile)) { print $logfile "Copied old target metadata to ".$copyfile."\n"; - $r->print(&Apache::lonhtmlcommon::confirm_success(&mt('Copied old metadata'))); + $r->print('

'.&mt('Copied old metadata').'

') } else { print $logfile "Unable to write metadata ".$copyfile.':'.$!."\n"; if (-e $target.'.meta') { - $r->print(&Apache::lonhtmlcommon::confirm_success( - &mt('Failed to write old metadata copy').", $!",1)); - + $r->print( + "". +&mt('Failed to write old metadata copy').", $!, ".&mt('FAIL').""); return 0; } } @@ -1720,27 +1721,25 @@ sub phasetwo { if (copy($source,$copyfile)) { print $logfile "\nCopied original source to ".$copyfile."\n"; - $r->print(&Apache::lonhtmlcommon::confirm_success(&mt('Copied source file'))); + $r->print('

'.&mt('Copied source file').'

'); } else { print $logfile "\nUnable to write ".$copyfile.':'.$!."\n"; - $r->print(&Apache::lonhtmlcommon::confirm_success( - &mt('Failed to copy source').", $!",1)); + $r->print("". + &mt('Failed to copy source').", $!, ".&mt('FAIL').""); return 0; } - -# ---------------------------------------------- Delete local tmp-preview files - unlink($copyfile.'.tmp'); + # --------------------------------------------------------------- Copy Metadata $copyfile=$copyfile.'.meta'; if (copy($source.'.meta',$copyfile)) { print $logfile "\nCopied original metadata to ".$copyfile."\n"; - $r->print(&Apache::lonhtmlcommon::confirm_success(&mt('Copied metadata'))); + $r->print('

'.&mt('Copied metadata').'

'); } else { print $logfile "\nUnable to write metadata ".$copyfile.':'.$!."\n"; - $r->print(&Apache::lonhtmlcommon::confirm_success( - &mt('Failed to write metadata copy').", $!",1)); + $r->print( + "".&mt('Failed to write metadata copy').", $!, ".&mt('FAIL').""); return 0; } $r->rflush; @@ -1748,8 +1747,7 @@ sub phasetwo { # ------------------------------------------------------------- Trigger updates push(@{$modified_urls},[$target,$source]); unless ($registered_cleanup) { - my $handlers = $r->get_handlers('PerlCleanupHandler'); - $r->set_handlers('PerlCleanupHandler' => [\¬ify,@{$handlers}]); + $r->register_cleanup(\¬ify); $registered_cleanup=1; } @@ -1771,15 +1769,27 @@ sub phasetwo { my $thissrcdir=$thissrc; $thissrcdir=~s/\/[^\/]+$/\//; - + + $r->print(&Apache::lonhtmlcommon::start_funclist()); + unless ($env{'request.role'}=~/^(aa)/) { + $r->print( + &Apache::lonhtmlcommon::add_item_funclist( + '' + .&mt('View Published Version') + .'') + ); + } $r->print( - '
'. - &mt('View Published Version').''. - '

'. - &mt('Back to Source').'

'. - '

'. - &mt('Back to Source Directory').'

'); + &Apache::lonhtmlcommon::add_item_funclist( + '' + .&mt('Back to Source') + .'') + .&Apache::lonhtmlcommon::add_item_funclist( + '' + .&mt('Back to Source Directory') + .'') + .&Apache::lonhtmlcommon::end_funclist() + ); } return 1; } @@ -2165,10 +2175,25 @@ sub handler { &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; + # Breadcrumbs + &Apache::lonhtmlcommon::clear_breadcrumbs(); + &Apache::lonhtmlcommon::add_breadcrumb({ + 'text' => 'Construction Space', + 'href' => &Apache::loncommon::authorspace(), + }); + &Apache::lonhtmlcommon::add_breadcrumb({ + 'text' => 'Resource Publication', + 'href' => '', + }); + my $js=''; - $r->print(&Apache::loncommon::start_page('Resource Publication',$js)); + $r->print(&Apache::loncommon::start_page('Resource Publication',$js) + .&Apache::lonhtmlcommon::breadcrumbs() + .&Apache::loncommon::head_subbox( + &Apache::loncommon::CSTR_pageheader()) # FIXME crumbs broken? + ); my $thisfn=$fn; @@ -2269,7 +2294,6 @@ ENDDIFF } } else { &phasetwo($r,$thisfn,$thistarget,$thisembstyle,$thisdistarget); - $r->print('
'); } } $r->print(&Apache::loncommon::end_page());