--- loncom/interface/lonfeedback.pm 2004/08/03 21:29:32 1.112
+++ loncom/interface/lonfeedback.pm 2004/08/04 18:04:57 1.113
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.112 2004/08/03 21:29:32 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.113 2004/08/04 18:04:57 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -298,9 +298,9 @@ sub list_discussion {
$subject=&Apache::lontexconvert::msgtexconverted($subject);
}
if ($attachmenturls) {
- my @attachments = ();
+ my %attachments = ();
my %currattach = ();
- &extract_attachments($attachmenturls,$idx,$numoldver,\$message,\@attachments,\%currattach);
+ &extract_attachments($attachmenturls,$idx,$numoldver,\$message,\%attachments,\%currattach);
}
if ($message) {
if ($hidden) {
@@ -925,7 +925,7 @@ sub mail_screen {
my @currnewattach = ();
my @currdelold = ();
my @keepold = ();
- my @attachments = ();
+ my %attachments = ();
my %currattach = ();
my $attachnum = 0;
my $anonchk = (<
Check the checkboxes for any you wish to remove
\n");
- foreach (@currold) {
- my $id = $_;
- $attachments[$id] =~ m#/([^/]+)$#;
- $r->print(' '.$1.'
'."\n");
+ foreach my $id (@currold) {
+ my $attachurl = &HTML::Entities::decode($attachments{$id}{'filename'});
+ $attachurl =~ m#/([^/]+)$#;
+ $r->print(' '.$1.'
'."\n");
}
$r->print("
");
}
@@ -2305,52 +2323,44 @@ ENDATTACH
sub extract_attachments {
my ($attachmenturls,$idx,$numoldver,$message,$attachments,$currattach,$currdelold) = @_;
- if ($attachmenturls =~ m/::::\d+:[\.yn\d]+::::/) {
- @{$attachments} = split/::::\d+:[\.yn\d]+::::/,$attachmenturls;
- shift @{$attachments};
- my $searchstr = '::::';
- for (my $i=0; $i<@{$attachments}; $i++) {
- if ($attachmenturls =~ m#^\Q$searchstr\E(\d+)(:[\.yn\d]+)::::#) {
- my $info = $1.$2;
- my $attachid = $1-1;
- $searchstr .= $info.'::::'.$$attachments[$i].'::::';
- if ($info =~ /\.$numoldver([yn])\./) {
- if (defined($currdelold)) {
- if (@{$currdelold} > 0) {
- unless (grep/^$attachid$/,@{$currdelold}) {
- my $id = $i;
- $$currattach{$id} = $1;
- }
- } else {
- my $id = $i;
- $$currattach{$id} = $1;
+ if ($attachmenturls =~ m/^
'.
+ my $attachurl = &HTML::Entities::decode($$attachments{$id}{'filename'});
+ $attachurl=~m|/([^/]+)$|;
+ $$message.='
'.
$1.'
';
&Apache::lonnet::allowuploaded('/adm/feedback',
- $$attachments[$id]);
+ $attachurl);
} elsif (@attached > 1) {
$$message.='';
foreach (@attached) {
my $id = $_;
+ my $attachurl = &HTML::Entities::decode($$attachments{$id}{'filename'});
my ($fname)
- =($$attachments[$id]=~m|/([^/]+)$|);
- $$message .= '
';
}
@@ -2361,7 +2371,7 @@ sub extract_attachments {
': '.
$fname.'