--- loncom/interface/lonfeedback.pm 2006/12/06 19:03:37 1.229 +++ loncom/interface/lonfeedback.pm 2009/03/04 17:11:22 1.268 @@ -1,7 +1,7 @@ # The LearningOnline Network # Feedback # -# $Id: lonfeedback.pm,v 1.229 2006/12/06 19:03:37 albertel Exp $ +# $Id: lonfeedback.pm,v 1.268 2009/03/04 17:11:22 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -74,6 +74,9 @@ sub discussion_visible { sub list_discussion { my ($mode,$status,$ressymb,$imsextras,$group)=@_; + unless ($ressymb) { $ressymb=&Apache::lonnet::symbread(); } + unless ($ressymb) { return ''; } + $ressymb=&wrap_symb($ressymb); my $outputtarget=$env{'form.grade_target'}; if (defined($env{'form.export'})) { if($env{'form.export'}) { @@ -85,16 +88,26 @@ sub list_discussion { $outputtarget = 'export'; } } - if (not &discussion_visible($status)) { return ''; } + if (not &discussion_visible($status)) { + if ($mode ne 'board') { + &Apache::lonenc::check_encrypt(\$ressymb); + return '
'.&send_message_link($ressymb); + } + } if ($group ne '' && $mode eq 'board') { if (&check_group_priv($group,'vgb') ne 'ok') { return ''; } } - my ($blocked,$blocktext) = &blocking_posts('boards',1); + my ($blocked,$blocktext) = + &Apache::loncommon::blocking_status('boards'); if ($blocked) { - return $blocktext; + &Apache::lonenc::check_encrypt(\$ressymb); + if ($mode ne 'board') { + $blocktext.='
'.&send_message_link($ressymb); + } + return $blocktext; } my @bgcols = ("#cccccc","#eeeeee"); @@ -107,9 +120,6 @@ sub list_discussion { $crs.='_'.$env{'request.course.sec'}; } $crs=~s/\_/\//g; - unless ($ressymb) { $ressymb=&Apache::lonnet::symbread(); } - unless ($ressymb) { return ''; } - $ressymb=&wrap_symb($ressymb); my $encsymb=&Apache::lonenc::check_encrypt($ressymb); my $viewgrades=(&Apache::lonnet::allowed('vgr',$crs) && ($ressymb=~/\.(problem|exam|quiz|assess|survey|form|task)$/)); @@ -615,7 +625,7 @@ END $filterchoice .= ' '.$role_types{$role}.','; } $filterchoice =~ s/,$//; - $filterchoice .= '
        '; + $filterchoice .= '
