--- loncom/interface/lonsource.pm 2013/06/04 23:12:09 1.30 +++ loncom/interface/lonsource.pm 2015/05/23 21:02:39 1.34 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Source Code handler # -# $Id: lonsource.pm,v 1.30 2013/06/04 23:12:09 raeburn Exp $ +# $Id: lonsource.pm,v 1.34 2015/05/23 21:02:39 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -52,10 +52,11 @@ sub make_link { sub stage_2 { my ($r, $filename, $listname) = @_; my ($author)=($filename=~/\/res\/[^\/]+\/([^\/]+)\//); - $r->print(&Apache::loncommon::start_page('Copy Problem Source Code to Authoring Space') + $r->print(&Apache::loncommon::start_page('Copy Problem Source Code to Authoring Space',undef, + {'only_body' => 1,}) .&mt('Please enter the directory that you would like the source code to go into.') .'

' - .&mt('Note: the path is in reference to the root of your construction space,' + .&mt('Note: the path is in reference to the root of your Authoring Space,' .' and new directories will be automatically created.') .'

'); $r->print('
@@ -64,7 +65,8 @@ sub stage_2 {   -
'); + '. + &Apache::loncommon::end_page()); return OK; } @@ -101,14 +103,14 @@ sub copy_stage { my ($uname,$udom)= &Apache::lonnet::constructaccess($path_to_new_file); if (!$uname || !$udom) { - $r->print(&Apache::loncommon::start_page('Not Allowed')); + $r->print(&Apache::loncommon::start_page('Not Allowed',undef,{'only_body' => 1})); $r->print(&mt('Not allowed to create file [_1]', $path_to_new_file)); $r->print(&Apache::loncommon::end_page()); return; } #allowed - $r->print(&Apache::loncommon::start_page('Copying Source')); + $r->print(&Apache::loncommon::start_page('Copying Source',undef,{'only_body' => 1})); my $result = &Apache::loncfile::exists($uname, $udom, $path_to_new_file); $r->print($result); if(($result) && ($result =~ m|published|) ) { @@ -120,11 +122,12 @@ sub copy_stage { } $r->print(&Apache::loncommon::end_page()); + return; } sub confirm { my ($r, $newpath, $filename, $path_to_new_file) = @_; - $r->print("Press delete to remove file and replace it with a copy of the source you are viewing

"); + $r->print(''.&mt('Press delete to remove file and replace it with a copy of the source you are viewing.').'

'); $r->print('
@@ -133,6 +136,7 @@ sub confirm {
'); + return; } sub delete_copy_file { @@ -143,26 +147,30 @@ sub delete_copy_file { .'
' .&mt('Please use the code view in previous window to use shared code.') .'

'); - $r->print('print('
' + .'' - .'

'); + .'

'); } else { + $r->print(&Apache::loncommon::start_page('Copying Source',undef,{'only_body' => 1})); if(-e $path_to_new_file) { unless(unlink($path_to_new_file)) { $r->print('

'.&mt('Error:').' '.$!.'

'); return 0; } } else { - $r->print('

'.&mt('No such file').'

'); + $r->print('

'.&mt('No such file').'

'); return 0; } ©_file($r, $newpath, $filename, $path_to_new_file); + $r->print(&Apache::loncommon::end_page()); } + return; } sub copy_file { my ($r, $newpath, $filename, $path_to_new_file) = @_; - $r->print("Creating directories"); + $r->print(''.&mt('Creating directories').''); #Figure out if we are author or co-author my ($role,$author_name,$domain)=©_author(); @@ -188,7 +196,7 @@ sub copy_file { } else { } #Just move along } - $r->print("
Copying File"); + $r->print('
'.&mt('Copying File').''); my $problem_filename = $Apache::lonnet::perlvar{'lonDocRoot'}.$filename; my $file_output = &includemeta(&Apache::lonnet::getfile($problem_filename),$filename); my $fs=Apache::File->new(">$path_to_new_file"); @@ -196,8 +204,12 @@ sub copy_file { print $fs $file_output; } $r->print("

"); - $r->print(''); + $r->print('
' + .'' + .'
'); #Some 1.3'ish feature is to include the derivative feature, will go here..' + return; } sub print_item {