--- loncom/interface/londocs.pm 2007/01/05 16:40:27 1.265 +++ loncom/interface/londocs.pm 2007/05/22 00:38:25 1.273 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.265 2007/01/05 16:40:27 albertel Exp $ +# $Id: londocs.pm,v 1.273 2007/05/22 00:38:25 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -235,7 +235,6 @@ sub dumpcourse { my ($ext)=($_=~/\.(\w+)$/); my $title=$hash{'title_'.$hash{ 'ids_/uploaded/'.$origcrsdata{'domain'}.'/'.$origcrsdata{'num'}.'/'.$_}}; - $title=~s/:/:/g; $r->print(''.($title?$title:' ').''); if (!$title) { $title=$_; @@ -937,8 +936,8 @@ sub group_import { $LONCAPA::map::order[$#LONCAPA::map::order+1]=$idx; my $ext = 'false'; if ($url=~m{^http://} || $url=~m{^https://}) { $ext = 'true'; } - $url =~ s/:/\:/g; - $name =~ s/:/\:/g; + $url = &LONCAPA::map::qtunescape($url); + $name = &LONCAPA::map::qtunescape($name); $LONCAPA::map::resources[$idx] = join ':', ($name, $url, $ext, 'normal', 'res'); } @@ -988,7 +987,8 @@ sub breadcrumbs { {'href'=>$url.$cpinfo, 'title'=>$name, 'text'=>''. - $name.'' + $name.'', + 'no_mt'=>1, }); $plain.=$name.' > '; } @@ -1315,12 +1315,10 @@ sub editor { &Apache::lonnet::getfile($url)); $url=$newurl; } - $title=~s/\/\>\;/g; - $title=~s/\:/\:/g; + $title = &LONCAPA::map::qtunescape($title); my $ext='false'; if ($url=~/^http\:\/\//) { $ext='true'; } - $url=~s/\:/\:/g; + $url = &LONCAPA::map::qtunescape($url); # Now insert the URL at the bottom my $newidx=&LONCAPA::map::getresidx($url); $LONCAPA::map::resources[$newidx]= @@ -1372,19 +1370,14 @@ sub editor { my $ratstr = $LONCAPA::map::resources[$LONCAPA::map::order[$idx]]; my ($rtitle,@rrest)=split(/\:/, $LONCAPA::map::resources[$LONCAPA::map::order[$idx]]); - my $comment= - &HTML::Entities::decode($env{'form.title'}); - $comment=~s/\/\>\;/g; - $comment=~s/\:/\:/g; + my $comment=$env{'form.title'}; + $comment = &LONCAPA::map::qtunescape($comment); if ($comment=~/\S/) { $LONCAPA::map::resources[$LONCAPA::map::order[$idx]]= $comment.':'.join(':',@rrest); } # Devalidate title cache - my $renamed_url=$rrest[0]; -# Has the :-escaping - $renamed_url=~s/\&colon\;/\:/g; + my $renamed_url=&LONCAPA::map::qtescape($rrest[0]); &Apache::lonnet::devalidate_title_cache($renamed_url); } # Store the changed version @@ -1538,11 +1531,9 @@ sub process_file_upload { $codebase); my $ext='false'; if ($url=~/^http\:\/\//) { $ext='true'; } - $url=~s/\:/\:/g; + $url = &LONCAPA::map::qtunescape($url); my $comment=$env{'form.comment'}; - $comment=~s/\/\>\;/g; - $comment=~s/\:/\:/g; + $comment = &LONCAPA::map::qtunescape($comment); if ($folder=~/^supplemental/) { $comment=time.'___&&&___'.$env{'user.name'}.'___&&&___'. $env{'user.domain'}.'___&&&___'.$comment; @@ -1561,38 +1552,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 +1573,49 @@ sub process_file_upload { return $phase_status; } +sub ask_for_embedded_content { + my ($actionurl,$state,$allfiles,$codebase,$args)=@_; + my $upload_output = ' +
'; + $upload_output .= $state; + $upload_output .= 'Upload embedded files:
'. + &Apache::loncommon::start_data_table(); + + my $num = 0; + foreach my $embed_file (keys(%{$allfiles})) { + $upload_output .= &Apache::loncommon::start_data_table_row(). + ''.$embed_file.''; + if ($args->{'error_on_invalid_names'} + && $embed_file ne &Apache::lonnet::clean_filename($embed_file,{'keep_path' => 1,})) { + + $upload_output.=''.&mt("Invalid characters").''; + } else { + $upload_output .=' + + '; + my $attrib = join(':',@{$$allfiles{$embed_file}}); + $upload_output .= + "\n\t\t". + ''; + if (exists($$codebase{$embed_file})) { + $upload_output .= + "\n\t\t". + ''; + } + } + $upload_output .= ''.&Apache::loncommon::end_data_table_row(); + $num++; + } + $upload_output .= &Apache::loncommon::end_data_table().'
+ + +
'; + return $upload_output; +} + sub process_secondary_uploads { my ($upload_output,$coursedom,$coursenum,$formname,$num,$newidx) = @_; my $folder=$env{'form.folder'}; @@ -1625,9 +1639,7 @@ sub process_secondary_uploads { sub entryline { my ($index,$title,$url,$folder,$allowed,$residx,$coursenum)=@_; - $title=~s/\&colon\;/\:/g; - $title=&HTML::Entities::encode(&HTML::Entities::decode( - &unescape($title)),'"<>&\''); + $title=&HTML::Entities::encode($title,'"<>&\''); my $renametitle=$title; my $foldertitle=$title; my $pagetitle=$title; @@ -1694,6 +1706,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 +1716,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 +1755,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 +1792,7 @@ ENDCOPY $lt{'rm'} - -$lt{'ct'} +$cutlink $lt{'rn'} $copylink @@ -1852,7 +1880,7 @@ END (&LONCAPA::map::getparameter($orderidx, 'parameter_randompick'))[0]. '" />'. -''.&mt('Store').''; +''.&mt('Save').''; } if ($ispage) { @@ -2111,9 +2139,9 @@ sub checkversions { if (&Apache::lonnet::put('resourceversions',\%newsetversions, $env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'}) eq 'ok') { - $r->print('

'.&mt('Your Version Settings have been Stored').'

'); + $r->print('

'.&mt('Your Version Settings have been Saved').'

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

'.&mt('An Error Occured while Attempting to Store your Version Settings').'

'); + $r->print('

'.&mt('An Error Occured while Attempting to Save your Version Settings').'

'); } &mark_hash_old(); }