'.(' ' x8); } if ($statusfilter) { $filterchoice .= ''.&mt('status').'- '.$status_types{$statusfilter}; @@ -627,7 +637,7 @@ END } } if ($dischash{$toggkey}) { - my $storebutton = &mt('Store read/unread changes'); + my $storebutton = &mt('Save read/unread changes'); $discussion.=''. ''."\n". ''. - ''. - &mt('Post Discussion').'
'; + $discussion.= &send_feedback_link($ressymb,$target); } } - $discussion.=''. - &mt('Send Message').''; + if ($outputtarget ne 'tex') { + $discussion.= &send_message_link($ressymb); + } + $discussion.=''; } return $discussion; } +sub send_feedback_link { + my ($ressymb,$target) = @_; + my $output = ''. + ' '. + ''.&mt('Post Discussion').''; + return $output; +} + +sub send_message_link { + my ($ressymb) = @_; + my $output = ''. + ' '.&mt('Send Message').''; + return $output; +} + sub action_links_bar { my ($colspan,$ressymb,$visible,$newpostsflag,$group,$prevread,$markondisp) = @_; my $discussion = ''. @@ -766,7 +794,7 @@ sub action_links_bar { $discussion .= '&previous='.$prevread; } $discussion .= &group_args($group); - $discussion .='">'.&mt('Sorting/Filtering options').'  '; + $discussion .='">'.&mt('Sorting/Filtering options').''.(' ' x2); } else { $discussion .= ''; } @@ -795,25 +823,6 @@ sub action_links_bar { return $discussion; } -sub blocking_posts { - my ($type,$showstatus) = @_; - my %setters; - my ($blocked,$output); - my ($startblock,$endblock) = - &Apache::loncommon::blockcheck(\%setters,$type); - if ($startblock && $endblock) { - $blocked = 1; - if ($showstatus) { - my $showstart = &Apache::lonlocal::locallocaltime($startblock); - my $showend = &Apache::lonlocal::locallocaltime($endblock); - $output = &mt('Discussion postings will not be viewable for resources in this course between [_1] and [_2] because communication is being blocked.',$showstart, $showend).'
'. - &Apache::loncommon::build_block_table($startblock,$endblock, - \%setters); - } - } - return ($blocked,$output); -} - sub postingform_display { my ($mode,$ressymb,$now,$subject,$comment,$outputtarget,$attachnum, $currnewattach,$currdelold,$group) = @_; @@ -850,7 +859,7 @@ ENDDISCUSS if ($group ne '') { $postingform .=''; } - my ($blockblog) = &blocking_posts('blogs'); + my $blockblog = &Apache::loncommon::blocking_status('blogs'); if (!$blockblog) { $postingform .= &add_blog_checkbox(); } @@ -891,6 +900,9 @@ sub build_posting_display { $env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'}); + my $see_anonymous = + &Apache::lonnet::allowed('rin',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:'')); + if ((@{$grouppick} == 0) || (grep(/^all$/,@{$grouppick}))) { $skip_group_check = 1; } @@ -991,18 +1003,20 @@ sub build_posting_display { @{$$subjectsort{$subject}} = ("$idx"); } } - if ((!$contrib{$idx.':anonymous'}) || (&Apache::lonnet::allowed('rin',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:'')))) { + if (!$contrib{$idx.':anonymous'} || $see_anonymous) { $sender=&Apache::loncommon::aboutmewrapper( $plainname, $contrib{$idx.':sendername'}, $contrib{$idx.':senderdomain'}).' ('. - $contrib{$idx.':sendername'}.' at '. + $contrib{$idx.':sendername'}.':'. $contrib{$idx.':senderdomain'}.')'; if ($contrib{$idx.':anonymous'}) { $sender.=' ['.$$anonhash{$key}.'] '. $screenname; } - + if ($see_anonymous) { + $sender.=&Apache::loncommon::student_image_tag($contrib{$idx.':senderdomain'},$contrib{$idx.':sendername'}); + } # Set up for sorting by domain, then username unless (defined($$usernamesort{$contrib{$idx.':senderdomain'}})) { %{$$usernamesort{$contrib{$idx.':senderdomain'}}} = (); @@ -1226,7 +1240,7 @@ sub build_posting_display { $$newitem{$idx} = 1; $$discussionitems[$idx] .= '

- '; + '; } else { $$newitem{$idx} = 0; $$discussionitems[$idx] .= ' @@ -1458,7 +1472,7 @@ sub replicate_attachments { } sub mail_screen { - my ($r,$feedurl,$options) = @_; + my ($r,$feedurl,$options,$caller_symb,$attachmaxtext) = @_; if (exists($env{'form.origpage'})) { &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['subject','comment','currnewattach','addnewattach','deloldattach','delnewattach','timestamp','idx','anondiscuss','discuss','blog','group','ref']); } @@ -1468,10 +1482,9 @@ sub mail_screen { 'myqu' => 'My question/comment/feedback:', 'title' => 'Title', 'reta' => 'Retained attachments', - 'atta' => 'Attachment (128 KB max size)', - ); - my $title=&Apache::lonnet::gettitle($feedurl); - if (!$title) { $title = $feedurl; } + 'atta' => 'Attachment', + ); + my $restitle = &get_resource_title($caller_symb,$feedurl); my $quote=''; my $subject = ''; my $comment = ''; @@ -1605,7 +1618,7 @@ END $comment = &unescape($env{'form.comment'}); &process_attachments(\@currnewattach,\@currdelold,\@keepold); } - my $latexHelp=&Apache::loncommon::helpLatexCheatsheet(); + my $latexHelp=&Apache::loncommon::helpLatexCheatsheet(undef,undef,1); my $send=&mt('Send'); my $alert = &mt('Please select a feedback type.'); my $js= <print(<$title +

$restitle

$prevtag @@ -1682,6 +1695,8 @@ $quote

$lt{'myqu'}

$latexHelp +

+

$lt{'title'}:

NEW
'.&mt('NEW').'