--- loncom/interface/londocs.pm 2006/12/05 02:55:52 1.264 +++ loncom/interface/londocs.pm 2007/01/09 19:10:46 1.269 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.264 2006/12/05 02:55:52 albertel Exp $ +# $Id: londocs.pm,v 1.269 2007/01/09 19:10:46 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -913,7 +913,7 @@ sub group_import { while (@_) { my $name = shift; my $url = shift; - if (($url =~ m#^/uploaded/$coursedom/$coursenum/(default_\d+\.)(page|sequence)$#) && ($caller eq 'londocs')) { + if (($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E/(default_\d+\.)(page|sequence)$}) && ($caller eq 'londocs')) { my $errtext = ''; my $fatal = 0; my $newmapstr = ''."\n". @@ -988,7 +988,8 @@ sub breadcrumbs { {'href'=>$url.$cpinfo, 'title'=>$name, 'text'=>''. - $name.'' + $name.'', + 'no_mt'=>1, }); $plain.=$name.' > '; } @@ -1561,38 +1562,18 @@ sub process_file_upload { my $total_embedded = keys(%{$allfiles}); if ($total_embedded > 0) { my $num = 0; - $$upload_output .= 'This file contains embedded multimedia objects, which need to be uploaded to LON-CAPA.
-
- + my $state = ' + + '; - $$upload_output .= 'Upload embedded files:
- '; - foreach my $embed_file (keys(%{$allfiles})) { - $$upload_output .= ''; - $num ++; - } - $phase_status = 'phasetwo'; - $$upload_output .= '
'.$embed_file. - ' - '; - my $attrib; - if (@{$$allfiles{$embed_file}} > 1) { - $attrib = join(':',@{$$allfiles{$embed_file}}); - } else { - $attrib = $$allfiles{$embed_file}[0]; - } - $$upload_output .= - ''; - if (exists($$codebase{$embed_file})) { - $$upload_output .= - ''; - } - $$upload_output .= '

- -
'; + $phase_status = 'phasetwo'; + + $$upload_output .= + 'This file contains embedded multimedia objects, which need to be uploaded to LON-CAPA.
'. + &ask_for_embedded_content('/adm/coursedocs', + $state,$allfiles,$codebase); } else { $$upload_output .= 'No embedded items identified
'; } @@ -1602,6 +1583,41 @@ sub process_file_upload { return $phase_status; } +sub ask_for_embedded_content { + my ($actionurl,$state,$allfiles,$codebase)=@_; + my $upload_output = ' +
'; + $upload_output .= $state; + $upload_output .= 'Upload embedded files:
+ '; + + my $num = 0; + foreach my $embed_file (keys(%{$allfiles})) { + $upload_output .= ''; + $num++; + } + $upload_output .= '
'.$embed_file.' + + '; + my $attrib = join(':',@{$$allfiles{$embed_file}}); + $upload_output .= + "\n\t\t". + ''; + if (exists($$codebase{$embed_file})) { + $upload_output .= + "\n\t\t". + ''; + } + $upload_output .= '

+ + +
'; + return $upload_output; +} + sub process_secondary_uploads { my ($upload_output,$coursedom,$coursenum,$formname,$num,$newidx) = @_; my $folder=$env{'form.folder'}; @@ -1617,7 +1633,7 @@ sub process_secondary_uploads { $destination .= $newidx; my ($url,$filename); $url=&Apache::lonnet::userfileupload($formname.$num,1,$destination); - ($filename) = ($url =~ m-^/uploaded/$coursedom/$coursenum/$destination/(.+)$-); + ($filename) = ($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E/\Q$destination\E/(.+)$}); return $filename; } @@ -1694,6 +1710,7 @@ sub entryline { 'rn' => 'Rename', 'cp' => 'Copy'); my $nocopy=0; + my $nocut=0; if ($url=~/\.(page|sequence)$/) { foreach (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$url))) { my ($title,$url,$ext,$type)=split(/\:/,$_); @@ -1703,13 +1720,24 @@ sub entryline { } } } + if ($url=~/^\/res\/lib\/templates\//) { + $nocopy=1; + $nocut=1; + } my $copylink=' '; + my $cutlink=' '; if ($env{'form.pagepath'}) { - unless ($nocopy) { + if (!$nocopy) { $copylink=(< $lt{'cp'} ENDCOPY + } + if (!$nocut) { + $cutlink=(< +$lt{'ct'} +ENDCUT } $line.=(< @@ -1731,19 +1759,24 @@ ENDCOPY $lt{'rm'} - -$lt{'ct'} +$cutlink $lt{'rn'} $copylink END } else { - unless ($nocopy) { + if (!$nocopy) { $copylink=(< $lt{'cp'} ENDCOPY } + if (!$nocut) { + $cutlink=(< +$lt{'ct'} +ENDCUT + } $line.=(< @@ -1763,8 +1796,7 @@ ENDCOPY $lt{'rm'} - -$lt{'ct'} +$cutlink $lt{'rn'} $copylink