--- loncom/interface/lonfeedback.pm 2012/03/06 21:24:01 1.290.2.7.2.1 +++ loncom/interface/lonfeedback.pm 2010/08/25 00:46:37 1.300 @@ -1,7 +1,7 @@ # The LearningOnline Network # Feedback # -# $Id: lonfeedback.pm,v 1.290.2.7.2.1 2012/03/06 21:24:01 raeburn Exp $ +# $Id: lonfeedback.pm,v 1.300 2010/08/25 00:46:37 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -58,15 +58,15 @@ sub discussion_open { return 1; } # It was not explicitly open, check if the problem is available. -# If the problem is not available, close the discussion +# If the problem is not available, close the discussion if (defined($status) && - !($status eq 'CAN_ANSWER' || $status eq 'CANNOT_ANSWER' - || $status eq 'OPEN')) { - return 0; + !($status eq 'CAN_ANSWER' || $status eq 'CANNOT_ANSWER' + || $status eq 'OPEN')) { + return 0; } # The problem is available, but check if the instructor explictly closed discussion if (defined($close) && $close ne '' && $close < time) { - return 0; + return 0; } return 1; } @@ -282,10 +282,6 @@ sub list_discussion { my %anonhash=(); my $anoncnt=0; my $target=''; - unless ($env{'browser.interface'} eq 'textual' || - $env{'environment.remote'} eq 'off' ) { - $target='target="LONcom"'; - } my $now = time; $discinfo{$visitkey} = $visit; @@ -425,7 +421,6 @@ imscp_v1p1.xsd http://www.imsglobal.org/ } } else { my $colspan=$maxdepth+1; -#JW $discussion.= &Apache::lonhtmlcommon::scripttag(qq| function verifydelete (caller,symb,idx,newflag,previous,groupparm) { var symbparm = symb+':::'+idx @@ -728,9 +723,8 @@ END } } if ((&discussion_open($status)) && ($outputtarget ne 'tex')) { - if (($group ne '') && ($mode eq 'board')) { - if ((&check_group_priv($group,'pgd') eq 'ok') && - ($ressymb =~ m{^bulletin___\d+___adm/wrapper/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard$})) { + if (($group ne '') && ($mode eq 'board')) { + if (&check_group_priv($group,'pgd') eq 'ok') { $discussion .= &postingform_display($mode,$ressymb,$now,$subject, $comment,$outputtarget,$attachnum, @@ -738,30 +732,19 @@ END $group,$crstype); } } else { - if (&Apache::lonnet::allowed('pch',$env{'request.course.id'}. - ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) { - - $discussion.= - &postingform_display($mode,$ressymb,$now,$subject, - $comment,$outputtarget,$attachnum, - $currnewattach,$currdelold,'',$crstype); - } else { - $discussion.= ''. - &mt('This discussion is closed.').''; - } + $discussion.= + &postingform_display($mode,$ressymb,$now,$subject, + $comment,$outputtarget,$attachnum, + $currnewattach,$currdelold,'',$crstype); } } - if (!(&discussion_open($status)) && ($outputtarget ne 'tex')) { - $discussion.= ''. - &mt('This discussion is closed.').''; - } } elsif ($outputtarget ne 'tex') { $discussion.=''; @@ -867,11 +850,6 @@ sub postingform_display { if (&Apache::lonhtmlcommon::htmlareabrowser()) { $postingform = &Apache::lonhtmlcommon::htmlareaselectactive(); $textareaclass = 'class="LC_richDefaultOff"'; - if ($env{'request.course.id'}) { - unless (($env{'course.'.$env{'request.course.id'}.'.allow_limited_html_in_feedback'} =~ /^\s*yes\s*$/i) || ($env{'form.sendmessageonly'})) { - undef($textareaclass); - } - } } $postingform .= (< @@ -904,22 +882,22 @@ ENDDISCUSS } $postingform .= "\n"; $postingform .= &generate_attachments_button('',$attachnum,$ressymb, - $now,$currnewattach, - $currdelold,'',$mode, - $blockblog); + $now,$currnewattach, + $currdelold,'',$mode, + $blockblog); if ((ref($currnewattach) eq 'ARRAY') && (@{$currnewattach} > 0)) { $newattachmsg = '
'.$lt{'newa'}.'
'; if (@{$currnewattach} > 1) { - $newattachmsg .= '
    '; - foreach my $item (@{$currnewattach}) { + $newattachmsg .= '
      '; + foreach my $item (@{$currnewattach}) { $item =~ m#.*/([^/]+)$#; $newattachmsg .= '
    1. '.$1.'
    2. '."\n"; - } - $newattachmsg .= '
    '."\n"; - } else { - $$currnewattach[0] =~ m#.*/([^/]+)$#; - $newattachmsg .= ''.$1.'
    '."\n"; - } + } + $newattachmsg .= '
