--- loncom/interface/lonfeedback.pm 2012/03/13 05:37:49 1.339 +++ 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.339 2012/03/13 05:37:49 raeburn Exp $ +# $Id: lonfeedback.pm,v 1.344 2012/03/15 21:55:13 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1680,11 +1680,16 @@ sub mail_screen { } my %lt = &Apache::lonlocal::texthash( - 'myqu' => 'My question/comment/feedback:', + 'myqu' => 'Question/comment/feedback:', 'title' => 'Title', 'reta' => 'Retained attachments', 'atta' => 'Attachment', ); + if($env{'form.editdisc'} || $env{'form.replydisc'}){ + %lt = &Apache::lonlocal::texthash( + 'myqu' => 'Post Discussion', + ); + } my $restitle = &get_resource_title($caller_symb,$feedurl); my $quote=''; my $subject = ''; @@ -1895,6 +1900,7 @@ END } $r->print(<$lt{'myqu'} $header
@@ -1915,18 +1921,28 @@ END $r->print(<$lt{'myqu'} +

$textareaheader

+

$latexHelp

-$lt{'title'}:

-

-

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()); + if ( ($env{'form.editdisc'}) || ($env{'form.replydisc'}) ) { if ($env{'form.origpage'}) { foreach my $attach (@currnewattach) { @@ -3396,11 +3412,11 @@ sub modify_attachments { my %lt = &Apache::lonlocal::texthash( 'subj' => 'Subject', - 'thfo' => 'The following attachments were part of the most recent saved version of this posting.', 'chth' => 'Check the checkboxes for any you wish to remove.', 'thef' => 'The following attachments have been uploaded for inclusion with this posting.', - 'adda' => 'Add a new attachment to this post.', + 'adda' => 'Add a new attachment to this post', 'stch' => 'Save Changes', + 'clic' => 'Add/remove attachments', ); my $js = < @@ -3414,7 +3430,7 @@ END # Breadcrumbs my $brcrum = [{'href' => '', 'text' => 'Discussion Post Attachments'}]; - my %parms=(); + my %parms=('only_body' => 1); if ($env{'form.modal'} ne 'yes') { 'bread_crumbs' => $brcrum } my $start_page = @@ -3443,44 +3459,42 @@ $start_page $toolarge
- - - - - - - - - -
- Subject: $subject

+

$lt{'clic'}

END - if ($idx) { - if ($attachmenturls) { - my @currold = keys(%currattach); - if (@currold > 0) { - $r->print($lt{'thfo'}.'
'.$lt{'chth'}.'
'."\n"); - foreach my $id (@currold) { - my $attachurl = &HTML::Entities::decode($attachments{$id}{'filename'}); - $attachurl =~ m#/([^/]+)$#; - $r->print('
'."\n"); + $r->print(&Apache::lonhtmlcommon::start_pick_box()); + $r->print(&Apache::lonhtmlcommon::row_title(&mt('Subject'))); + $r->print(''.$subject.''); + $r->print(&Apache::lonhtmlcommon::row_closure()); + $r->print(&Apache::lonhtmlcommon::row_title($lt{'adda'})); + $r->print(' '.$attachmaxtext); + if(($idx)||(ref($currnewattach) eq 'ARRAY') && (@{$currnewattach} > 0)){ + $r->print(&Apache::lonhtmlcommon::row_closure()); + $r->print(&Apache::lonhtmlcommon::row_title(&mt('Attachments'))); + if ($idx) { + if ($attachmenturls) { + my @currold = keys(%currattach); + if (@currold > 0) { + $r->print($lt{'thfo'}.'
'.$lt{'chth'}.'
'."\n"); + foreach my $id (@currold) { + my $attachurl = &HTML::Entities::decode($attachments{$id}{'filename'}); + $attachurl =~ m#/([^/]+)$#; + $r->print('
'."\n"); + } + $r->print("
"); } - $r->print("
"); } } - } - if ((ref($currnewattach) eq 'ARRAY') && (@{$currnewattach} > 0)) { - $r->print($lt{'thef'}.'
'.$lt{'chth'}.'
'."\n"); - foreach my $attach (@{$currnewattach}) { - $attach =~ m#/([^/]+)$#; - $r->print('
'."\n"); + if ((ref($currnewattach) eq 'ARRAY') && (@{$currnewattach} > 0)) { + $r->print($lt{'chth'}.'
'."\n"); + foreach my $attach (@{$currnewattach}) { + $attach =~ m#/([^/]+)$#; + $r->print('
'."\n"); + } } - $r->print("
"); } + $r->print(&Apache::lonhtmlcommon::row_closure(1)); + $r->print(&Apache::lonhtmlcommon::end_pick_box()); $r->print(<
- $lt{'adda'} -
$attachmaxtext
@@ -3536,6 +3550,7 @@ sub generate_attachments_button { my ($idx,$attachnum,$ressymb,$now,$currnewattach,$deloldattach, $numoldver,$mode,$blockblog) = @_; my $origpage = $ENV{'REQUEST_URI'}; + my $att=$attachnum.' '.&mt("attachments"); my %lt = &Apache::lonlocal::texthash( 'clic' => 'Add/remove attachments', ); @@ -4066,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. @@ -4101,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,