--- loncom/interface/lonfeedback.pm 2012/03/07 01:26:48 1.290.2.7.2.2 +++ loncom/interface/lonfeedback.pm 2012/01/03 18:21:58 1.315 @@ -1,7 +1,7 @@ # The LearningOnline Network # Feedback # -# $Id: lonfeedback.pm,v 1.290.2.7.2.2 2012/03/07 01:26:48 raeburn Exp $ +# $Id: lonfeedback.pm,v 1.315 2012/01/03 18:21:58 www 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; } @@ -135,7 +135,7 @@ sub list_discussion { $crs=~s/\_/\//g; my $encsymb=&Apache::lonenc::check_encrypt($ressymb); my $viewgrades=(&Apache::lonnet::allowed('vgr',$crs) - && ($ressymb=~/\.(problem|exam|quiz|assess|survey|form|task)$/)); + && ($ressymb=~/$LONCAPA::assess_re/)); my %usernamesort = (); my %namesort =(); @@ -281,17 +281,12 @@ sub list_discussion { my $maxdepth=0; 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; &Apache::lonnet::put('nohist_'.$cid.'_discuss',\%discinfo,$env{'user.domain'},$env{'user.name'}); - &build_posting_display(\%usernamesort,\%subjectsort,\%namesort,\%notshown,\%newitem,\%dischash,\%shown,\%alldiscussion,\%imsitems,\%imsfiles,\%roleinfo,\@discussionitems,\@replies,\@depth,\@posters,\$maxdepth,\$visible,\$newpostsflag,\$current,$status,$viewgrades,$seeid,$prevread,$sortposts,$encsymb,$target,$readkey,$showunmark,$showonlyunread,$totposters,\@rolefilter,\@sectionpick,\@grouppick,$classgroups,$statusfilter,$toggkey,$outputtarget,\%anonhash,$anoncnt,$group); + &build_posting_display(\%usernamesort,\%subjectsort,\%namesort,\%notshown,\%newitem,\%dischash,\%shown,\%alldiscussion,\%imsitems,\%imsfiles,\%roleinfo,\@discussionitems,\@replies,\@depth,\@posters,\$maxdepth,\$visible,\$newpostsflag,\$current,$status,$viewgrades,$seeid,$prevread,$sortposts,$encsymb,$readkey,$showunmark,$showonlyunread,$totposters,\@rolefilter,\@sectionpick,\@grouppick,$classgroups,$statusfilter,$toggkey,$outputtarget,\%anonhash,$anoncnt,$group); my $discussion=''; my $manifestfile; @@ -304,7 +299,7 @@ sub list_discussion { my $color = &Apache::loncommon::designparm($function.'.tabbg', $env{'user.domain'}); my %lt = &Apache::lonlocal::texthash( - 'cuse' => 'Current discussion settings', + 'cuse' => 'My settings for this discussion', 'allposts' => 'All posts', 'unread' => 'New posts only', 'unmark' => 'Unread only', @@ -425,7 +420,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 @@ -645,8 +639,9 @@ END if ($filterchoice) { $discussion .= ''.&mt('Filters').': '.$filterchoice; } - $discussion .= ''; } + $discussion .= ''; + } if ($dischash{$toggkey}) { my $storebutton = &mt('Save read/unread changes'); @@ -728,8 +723,8 @@ END } } if ((&discussion_open($status)) && ($outputtarget ne 'tex')) { - if (($group ne '') && ($mode eq 'board')) { - if ((&check_group_priv($group,'pgd') eq 'ok') && + 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$})) { $discussion .= &postingform_display($mode,$ressymb,$now,$subject, @@ -741,10 +736,10 @@ END 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); + $discussion.= + &postingform_display($mode,$ressymb,$now,$subject, + $comment,$outputtarget,$attachnum, + $currnewattach,$currdelold,'',$crstype); } else { $discussion.= ''. &mt('This discussion is closed.').''; @@ -761,7 +756,7 @@ END &Apache::lonnet::allowed('pch', $env{'request.course.id'}. ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) { - $discussion.= &send_feedback_link($ressymb,$target); + $discussion.= &send_feedback_link($ressymb); if ($env{'request.role.adv'}) { my $close = &Apache::lonnet::EXT('resource.0.discussend',$ressymb); if (defined($close) && $close ne '' && $close < time) { @@ -769,7 +764,7 @@ END &Apache::lonnet::plaintext('st',$crstype)); } } - } else { + } else { $discussion.= ''.&mt('This discussion is closed.').''; } $discussion.= &send_message_link($ressymb).''; @@ -777,26 +772,25 @@ END return $discussion; } + sub discussion_link { - my ($ressymb,$linktext,$cmd,$item,$flag,$prev,$adds,$title) = @_; - my $link = ''; - return $link; + my ($ressymb,$linktext,$cmd,$item,$flag,$prev,$adds)=@_; + my $link='/adm/feedback?inhibitmenu=yes&modal=yes&'.$cmd.'='.&escape($ressymb).':::'.$item; + if ($flag) { $link .= '&previous='.$prev; } + if ($adds) { $link .= $adds; } + return &Apache::loncommon::modal_link($link,$linktext,600,600); } + sub send_feedback_link { - my ($ressymb,$target) = @_; - my $output = ''. - ' '. - ''.&mt('Post Discussion').''; - return $output; + my ($ressymb) = @_; + return ''. + &discussion_link($ressymb, + ''.&mt('Post Discussion').'', + 'replydisc'). + ''; } sub send_message_link { @@ -827,13 +821,15 @@ sub action_links_bar { $discussion .= '&previous='.$prevread; } $discussion .= &group_args($group); - $discussion .='">'.&mt('Chronological View').'   - '.&mt('Chronological View').'  '; + + my $otherviewurl='/adm/feedback?cmd=sortfilter&symb='.$escsymb.'&inhibitmenu=yes&modal=yes'; if ($newpostsflag) { - $discussion .= '&previous='.$prevread; + $otherviewurl .= '&previous='.$prevread; } - $discussion .= &group_args($group); - $discussion .='">'.&mt('Sorting/Filtering options').''.(' ' x2); + $otherviewurl .= &group_args($group); + $discussion .= &Apache::loncommon::modal_link($otherviewurl,&mt('Other Views ...'),800,340); + $discussion .= '
'; } $discussion .=''. - &mt('Preferences on what is marked as NEW'). + &mt('My general preferences on what is marked as NEW'). '
'.&mt('Mark NEW posts no longer new').''; @@ -915,22 +911,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(); @@ -938,25 +934,16 @@ ENDDISCUSS } sub build_posting_display { - my ($usernamesort,$subjectsort,$namesort,$notshown,$newitem,$dischash,$shown,$alldiscussion,$imsitems,$imsfiles,$roleinfo,$discussionitems,$replies,$depth,$posters,$maxdepth,$visible,$newpostsflag,$current,$status,$viewgrades,$seeid,$prevread,$sortposts,$ressymb,$target,$readkey,$showunmark,$showonlyunread,$totposters,$rolefilter,$sectionpick,$grouppick,$classgroups,$statusfilter,$toggkey,$outputtarget,$anonhash,$anoncnt,$group) = @_; + my ($usernamesort,$subjectsort,$namesort,$notshown,$newitem,$dischash,$shown,$alldiscussion,$imsitems,$imsfiles,$roleinfo,$discussionitems,$replies,$depth,$posters,$maxdepth,$visible,$newpostsflag,$current,$status,$viewgrades,$seeid,$prevread,$sortposts,$ressymb,$readkey,$showunmark,$showonlyunread,$totposters,$rolefilter,$sectionpick,$grouppick,$classgroups,$statusfilter,$toggkey,$outputtarget,$anonhash,$anoncnt,$group) = @_; my @original=(); my @index=(); my $skip_group_check = 0; my $symb=&Apache::lonenc::check_decrypt($ressymb); my $escsymb=&escape($ressymb); -# These are the discussion contributions my %contrib=&Apache::lonnet::restore($symb,$env{'request.course.id'}, $env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'}); -# And these are the likes/unlikes - my %likes=&Apache::lonnet::dump('disclikes', - $env{'course.'.$env{'request.course.id'}.'.domain'}, - $env{'course.'.$env{'request.course.id'}.'.num'}, - '^'.$symb.':'); - my $thisuser=$env{'user.name'}.':'.$env{'user.domain'}; -# Array with likes to figure out averages, etc. - my @theselikes=(); -# Is the user allowed to see the real name behind anonymous postings? + my $see_anonymous = &Apache::lonnet::allowed('rin',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:'')); @@ -986,41 +973,7 @@ sub build_posting_display { ($skiptest,$roleregexp,$secregexp,$statusregexp) = &filter_regexp($rolefilter,$sectionpick,$statusfilter); $rolematch = $roleregexp.':'.$secregexp.':'.$statusregexp; - } -# 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++) { - my $idx=$id; - next if ($contrib{$idx.':deleted'}); - next if ($contrib{$idx.':hidden'}); - unless ((($hiddens{$idx}) && (!$seeid)) || ($deletions{$idx}) || (!$contrib{$idx.':message'})) { - push(@theselikes,$likes{$symb.':'.$idx.':likes'}); - } - } -# Figure out average likes and standard deviation if there are enough discussions to warrant that - my $ave=0; - my $stddev=10000; - if ($#theselikes>1) { - my $sum=0; - my $num=$#theselikes+1; - foreach my $thislike (@theselikes) { - $sum+=$thislike; - } - $ave=$sum/$num; - my $sumsq=0; - foreach my $thislike (@theselikes) { - $sumsq+=($thislike-$ave)*($thislike-$ave); - } - $stddev=sqrt($sumsq/$num); - } -# Now we know the average likes $ave and the standard deviation $stddev -# Get the boundaries for markup - my $oneplus=$ave+$stddev; - my $twoplus=$ave+2.*$stddev; - my $oneminus=$ave-$stddev; - my $twominus=$ave-2.*$stddev; -# -# This is now the real loop. Go through all entries, pick up what we need -# + } for (my $id=1;$id<=$contrib{'version'};$id++) { my $idx=$id; next if ($contrib{$idx.':deleted'}); @@ -1053,7 +1006,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'} =~ /:/) { @@ -1068,7 +1021,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. @@ -1078,7 +1031,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 @@ -1108,18 +1061,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}.'] '. @@ -1160,14 +1107,8 @@ sub build_posting_display { if ($outputtarget ne 'tex') { if (&editing_allowed($escsymb.':::'.$idx,$group)) { if (($env{'user.domain'} eq $contrib{$idx.':senderdomain'}) && ($env{'user.name'} eq $contrib{$idx.':sendername'})) { - $sender.=' '.&mt('Edit').''; - + $sender.=' '. + &discussion_link($symb,&mt('Edit'),'editdisc',$idx,$$newpostsflag,$prevread,&group_args($group)); unless ($seeid) { my $grpargs = &group_args($group); $sender.=" '; + $sender.=' '. + &discussion_link($symb,&mt('Make Visible'),'unhide',$idx,$$newpostsflag,$prevread,&group_args($group)); } } else { - $sender.=' '.&mt('Hide').''; + $sender.=' '. + &discussion_link($symb,&mt('Hide'),'hide',$idx,$$newpostsflag,$prevread,&group_args($group)); } my $grpargs = &group_args($group); $sender.= @@ -1200,7 +1132,7 @@ sub build_posting_display { $sender .= &mt('Delete').''; } } - } else { + } else { if ($screenname) { $sender=''.$screenname.''; } else { @@ -1227,33 +1159,24 @@ 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').''; + $sender.=' '. + &discussion_link($symb,&mt('Reply'),'replydisc',$idx,$$newpostsflag,$prevread,&group_args($group)); } elsif (&Apache::lonnet::allowed('pch', $env{'request.course.id'}. ($env{'request.course.sec'}?'/'. $env{'request.course.sec'}:''))) { - $sender.=' '.&mt('Reply').''; + $sender.=' '. + &discussion_link($symb,&mt('Reply'),'replydisc',$idx,$$newpostsflag,$prevread); } } - 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 = ''; @@ -1354,65 +1277,24 @@ sub build_posting_display { unless ($$notshown{$idx} == 1) { if ($prevread > 0 && $prevread <= $posttime) { $$newitem{$idx} = 1; - $$discussionitems[$idx] .= ' - - '; + $$discussionitems[$idx] .= ''.&mt('NEW').'  '; } else { $$newitem{$idx} = 0; - $$discussionitems[$idx] .= ' -
'.&mt('NEW').' 
- '; } - $$discussionitems[$idx] .= ''; + &Apache::lonlocal::locallocaltime($posttime).')'; if ($$dischash{$toggkey}) { - $$discussionitems[$idx].=''; - } -# Figure out size based on likes - my $thislikes=$likes{$symb.':'.$idx.':likes'}; - my $likesize="100"; - if ($thislikes>$twoplus) { - $likesize="200"; - } elsif ($thislikes>$oneplus) { - $likesize="150"; - } - if ($thislikes<$twominus) { - $likesize="50"; - } elsif ($thislikes<$oneminus) { - $likesize="75"; - } -# Actually glue in the message itself - $$discussionitems[$idx].= '
   '. - ''.$subject.'  '. + $$discussionitems[$idx] .= ''.$subject.'  '. $sender.' '.$vgrlink.' ('. - &Apache::lonlocal::locallocaltime($posttime).')  '. - $ctlink.'