'."\n"; + } else { + $$currnewattach[0] =~ m#.*/([^/]+)$#; + $newattachmsg .= ''.$1.'
'."\n"; + } } $postingform .= $newattachmsg; $postingform .= &generate_preview_button(); @@ -999,7 +977,7 @@ sub build_posting_display { } else { $$replies[$$depth[$idx]]=1; } - unless ((($hiddens{$idx}) && (!$seeid)) || ($deletions{$idx})) { + unless ((($hiddens{$idx}) && (!$seeid)) || ($deletions{$idx})) { $$visible++; if ($contrib{$idx.':history'}) { if ($contrib{$idx.':history'} =~ /:/) { @@ -1014,7 +992,7 @@ sub build_posting_display { my %subjects = (); my %attachtxt = (); my %allattachments = (); - my ($screenname,$plainname,$showaboutme); + my ($screenname,$plainname); my $sender = &mt('Anonymous'); # Anonymous users getting number within a discussion # Since idx is in static order, this should give the same sequence every time. @@ -1024,7 +1002,7 @@ sub build_posting_display { $$anonhash{$key}=&mt('Anonymous').' '.$anoncnt; } my ($message,$subject,$vgrlink,$ctlink); - &get_post_contents(\%contrib,$idx,$seeid,$outputtarget,\%messages,\%subjects,\%allattachments,\%attachtxt,$imsfiles,\$screenname,\$plainname,\$showaboutme,$numoldver); + &get_post_contents(\%contrib,$idx,$seeid,$outputtarget,\%messages,\%subjects,\%allattachments,\%attachtxt,$imsfiles,\$screenname,\$plainname,$numoldver); # Set up for sorting by subject @@ -1054,18 +1032,12 @@ sub build_posting_display { } } if (!$contrib{$idx.':anonymous'} || $see_anonymous) { - if ($showaboutme) { - $sender = &Apache::loncommon::aboutmewrapper( - $plainname, - $contrib{$idx.':sendername'}, - $contrib{$idx.':senderdomain'}); - } else { - $sender = $plainname; - } - if ($see_anonymous) { - $sender .= ' ('.$contrib{$idx.':sendername'}.':'. - $contrib{$idx.':senderdomain'}.')'; - } + $sender=&Apache::loncommon::aboutmewrapper( + $plainname, + $contrib{$idx.':sendername'}, + $contrib{$idx.':senderdomain'}).' ('. + $contrib{$idx.':sendername'}.':'. + $contrib{$idx.':senderdomain'}.')'; $sender = ''.$sender.''; if ($contrib{$idx.':anonymous'}) { $sender.=' ['.$$anonhash{$key}.'] '. @@ -1121,11 +1093,11 @@ sub build_posting_display { } } } - if ($seeid) { + if ($seeid) { if ($hiddens{$idx}) { unless ($studenthidden) { $sender.=' '; } } - } else { + } else { if ($screenname) { $sender=''.$screenname.''; } else { @@ -1173,7 +1145,7 @@ sub build_posting_display { } } if ($outputtarget ne 'tex') { - if (&discussion_open($status)) { + if (&discussion_open($status)) { if (($group ne '') && (&check_group_priv($group,'pgd') eq 'ok')) { $sender.=' '.&mt('Reply').''; } } - if ($viewgrades) { + if ($viewgrades) { $vgrlink=&Apache::loncommon::submlink(&mt('Submissions'), $contrib{$idx.':sendername'},$contrib{$idx.':senderdomain'},$ressymb); } - if ($$dischash{$readkey}=~/\.$idx\./) { + if ($$dischash{$readkey}=~/\.$idx\./) { $ctlink = ''; } else { $ctlink = ''; @@ -1402,7 +1374,7 @@ sub filter_regexp { sub get_post_contents { - my ($contrib,$idx,$seeid,$type,$messages,$subjects,$allattachments,$attachtxt,$imsfiles,$screenname,$plainname,$showaboutme,$numver) = @_; + my ($contrib,$idx,$seeid,$type,$messages,$subjects,$allattachments,$attachtxt,$imsfiles,$screenname,$plainname,$numver) = @_; my $discussion = ''; my $start=$numver; my $end=$numver + 1; @@ -1420,20 +1392,13 @@ sub get_post_contents { $$contrib{$idx.':sendername'}, $$contrib{$idx.':senderdomain'}); $$screenname=$$contrib{$idx.':screenname'}; - $$showaboutme = &Apache::lonnet::usertools_access($$contrib{$idx.':sendername'}, - $$contrib{$idx.':senderdomain'}, - 'aboutme'); - my $sender = $$plainname; - if ($$showaboutme) { - $sender = &Apache::loncommon::aboutmewrapper( - $$plainname, - $$contrib{$idx.':sendername'}, - $$contrib{$idx.':senderdomain'}); - } - if ($seeid) { - $sender .= ' ('. $$contrib{$idx.':sendername'}.':'. - $$contrib{$idx.':senderdomain'}.')'; - } + + my $sender=&Apache::loncommon::aboutmewrapper( + $$plainname, + $$contrib{$idx.':sendername'}, + $$contrib{$idx.':senderdomain'}).' ('. + $$contrib{$idx.':sendername'}.':'. + $$contrib{$idx.':senderdomain'}.')'; my $attachmenturls = $$contrib{$idx.':attachmenturl'}; my @postversions = (); if ($type eq 'allversions' || $type eq 'export') { @@ -1734,11 +1699,6 @@ END if (&Apache::lonhtmlcommon::htmlareabrowser()) { $textareaheader = &Apache::lonhtmlcommon::htmlareaselectactive(); $textareaclass = 'class="LC_richDefaultOff"'; - if ($env{'request.course.id'}) { - unless (($env{'course.'.$env{'request.course.id'}.'.allow_limited_html_in_feedback'} =~ /^\s*yes\s*$/i) || ($env{'form.sendmessageonly'})) { - undef($textareaclass); - } - } } # Breadcrumbs @@ -1789,7 +1749,7 @@ $latexHelp

