--- loncom/interface/lonfeedback.pm 2012/03/15 13:27:25 1.341 +++ loncom/interface/lonfeedback.pm 2012/03/15 21:55:13 1.344 @@ -1,7 +1,7 @@ # The LearningOnline Network # Feedback # -# $Id: lonfeedback.pm,v 1.341 2012/03/15 13:27:25 raeburn Exp $ +# $Id: lonfeedback.pm,v 1.344 2012/03/15 21:55:13 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1931,15 +1931,17 @@ $latexHelp

END -$r->print(&Apache::lonhtmlcommon::start_pick_box()); -$r->print(&Apache::lonhtmlcommon::row_title(&mt('Subject'))); -$r->print('

'); -$r->print(&Apache::lonhtmlcommon::row_closure()); -$r->print(&Apache::lonhtmlcommon::row_title(&mt('Message'))); -$r->print(''); -$r->print(&Apache::lonhtmlcommon::row_closure(1)); -$r->print(&Apache::lonhtmlcommon::end_pick_box()); + $r->print(&Apache::lonhtmlcommon::start_pick_box()); + $r->print(&Apache::lonhtmlcommon::row_title(&mt('Subject'))); + $r->print('

'); + $r->print(&Apache::lonhtmlcommon::row_closure()); + $r->print(&Apache::lonhtmlcommon::row_title(&mt('Message'))); + $r->print(''); + $r->print(&Apache::lonhtmlcommon::row_closure(1)); + $r->print(&Apache::lonhtmlcommon::end_pick_box()); if ( ($env{'form.editdisc'}) || ($env{'form.replydisc'}) ) { if ($env{'form.origpage'}) { @@ -3482,6 +3484,13 @@ END } } } + if ((ref($currnewattach) eq 'ARRAY') && (@{$currnewattach} > 0)) { + $r->print($lt{'chth'}.'
'."\n"); + foreach my $attach (@{$currnewattach}) { + $attach =~ m#/([^/]+)$#; + $r->print('
'."\n"); + } + } } $r->print(&Apache::lonhtmlcommon::row_closure(1)); $r->print(&Apache::lonhtmlcommon::end_pick_box()); @@ -4072,32 +4081,35 @@ ENDREDIR my $result; my $realsymb = &get_realsymb($symb); if (&discussion_vote_available($status,$realsymb)) { + my %contrib=&Apache::lonnet::restore($symb,$env{'request.course.id'}, + $env{'course.'.$env{'request.course.id'}.'.domain'}, + $env{'course.'.$env{'request.course.id'}.'.num'}); # # Likes and unlikes are in db-file "disclikes" of the course # The prefix is the $symb to identify the resource discussion, # and the $idx to identify the entry # my $prefix=$symb.':'.$idx.':'; - my %contrib=&Apache::lonnet::dump('disclikes', - $env{'course.'.$env{'request.course.id'}.'.domain'}, - $env{'course.'.$env{'request.course.id'}.'.num'}, - '^'.$prefix); + my %likes=&Apache::lonnet::dump('disclikes', + $env{'course.'.$env{'request.course.id'}.'.domain'}, + $env{'course.'.$env{'request.course.id'}.'.num'}, + '^'.$prefix); # Get current like or unlike status for the $idx for this user. my $thisuser=$env{'user.name'}.':'.$env{'user.domain'}; my ($userlikes,$userunlikes); - if (ref($contrib{$prefix.'likers'}) eq 'HASH') { - if (exists($contrib{$prefix.'likers'}{$thisuser})) { + if (ref($likes{$prefix.'likers'}) eq 'HASH') { + if (exists($likes{$prefix.'likers'}{$thisuser})) { $userlikes = 1; } } - if (ref($contrib{$prefix.'unlikers'}) eq 'HASH') { - if (exists($contrib{$prefix.'unlikers'}{$thisuser})) { + if (ref($likes{$prefix.'unlikers'}) eq 'HASH') { + if (exists($likes{$prefix.'unlikers'}{$thisuser})) { $userunlikes = 1; } } # Get the current "likes" count - my $likes=$contrib{$prefix.'likes'}; + my $likescount=$likes{$prefix.'likes'}; # Find out if they already voted # Users cannot like a post twice, or unlike it twice. # They can change their mind, though. @@ -4107,36 +4119,36 @@ ENDREDIR if ($userlikes) { $alreadyflag=1; } elsif ($userunlikes) { - delete($contrib{$prefix.'unlikers'}{$thisuser}); - $likes++; + delete($likes{$prefix.'unlikers'}{$thisuser}); + $likescount++; } else { - if (ref($contrib{$prefix.'likers'}) eq 'HASH') { - $contrib{$prefix.'likers'}{$thisuser} = 1; + if (ref($likes{$prefix.'likers'}) eq 'HASH') { + $likes{$prefix.'likers'}{$thisuser} = 1; } else { - $contrib{$prefix.'likers'} = {$thisuser => 1}; + $likes{$prefix.'likers'} = {$thisuser => 1}; } - $likes++; + $likescount++; } } else { if ($userunlikes) { $alreadyflag=1; } elsif ($userlikes) { - delete($contrib{$prefix.'likers'}{$thisuser}); - $likes--; + delete($likes{$prefix.'likers'}{$thisuser}); + $likescount--; } else { - if (ref($contrib{$prefix.'unlikers'}) eq 'HASH') { - $contrib{$prefix.'unlikers'}{$thisuser} = 1; + if (ref($likes{$prefix.'unlikers'}) eq 'HASH') { + $likes{$prefix.'unlikers'}{$thisuser} = 1; } else { - $contrib{$prefix.'unlikers'} = {$thisuser => 1}; + $likes{$prefix.'unlikers'} = {$thisuser => 1}; } - $likes--; + $likescount--; } } # $alreadyflag would be 1 if they tried to double-like or double-unlike unless ($alreadyflag) { - my %newhash=($prefix.'likes' => $likes, - $prefix.'likers' => $contrib{$prefix.'likers'}, - $prefix.'unlikers' => $contrib{$prefix.'unlikers'}); + my %newhash=($prefix.'likes' => $likescount, + $prefix.'likers' => $likes{$prefix.'likers'}, + $prefix.'unlikers' => $likes{$prefix.'unlikers'}); # Store data in db-file "disclikes" if (&Apache::lonnet::put('disclikes', \%newhash,