'. - "
". - $message. - '
'; -# Put in the like and unlike buttons - unless ($likes{$symb.':'.$idx.':likers'}=~/\,\Q$thisuser\E\,/) { - $$discussionitems[$idx].=' '.&discussion_link($symb,''.&mt('Like').'','like',$idx,$$newpostsflag,$prevread,&group_args($group),&mt("Like this posting")); - } else { - $$discussionitems[$idx].=''.&mt('You like this posting').''; - } - unless ($likes{$symb.':'.$idx.':unlikers'}=~/\,\Q$thisuser\E\,/) { - $$discussionitems[$idx].=' '.&discussion_link($symb,''.&mt('Unlike').'','unlike',$idx,$$newpostsflag,$prevread,&group_args($group),&mt("Unlike this posting")); - } else { - $$discussionitems[$idx].=''.&mt('You unlike this posting').''; - } - my $thislikes=$likes{$symb.':'.$idx.':likes'}; - if ($thislikes>0) { - $$discussionitems[$idx].=' ('.&mt("[_1] likes",$thislikes).')'; - } elsif ($thislikes<0) { - $$discussionitems[$idx].=' ('.&mt("[_1] unlikes",abs($thislikes)).')'; + $$discussionitems[$idx].='  '.$ctlink; } + $$discussionitems[$idx].= '
'. + $message.'
'; if ($contrib{$idx.':history'}) { my @postversions = (); $$discussionitems[$idx] .= &mt('This post has been edited by the author.'); if ($seeid) { - $$discussionitems[$idx] .= '  '.&mt('Display all versions').''; + $$discussionitems[$idx] .= '  '. + &discussion_link($symb,&mt('Display all versions'),'allversions',$idx,$$newpostsflag,$prevread,&group_args($group)); } $$discussionitems[$idx].='
'.&mt('Earlier version(s) were posted on: '); if ($contrib{$idx.':history'} =~ m/:/) { @@ -1489,7 +1371,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; @@ -1507,20 +1389,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') { @@ -1775,7 +1650,7 @@ END $comment = &unescape($env{'form.comment'}); &process_attachments(\@currnewattach,\@currdelold,\@keepold); } - my $latexHelp=&Apache::loncommon::helpLatexCheatsheet(undef,undef,1); + my $latexHelp=&Apache::loncommon::helpLatexCheatsheet(undef,undef,1,($env{'form.modal'}?'popup':0)); my $send=&mt('Send'); my $alert = &mt('Please select a feedback type.'); my $js= < 'Resource Feedback and Discussion'}]; my %onload = ('onload' => 'window.focus();setposttype();'); + my %parms=('add_entries' => \%onload); + if ($env{'form.modal'} ne 'yes') { 'bread_crumbs' => $brcrum } my $start_page= - &Apache::loncommon::start_page('Resource Feedback and Discussion',$js, - {'add_entries' => \%onload, - 'bread_crumbs' => $brcrum,}); + &Apache::loncommon::start_page('Resource Feedback and Discussion',$js,\%parms); if ($quote ne '') { $quote = &HTML::Entities::decode($quote); @@ -1845,14 +1720,18 @@ END } $quote='
'.&Apache::lontexconvert::msgtexconverted($quote).'
'; } - + my $header=''; + unless ($env{'form.modal'}) { + $header="

