--- loncom/interface/lonfeedback.pm 2012/04/29 22:55:20 1.353 +++ loncom/interface/lonfeedback.pm 2013/07/15 16:13:21 1.366 @@ -1,7 +1,7 @@ # The LearningOnline Network # Feedback # -# $Id: lonfeedback.pm,v 1.353 2012/04/29 22:55:20 raeburn Exp $ +# $Id: lonfeedback.pm,v 1.366 2013/07/15 16:13:21 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -821,7 +821,7 @@ sub can_see_hidden { sub discussion_link { my ($ressymb,$linktext,$cmd,$item,$flag,$prev,$adds,$title)=@_; - my $link='/adm/feedback?inhibitmenu=yes&modal=yes&'.$cmd.'='.&escape($ressymb).':::'.$item; + my $link='/adm/feedback?inhibitmenu=yes&modal=yes&'.$cmd.'='.&escape($ressymb).':::'.$item; if ($flag) { $link .= '&previous='.$prev; } if ($adds) { $link .= $adds; } my $width=600; @@ -1056,6 +1056,7 @@ sub build_posting_display { &filter_regexp($rolefilter,$sectionpick,$statusfilter); $rolematch = $roleregexp.':'.$secregexp.':'.$statusregexp; } + my %votestyle; if ($seeid || $canvote) { # We need to go through this twice, first to get the likes/dislikes, then to actually build the display for (my $id=1;$id<=$contrib{'version'};$id++) { @@ -1063,8 +1064,8 @@ sub build_posting_display { next if ($contrib{$idx.':deleted'}); next if ($contrib{$idx.':hidden'}); unless ((($hiddens{$idx}) && (!$seehidden)) || ($deletions{$idx}) || (!$contrib{$idx.':message'})) { + push(@theselikes,$likes{$symb.':'.$idx.':likes'}); if ($likes{$symb.':'.$idx.':likes'} ne '') { - push(@theselikes,$likes{$symb.':'.$idx.':likes'}); if (ref($likes{$symb.':'.$idx.':likers'}) eq 'HASH') { if (exists($likes{$symb.':'.$idx.':likers'}{$thisuser})) { $userlikes{$idx} = 1; @@ -1101,6 +1102,29 @@ sub build_posting_display { $twoplus=$ave+2.*$stddev; $oneminus=$ave-$stddev; $twominus=$ave-2.*$stddev; + if ($#theselikes>1) { + foreach my $class ('twoplus','oneplus','zero','oneminus','twominus') { + my $fontstyle = $env{'course.'.$env{'request.course.id'}.'.discussion_post_fonts_'.$class}; + if ($fontstyle ne '') { + my ($size,$weight,$style,$other) = split(/,/,$fontstyle); + if ($size ne '') { + $votestyle{$class} .= 'font-size: '.$size.';'; + } + if ($weight ne '') { + $votestyle{$class} .= 'font-weight: '.$weight.';'; + } + if ($style ne '') { + $votestyle{$class} .= 'font-style: '.$style.';'; + } + if ($other ne '') { + $votestyle{$class} .= $other; + } + if ($votestyle{$class} ne '') { + $votestyle{$class} = 'style="'.$votestyle{$class}.'"'; + } + } + } + } } # # This is now the real loop. Go through all entries, pick up what we need @@ -1436,24 +1460,26 @@ sub build_posting_display { $$discussionitems[$idx].='  '.$ctlink; } my $thislikes=$likes{$symb.':'.$idx.':likes'}; - my $likesize="100"; + my $likestyle; if ($seeid || $canvote) { # Figure out size based on likes + my $class = 'zero'; my $thislikes=$likes{$symb.':'.$idx.':likes'}; if ($thislikes>$twoplus) { - $likesize="200"; + $class = 'twoplus'; } elsif ($thislikes>$oneplus) { - $likesize="150"; + $class = 'oneplus'; } if ($thislikes<$twominus) { - $likesize="50"; + $class = 'twominus'; } elsif ($thislikes<$oneminus) { - $likesize="75"; + $class = 'oneminus'; } + $likestyle = $votestyle{$class}; } # Actually glue in the message itself $$discussionitems[$idx].= '
'. - "
". + "
". $message. '
'; if ($canvote) { @@ -1926,7 +1952,7 @@ END my %onload = ('onload' => 'window.focus();setposttype();'); my %parms=('add_entries' => \%onload); - if ($env{'form.modal'} ne 'yes') { 'bread_crumbs' => $brcrum } + if ($env{'form.modal'} ne 'yes') { $parms{'bread_crumbs'} = $brcrum; } my $start_page= &Apache::loncommon::start_page('Resource Feedback and Discussion',$js,\%parms); @@ -1935,7 +1961,11 @@ END unless (&contains_block_html($quote)) { &newline_to_br(\$quote); } - $quote='
'.&Apache::lontexconvert::msgtexconverted($quote).'
'; + $quote=&Apache::lonhtmlcommon::start_pick_box(). + &Apache::lonhtmlcommon::row_title(&mt('Quote')). + &Apache::lontexconvert::msgtexconverted($quote). + &Apache::lonhtmlcommon::row_closure(1). + &Apache::lonhtmlcommon::end_pick_box(); } my $header=''; unless ($env{'form.modal'}) { @@ -1963,24 +1993,27 @@ END } $r->print(< +END +$r->print(&Apache::lonhtmlcommon::start_pick_box()); +$r->print(< $textareaheader

