--- loncom/interface/lonfeedback.pm 2012/03/17 04:02:28 1.349 +++ loncom/interface/lonfeedback.pm 2012/03/17 04:55:10 1.350 @@ -1,7 +1,7 @@ # The LearningOnline Network # Feedback # -# $Id: lonfeedback.pm,v 1.349 2012/03/17 04:02:28 raeburn Exp $ +# $Id: lonfeedback.pm,v 1.350 2012/03/17 04:55:10 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -513,7 +513,9 @@ imscp_v1p1.xsd http://www.imsglobal.org/ my $currdepth = 0; my $firstidx = $alldiscussion{$showposts[0]}; foreach my $post (@showposts) { - unless (($sortposts eq 'thread') || (($sortposts eq '') && ($env{'environment.threadeddiscussion'})) || ($outputtarget eq 'export')) { + unless (($sortposts eq 'thread') || + (($sortposts eq '') && (!$env{'environment.unthreadeddiscussion'})) || + ($outputtarget eq 'export')) { $alldiscussion{$post} = $post; } unless ( ($notshown{$alldiscussion{$post}} eq '1') || ($shown{$alldiscussion{$post}} == 0) ) { @@ -1117,7 +1119,8 @@ sub build_posting_display { my $origindex='0.'; my $numoldver=0; if ($contrib{$idx.':replyto'}) { - if ( (($env{'environment.threadeddiscussion'}) && ($sortposts eq '')) || ($sortposts eq 'thread') || ($outputtarget eq 'export')) { + if ( ((!$env{'environment.unthreadeddiscussion'}) && ($sortposts eq '')) || + ($sortposts eq 'thread') || ($outputtarget eq 'export')) { # this is a follow-up message $original[$idx]=$original[$contrib{$idx.':replyto'}]; $$depth[$idx]=$$depth[$contrib{$idx.':replyto'}]+1; @@ -1330,7 +1333,8 @@ sub build_posting_display { } if ($outputtarget eq 'export' || $message) { my $thisindex=$idx; - if ( (($env{'environment.threadeddiscussion'}) && ($sortposts eq '')) || ($sortposts eq 'thread') || ($outputtarget eq 'export')) { + if ( ((!$env{'environment.unthreadeddiscussion'}) && ($sortposts eq '')) || + ($sortposts eq 'thread') || ($outputtarget eq 'export')) { $thisindex=$origindex.substr('00'.$$replies[$$depth[$idx]],-2,2); } $$alldiscussion{$thisindex}=$idx; @@ -4248,12 +4252,16 @@ ENDREDIR return OK; } elsif ($env{'form.cmd'}=~/^(threadedoff|threadedon)$/) { my ($symb,$feedurl)=&get_feedurl_and_clean_symb($env{'form.symb'}); - if ($env{'form.cmd'} eq 'threadedon') { + if ($env{'form.cmd'} eq 'threadedoff') { + &Apache::lonnet::put('environment',{'unthreadeddiscussion' => 'on'}); + &Apache::lonnet::appenv({'environment.unthreadeddiscussion' => 'on'}); + &Apache::lonnet::del('environment',['threadeddiscussion']); + &Apache::lonnet::delenv('environment.threadeddiscussion'); + } else { &Apache::lonnet::put('environment',{'threadeddiscussion' => 'on'}); &Apache::lonnet::appenv({'environment.threadeddiscussion' => 'on'}); - } else { - &Apache::lonnet::del('environment',['threadeddiscussion']); - &Apache::lonnet::delenv('environment.threadeddiscussion'); + &Apache::lonnet::del('environment',['unthreadeddiscussion']); + &Apache::lonnet::delenv('environment.unthreadeddiscussion'); } &redirect_back($r,$feedurl,&mt('Changed discussion view mode').'
', '0','0','','',$env{'form.previous'},undef,undef,undef,