$restitle

"; + } $r->print(<$restitle +$header
$prevtag + END if ($env{'form.replydisc'}) { $r->print(<print(< +$options $quote

$lt{'myqu'} $textareaheader @@ -1876,7 +1755,7 @@ $latexHelp

$lt{'title'}:

-

END if ( ($env{'form.editdisc'}) || ($env{'form.replydisc'}) ) { @@ -2300,7 +2179,7 @@ END $start_page $lt{'diso'}
$lt{'prca'} -

+
@@ -2365,7 +2244,8 @@ $start_page
$lt{'soor'}

-
+ + @@ -2490,6 +2370,7 @@ END $r->print(< + @@ -2675,16 +2556,14 @@ 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 %parms=('only_body' => 1); + if ($env{'form.modal'}) { + $parms{'add_entries'}={'onLoad' => 'document.forms.reldt.submit()'}; + } else { + $parms{'redirect'}=[0,$feedurl]; } my $start_page= - &Apache::loncommon::start_page('Feedback sent',undef, - {'redirect' => [0,$feedurl], - 'only_body' => 1, - 'add_entries' => \%onload}); + &Apache::loncommon::start_page('Feedback sent',undef,\%parms); my $end_page = &Apache::loncommon::end_page(); $r->print(< 1, 'bgcolor' => '#FFFFFF', @@ -2802,8 +2677,8 @@ sub screen_header { } if (!$blocked && &discussion_open(undef,$realsymb) && (&Apache::lonnet::allowed('pch', - $env{'request.course.id'}. - ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:'')) || + $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')))) { $discussoptions='