version 1.307, 2008/05/28 14:21:30
|
version 1.308, 2008/06/09 22:34:55
|
Line 818 sub extract_media {
|
Line 818 sub extract_media {
|
$dirpath = $url; |
$dirpath = $url; |
$container = ''; |
$container = ''; |
} |
} |
&Apache::lonnet::extract_embedded_items(undef,undef,\%allfiles,\%codebase,$content); |
&Apache::lonnet::extract_embedded_items(undef,\%allfiles,\%codebase,$content); |
foreach my $embed_file (keys(%allfiles)) { |
foreach my $embed_file (keys(%allfiles)) { |
my $filename; |
my $filename; |
if ($embed_file =~ m#([^/]+)$#) { |
if ($embed_file =~ m#([^/]+)$#) { |
Line 1571 sub process_file_upload {
|
Line 1571 sub process_file_upload {
|
|
|
$$upload_output .= |
$$upload_output .= |
'This file contains embedded multimedia objects, which need to be uploaded to LON-CAPA.<br />'. |
'This file contains embedded multimedia objects, which need to be uploaded to LON-CAPA.<br />'. |
&ask_for_embedded_content('/adm/coursedocs', |
&Apache::loncommon::ask_for_embedded_content( |
$state,$allfiles,$codebase); |
'/adm/coursedocs',$state,$allfiles,$codebase); |
} else { |
} else { |
$$upload_output .= 'No embedded items identified<br />'; |
$$upload_output .= 'No embedded items identified<br />'; |
} |
} |
Line 1582 sub process_file_upload {
|
Line 1582 sub process_file_upload {
|
return $phase_status; |
return $phase_status; |
} |
} |
|
|
sub ask_for_embedded_content { |
|
my ($actionurl,$state,$allfiles,$codebase,$args)=@_; |
|
my $upload_output = ' |
|
<form name="upload_embedded" action="'.$actionurl.'" |
|
method="post" enctype="multipart/form-data">'; |
|
$upload_output .= $state; |
|
$upload_output .= '<b>Upload embedded files</b>:<br />'. |
|
&Apache::loncommon::start_data_table(); |
|
|
|
my $num = 0; |
|
foreach my $embed_file (sort {lc($a) cmp lc($b)} keys(%{$allfiles})) { |
|
$upload_output .= &Apache::loncommon::start_data_table_row(). |
|
'<td>'.$embed_file.'</td><td>'; |
|
if ($args->{'ignore_remote_references'} |
|
&& $embed_file =~ m{^\w+://}) { |
|
$upload_output.='<span class="LC_warning">'.&mt("URL points to other server.").'</span>'; |
|
} elsif ($args->{'error_on_invalid_names'} |
|
&& $embed_file ne &Apache::lonnet::clean_filename($embed_file,{'keep_path' => 1,})) { |
|
|
|
$upload_output.='<span class="LC_warning">'.&mt("Invalid characters").'</span>'; |
|
|
|
} else { |
|
|
|
$upload_output .=' |
|
<input name="embedded_item_'.$num.'" type="file" value="bob" /> |
|
<input name="embedded_orig_'.$num.'" type="hidden" value="'.&escape($embed_file).'" />'; |
|
my $attrib = join(':',@{$$allfiles{$embed_file}}); |
|
$upload_output .= |
|
"\n\t\t". |
|
'<input name="embedded_attrib_'.$num.'" type="hidden" value="'. |
|
$attrib.'" />'; |
|
if (exists($$codebase{$embed_file})) { |
|
$upload_output .= |
|
"\n\t\t". |
|
'<input name="codebase_'.$num.'" type="hidden" value="'. |
|
&escape($$codebase{$embed_file}).'" />'; |
|
} |
|
} |
|
$upload_output .= '</td>'.&Apache::loncommon::end_data_table_row(); |
|
$num++; |
|
} |
|
$upload_output .= &Apache::loncommon::end_data_table().'<br /> |
|
<input type ="hidden" name="number_embedded_items" value="'.$num.'" /> |
|
<input type ="submit" value="'.&mt('Upload Listed Files').'" /> |
|
'.&mt('(only files for which a location has been provided will be uploaded)').' |
|
</form>'; |
|
return $upload_output; |
|
} |
|
|
|
sub process_secondary_uploads { |
sub process_secondary_uploads { |
my ($upload_output,$coursedom,$coursenum,$formname,$num,$newidx) = @_; |
my ($upload_output,$coursedom,$coursenum,$formname,$num,$newidx) = @_; |
my $folder=$env{'form.folder'}; |
my $folder=$env{'form.folder'}; |