--- loncom/homework/lonhomework.pm 2013/04/01 21:40:14 1.337 +++ loncom/homework/lonhomework.pm 2013/08/20 14:37:33 1.339 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Homework handler # -# $Id: lonhomework.pm,v 1.337 2013/04/01 21:40:14 raeburn Exp $ +# $Id: lonhomework.pm,v 1.339 2013/08/20 14:37:33 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -163,7 +163,7 @@ sub get_target { } } # -# End of Construction Space +# End of Authoring Space # } # @@ -669,7 +669,7 @@ sub setupheader { } sub handle_save_or_undo { - my ($request,$problem,$result) = @_; + my ($request,$problem,$result,$getobjref) = @_; my $file = &Apache::lonnet::filelocation("",$request->uri); my $filebak =$file.".bak"; @@ -712,6 +712,30 @@ sub handle_save_or_undo { my $fh=Apache::File->new(">$file"); if (defined($fh)) { print $fh $$result; + if (ref($getobjref) eq 'SCALAR') { + if ($file =~ m{([^/]+)\.(html?)$}) { + my $fname = $1; + my $ext = $2; + my $path = $file; + $path =~ s/\Q$fname\E\.\Q$ext\E$//; + my (%allfiles,%codebase); + &Apache::lonnet::extract_embedded_items($file,\%allfiles, + \%codebase,$result); + if (keys(%allfiles) > 0) { + my $url = $request->uri; + my $state = < + +STATE + $$getobjref = "

".&mt("Reference Warning")."

". + "

".&mt("Completed upload of the file. This file contained references to other files.")."

". + "

".&mt("Please select the locations from which the referenced files are to be uploaded.")."

". + &Apache::loncommon::ask_for_embedded_content($url,$state,\%allfiles,\%codebase, + {'error_on_invalid_names' => 1, + 'ignore_remote_references' => 1,}); + } + } + } } else { &Apache::lonxml::info(''. &mt("Unable to write to [_1]", @@ -730,7 +754,7 @@ sub analyze_header { # Breadcrumbs my $brcrum = [{'href' => &Apache::loncommon::authorspace($request->uri), - 'text' => 'Construction Space'}, + 'text' => 'Authoring Space'}, {'href' => '', 'text' => 'Problem Testing'}, {'href' => '', @@ -964,7 +988,7 @@ sub editxmlmode { # Breadcrumbs my $brcrum = [{'href' => &Apache::loncommon::authorspace($request->uri), - 'text' => 'Construction Space'}, + 'text' => 'Authoring Space'}, {'href' => '', 'text' => 'Problem Editing'}]; @@ -1041,13 +1065,11 @@ sub renderpage { $problem=''; my $filename=(split('/',$file))[-1]; my $error = - '

' - .&mt('Unable to find [_1]', - ''.$filename.'') - ."

"; + &mt('Unable to find [_1]', + ''.$filename.''); $result.= &Apache::loncommon::simple_error_page($request,'Not available', - $error); + $error,{'no_auto_mt_msg'}); return; } @@ -1190,7 +1212,7 @@ sub newproblem { my $errormsg; my $instructions; my $brcrum = [{'href' => &Apache::loncommon::authorspace($request->uri), - 'text' => 'Construction Space'}, + 'text' => 'Authoring Space'}, {'href' => '', 'text' => "Create New $extension"}]; my $start_page =