--- loncom/interface/londocs.pm 2010/02/05 12:46:40 1.419
+++ loncom/interface/londocs.pm 2011/05/27 19:39:25 1.434.2.4
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.419 2010/02/05 12:46:40 bisitz Exp $
+# $Id: londocs.pm,v 1.434.2.4 2011/05/27 19:39:25 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -121,7 +121,7 @@ sub dumpbutton {
if ($home+$other==0) { return ''; }
if ($home) {
my $link =
- ""
.&mt('Dump '.$crstype.' Documents to Construction Space')
@@ -268,7 +268,7 @@ sub dumpcourse {
sub exportbutton {
my $crstype = &Apache::loncommon::course_type();
- return "".&mt('IMS Export')."".
+ return "".&mt('IMS Export')."".
&Apache::loncommon::help_open_topic('Docs_Export_Course_Docs').'
';
}
@@ -1607,13 +1607,12 @@ sub editor {
my $shown=0;
if (($ishidden) || ($isencrypted) || ($randompick>=0) || ($is_random_order)) {
$r->print('
'.&mt('Parameters:'). - '
' .&mt('Caution: this folder is set to randomly pick a subset' @@ -1637,7 +1636,9 @@ sub editor { $r->print('
'.&mt('The uploaded file has not been stored as an error occurred reading the contents of the current folder.').'
'; + return; } my $destination = 'docs/'; if ($folder =~ /^supplemental/) { @@ -1713,13 +1716,23 @@ sub process_file_upload { } elsif ($folder =~ /^(default|supplemental)_(\d+)$/) { $destination .= $2.'/'; } -# this is for a course, not a user, so set coursedoc flag -# probably the only place in the system where this should be "1" +# this is for a course, not a user, so set context to coursedoc. my $newidx=&LONCAPA::map::getresidx(); $destination .= $newidx; - my $url=&Apache::lonnet::userfileupload('uploaddoc',1,$destination, + my $url=&Apache::lonnet::userfileupload('uploaddoc','coursedoc',$destination, $parseaction,$allfiles, - $codebase); + $codebase,undef,undef,undef,undef, + undef,undef,\$mimetype); + if ($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E.*/([^/]+)$}) { + my $stored = $1; + $showupload = ''.&mt('Uploaded [_1]',''. + $stored.'').'
'; + } else { + my ($filename) = ($env{'form.uploaddoc.filename'} =~ m{([^/]+)$}); + + $$upload_output = ''.&mt('Unable to save file [_1].',''.$filename.'').'
'; + return; + } my $ext='false'; if ($url=~m{^http://}) { $ext='true'; } $url = &LONCAPA::map::qtunescape($url); @@ -1736,51 +1749,37 @@ sub process_file_upload { ($errtext,$fatal)=&storemap($coursenum,$coursedom, $folder.'.'.$container); if ($fatal) { - $$upload_output .= ''.$errtext.'
'; - return 'failed'; + $$upload_output = ''.$errtext.'
'; + return; } else { - if ($parseaction eq 'parse') { + if ($parseaction eq 'parse' && $mimetype eq 'text/html') { + $$upload_output = $showupload; my $total_embedded = scalar(keys(%{$allfiles})); if ($total_embedded > 0) { - my $num = 0; - my $state = ' - - - - - '; - $phase_status = 'phasetwo'; - - $$upload_output .= - 'This file contains embedded multimedia objects, which need to be uploaded to LON-CAPA.'.&mt('This file contains embedded multimedia objects, which need to be uploaded.').'
'.$embedded; + $nextphase = $uploadphase; + } else { + $$upload_output .= $embedded; + } + } else { + $$upload_output .= &mt('Embedded item(s) already present, so no additional upload(s) required').''.
@@ -3476,9 +3434,45 @@ $r->print('');
return OK;
}
+sub embedded_form_elems {
+ my ($phase,$primaryurl,$newidx) = @_;
+ my $folderpath = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
+ return <