-

$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)); @@ -2018,10 +2051,8 @@ END $r->print(''); } $r->print(< -

END if ($env{'form.editdisc'} || $env{'form.replydisc'}) { @@ -2036,7 +2067,6 @@ END $attachnum += @currnewattach; } my $blockblog = &Apache::loncommon::blocking_status('blogs'); - $r->print(&generate_attachments_button($postidx,$attachnum,$ressymb,$now,\@currnewattach,\@currdelold,$numoldver,'',$blockblog)); if ($attachnum > 0) { if (@currnewattach > 0) { $newattachmsg .= '
'.&mt('New attachments').'
'; @@ -2056,9 +2086,10 @@ END $r->print("
$lt{'reta'}:$attachmsg
\n"); } if ($newattachmsg) { - $r->print("$newattachmsg
"); + $r->print("$newattachmsg"); } } + $r->print(&generate_attachments_button($postidx,$attachnum,$ressymb,$now,\@currnewattach,\@currdelold,$numoldver,'',$blockblog)); } $r->print(&generate_preview_button(). &Apache::loncommon::end_page()); @@ -2551,7 +2582,7 @@ sub print_showposters { my $table_start =&Apache::loncommon::start_data_table(); $r->print(< +

$table_start @@ -2667,7 +2698,7 @@ sub fail_redirect { 'only_body' => 1,})); $r->print(< -$lt{'sorr'} +

$lt{'sorr'}

ENDFAILREDIR $r->print(&Apache::loncommon::end_page()); } @@ -3459,7 +3490,7 @@ END my $brcrum = [{'href' => '', 'text' => 'Discussion Post Attachments'}]; my %parms=('only_body' => 1); - if ($env{'form.modal'} ne 'yes') { 'bread_crumbs' => $brcrum } + if ($env{'form.modal'} ne 'yes') { $parms{'bread_crumbs'} = $brcrum; } my $start_page = &Apache::loncommon::start_page('Discussion Post Attachments',$js,\%parms); @@ -3486,7 +3517,7 @@ END $start_page $toolarge -
+

$lt{'clic'}

END $r->print(&Apache::lonhtmlcommon::start_pick_box()); @@ -3877,7 +3908,7 @@ sub handler { 'text' => 'Discussion Post Versions'}]; my %parms=(); - if ($env{'form.modal'} ne 'yes') { 'bread_crumbs' => $brcrum } + if ($env{'form.modal'} ne 'yes') { $parms{'bread_crumbs'} = $brcrum; } $r->print(&Apache::loncommon::start_page('Discussion Post Versions',undef,\%parms)); @@ -3950,8 +3981,6 @@ sub handler { my $feedurl = '/adm/navmaps'; if ($env{'form.navurl'}) { $feedurl .= '?'.$env{'form.navurl'}; } my %lt = &Apache::lonlocal::texthash( - 'mnpa' => 'Marked "New" posts as read in a total of', - 'robb' => 'resources/bulletin boards.', 'twnp' => 'There are currently no resources or discussion boards with unread discussion postings.' ); foreach my $res (@resources) { @@ -3960,7 +3989,10 @@ sub handler { my $lastkey = $ressymb.'_lastread'; $discinfo{$lastkey} = $env{'form.navtime'}; } - my $textline = "$lt{'mnpa'} $numitems $lt{'robb'}"; + my $textline = ''. + &mt('Marked "New" posts as read in a total of [_1] resources/bulletin boards.', + $numitems). + ''; if ($numitems > 0) { &Apache::lonnet::put('nohist_'.$env{'request.course.id'}.'_discuss', \%discinfo,$env{'user.domain'},$env{'user.name'}); @@ -4391,6 +4423,7 @@ ENDREDIR $cdom,$cnum); $contrib{'deleted'} =~ s/^\.//; $contrib{'deleted'} =~ s/\.$//; + my $confirm_msg; if ($contrib{'deleted'} ne '') { if (&Apache::lonnet::store({'deleted' => ''},$symb,$env{'request.course.id'}, $cdom,$cnum) eq 'ok') { @@ -4418,14 +4451,19 @@ ENDREDIR $uname,$udom,$env{'request.course.id'}, 'undelete'); } - $r->print(&Apache::lonhtmlcommon::confirm_success(&mt("Undeleted all entries"))); + $confirm_msg = &Apache::lonhtmlcommon::confirm_success(&mt("Undeleted all entries")); } else { - $r->print(&Apache::lonhtmlcommon::confirm_success(&mt("Failed to undelete entries"),1)); + $confirm_msg = &Apache::lonhtmlcommon::confirm_success(&mt("Failed to undelete entries"),1); } } else { - $r->print(&Apache::lonhtmlcommon::confirm_success(&mt("No entries to undelete"),1)); + $confirm_msg = &Apache::lonhtmlcommon::confirm_success(&mt("No entries to undelete"),1); } - $r->print("
".&mt("Return and reload").""); + $r->print( + '
' + .&Apache::loncommon::confirmwrapper($confirm_msg) + .&Apache::lonhtmlcommon::actionbox( + ["".&mt("Return and reload").""]) + ); } $r->print(&Apache::loncommon::end_page()); return OK;