--- loncom/interface/londocs.pm 2007/01/09 19:10:46 1.269 +++ loncom/interface/londocs.pm 2007/01/29 21:18:53 1.271 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.269 2007/01/09 19:10:46 albertel Exp $ +# $Id: londocs.pm,v 1.271 2007/01/29 21:18:53 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'); } @@ -1316,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]= @@ -1373,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 @@ -1539,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; @@ -1584,34 +1574,42 @@ sub process_file_upload { } sub ask_for_embedded_content { - my ($actionurl,$state,$allfiles,$codebase)=@_; + my ($actionurl,$state,$allfiles,$codebase,$args)=@_; my $upload_output = '
'; $upload_output .= $state; - $upload_output .= 'Upload embedded files:
- '; + $upload_output .= 'Upload embedded files:
'. + &Apache::loncommon::start_data_table(); my $num = 0; foreach my $embed_file (keys(%{$allfiles})) { - $upload_output .= ''; + $upload_output .= ''.&Apache::loncommon::end_data_table_row(); $num++; } - $upload_output .= '
'.$embed_file.' + $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 .= + my $attrib = join(':',@{$$allfiles{$embed_file}}); + $upload_output .= "\n\t\t". - ''; + ''; + if (exists($$codebase{$embed_file})) { + $upload_output .= + "\n\t\t". + ''; + } } - $upload_output .= '

+ $upload_output .= &Apache::loncommon::end_data_table().'
'; @@ -1641,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;