$lt{'title'}:

-

END if ( ($env{'form.editdisc'}) || ($env{'form.replydisc'}) ) { @@ -2315,7 +2275,7 @@ sub print_showposters { my $group = $env{'form.group'}; my $ressymb = &wrap_symb($symb); if (($group ne '') && - ($ressymb =~ m|^bulletin___\d+___adm/wrapper/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard$|)) { + ($ressymb =~ m|^bulletin___ \d+___adm/wrapper/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard$|)) { if (&check_group_priv($group,'dgp') eq 'ok') { $seeid = 1; } @@ -2589,10 +2549,6 @@ sub redirect_back { &Apache::lonenc::check_encrypt(\$feedurl); my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif'); my %onload; - if ($env{'environment.remote'} ne 'off') { - $onload{'onload'} = - "if (window.name!='loncapaclient') { this.document.reldt.submit(); self.window.close(); }"; - } my $start_page= &Apache::loncommon::start_page('Feedback sent',undef, {'redirect' => [0,$feedurl], @@ -2626,10 +2582,6 @@ sub no_redirect_back { my $nofeed=&mt('Sorry, no feedback possible on this resource ...'); my %onload; - if ($env{'environment.remote'} ne 'off') { - $onload{'onload'} = - "if (window.name!='loncapaclient') { self.window.close(); }"; - } my %body_options = ('only_body' => 1, 'bgcolor' => '#FFFFFF', @@ -2656,7 +2608,7 @@ ENDNOREDIRTWO } sub screen_header { - my ($feedurl,$symb,$group) = @_; + my ($feedurl,$symb) = @_; my $crscontent = &mt('Question/Comment/Feedback about course content'); my $crspolicy = &mt('Question/Comment/Feedback about course policy'); my $contribdisc = &mt('Contribution to course discussion of resource'); @@ -2705,19 +2657,10 @@ sub screen_header { } if (($env{'request.course.id'}) && (!$env{'form.sendmessageonly'})) { my ($blocked,$blocktext) = &Apache::loncommon::blocking_status('boards'); - my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; - my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; - my $realsymb = $symb; - if ($symb=~/^bulletin___/) { - my $filename=(&Apache::lonnet::decode_symb($symb))[2]; - $filename=~s|^adm/wrapper/||; - $realsymb=&Apache::lonnet::symbread($filename); - } - if (!$blocked && &discussion_open(undef,$realsymb) && - (&Apache::lonnet::allowed('pch', + if (!$blocked && &discussion_open(undef,$symb) && + &Apache::lonnet::allowed('pch', $env{'request.course.id'}. - ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:'')) || - (($group ne '') && ($symb =~ m{^bulletin___\d+___adm/wrapper/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard$}) && (&check_group_priv($group,'pgd') eq 'ok')))) { + ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) { $discussoptions='