--- loncom/interface/lonfeedback.pm 2004/11/15 21:35:37 1.133 +++ loncom/interface/lonfeedback.pm 2004/11/15 22:48:51 1.137 @@ -1,7 +1,7 @@ # The LearningOnline Network # Feedback # -# $Id: lonfeedback.pm,v 1.133 2004/11/15 21:35:37 albertel Exp $ +# $Id: lonfeedback.pm,v 1.137 2004/11/15 22:48:51 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -355,23 +355,22 @@ imscp_v1p1.xsd http://www.imsglobal.org/ } |; - #FIXME need a
'; $discussion .='
'. ''; if ($visible>2) { $discussion.=''; if ($newpostsflag) { if (!$markondisp) { - $discussion .=''; } @@ -562,8 +561,7 @@ END
'. - '  '. - '   -   '.&mt('Mark NEW posts no longer new').'  '; + $discussion .=''.&mt('Mark NEW posts no longer new').'  '; } else { $discussion .= ' 
-

- +

END } if ($outputtarget eq 'export') { @@ -1477,7 +1475,8 @@ END sub print_display_options { my ($r,$symb,$previous,$dispchgA,$dispchgB,$markchg,$toggchg,$feedurl) = @_; - &dewrapper(\$feedurl); + &Apache::loncommon::content_type($r,'text/html'); + $r->send_http_header; my $function = &Apache::loncommon::get_users_function(); my $tabcolor = &Apache::loncommon::designparm($function.'.tabbg', @@ -1658,6 +1657,7 @@ $lt{'sdpf'}
$lt{'prca'}
  1. $l


+ @@ -1676,7 +1676,9 @@ END sub print_sortfilter_options { my ($r,$symb,$previous,$feedurl) = @_; - &dewrapper(\$feedurl); + &Apache::loncommon::content_type($r,'text/html'); + $r->send_http_header; + my @sections = (); my $section_sel = ''; my $numsections = 0; @@ -1999,6 +2001,9 @@ sub redirect_back { my $qrystr = ''; my $prevtag = ''; + &Apache::loncommon::content_type($r,'text/html'); + $r->send_http_header; + &dewrapper(\$feedurl); if ($feedurl=~/^\/adm\//) { $feedurl.='?register=1' }; if ($previous > 0) { @@ -2398,6 +2403,8 @@ sub adddiscuss { sub show_preview { my $r=shift; + &Apache::loncommon::content_type($r,'text/html'); + $r->send_http_header; my $message=&clear_out_html($ENV{'form.comment'}); $message=~s/\n/\
/g; $message=&Apache::lonspeller::markeduptext($message); @@ -2731,7 +2738,7 @@ sub handler { # --------------------------- Get query string for limited number of parameters &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, - ['hide','unhide','deldisc','postdata','preview','replydisc','editdisc','threadedon','threadedoff','onlyunread','allposts','onlyunmark','previous','markread','markonread','markondisp','toggoff','toggon','modifydisp','changes','navtime','navmaps','navurl','sortfilter','sortposts','applysort','rolefilter','statusfilter','sectionpick','posterlist','userpick','attach','origpage','currnewattach','deloldattach','keepold','allversions','export']); + ['hide','unhide','deldisc','postdata','preview','replydisc','editdisc','cmd','symb','onlyunread','allposts','onlyunmark','previous','markread','markonread','markondisp','toggoff','toggon','modifydisp','changes','navtime','navmaps','navurl','sortposts','applysort','rolefilter','statusfilter','sectionpick','posterlist','userpick','attach','origpage','currnewattach','deloldattach','keepold','allversions','export']); if ($ENV{'form.discsymb'}) { my ($symb,$feedurl) = &get_feedurl_and_clean_symb($ENV{'form.discsymb'}); my $readkey = $symb.'_read'; @@ -2754,8 +2761,6 @@ sub handler { &Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss', \%readinghash,$ENV{'user.domain'},$ENV{'user.name'}); } - &Apache::loncommon::content_type($r,'text/html'); - $r->send_http_header; &redirect_back($r,$feedurl,&mt('Marked postings read/unread').'
', '0','0','',$ENV{'form.previous'},'','','',); return OK; @@ -2795,16 +2800,12 @@ END return OK; } if ($ENV{'form.posterlist'}) { - &Apache::loncommon::content_type($r,'text/html'); - $r->send_http_header; my ($symb,$feedurl)=&get_feedurl_and_clean_symb($ENV{'form.applysort'}); &print_showposters($r,$symb,$ENV{'form.previous'},$feedurl, $ENV{'form.sortposts'}); return OK; } if ($ENV{'form.userpick'}) { - &Apache::loncommon::content_type($r,'text/html'); - $r->send_http_header; my @posters = &Apache::loncommon::get_env_multiple('form.stuinfo'); my ($symb,$feedurl)=&get_feedurl_and_clean_symb($ENV{'form.userpick'}); my $numpicks = @posters; @@ -2818,18 +2819,14 @@ END return OK; } if ($ENV{'form.applysort'}) { - &Apache::loncommon::content_type($r,'text/html'); - $r->send_http_header; my ($symb,$feedurl)=&get_feedurl_and_clean_symb($ENV{'form.applysort'}); &redirect_back($r,$feedurl,&mt('Changed sort/filter').'
','0','0', '',$ENV{'form.previous'},$ENV{'form.sortposts'}, $ENV{'form.rolefilter'},$ENV{'form.statusfilter'}, $ENV{'form.secpick'}); return OK; - } elsif ($ENV{'form.sortfilter'}) { - &Apache::loncommon::content_type($r,'text/html'); - $r->send_http_header; - my ($symb,$feedurl)=&get_feedurl_and_clean_symb($ENV{'form.sortfilter'}); + } elsif ($ENV{'form.cmd'} eq 'sortfilter') { + my ($symb,$feedurl)=&get_feedurl_and_clean_symb($ENV{'form.symb'}); &print_sortfilter_options($r,$symb,$ENV{'form.previous'},$feedurl); return OK; } elsif ($ENV{'form.navtime'}) { @@ -2891,8 +2888,6 @@ $textline ENDREDIR return OK; } elsif ($ENV{'form.modifydisp'}) { - &Apache::loncommon::content_type($r,'text/html'); - $r->send_http_header; my ($symb,$feedurl)=&get_feedurl_and_clean_symb($ENV{'form.modifydisp'}); my ($dispchgA,$dispchgB,$markchg,$toggchg) = split(/_/,$ENV{'form.changes'}); @@ -2902,86 +2897,41 @@ ENDREDIR } elsif ($ENV{'form.markondisp'} || $ENV{'form.markonread'} || $ENV{'form.allposts'} || $ENV{'form.onlyunread'} || $ENV{'form.onlyunmark'} || $ENV{'form.toggoff'} || - $ENV{'form.toggon'} ) { - &Apache::loncommon::content_type($r,'text/html'); - $r->send_http_header; - my $feedurl; - if ( ($ENV{'form.toggoff'}) || ($ENV{'form.toggon'}) ) { + $ENV{'form.toggon'} || $ENV{'form.markread'}) { + my ($symb,$feedurl)=&get_feedurl_and_clean_symb($ENV{'form.symb'}); + my %discinfo; # ------------------------ Modify setting for read/unread toggle for each post - my $symb=$ENV{'form.toggoff'}?$ENV{'form.toggoff'}:$ENV{'form.toggon'}; - ($symb,$feedurl)=&get_feedurl_and_clean_symb($symb); - my %discinfo; - $discinfo{$symb.'_readtoggle'}=1; - if ($ENV{'form.toggoff'}) { $discinfo{$symb.'_readtoggle'}=0; } - &Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss', - \%discinfo,$ENV{'user.domain'},$ENV{'user.name'}); - } - if (($ENV{'form.markondisp'}) || ($ENV{'form.markonread'})) { + if ($ENV{'form.toggoff'}) { $discinfo{$symb.'_readtoggle'}=1; } + if ($ENV{'form.toggon'}) { $discinfo{$symb.'_readtoggle'}=0; } # --------- Modify setting for identification of 'NEW' posts in this discussion - my $symb=$ENV{'form.markondisp'}?$ENV{'form.markondisp'}:$ENV{'form.markonread'}; - ($symb,$feedurl)=&get_feedurl_and_clean_symb($symb); - my %discinfo; - my $lastkey = $symb.'_lastread'; - my $ondispkey = $symb.'_markondisp'; - if ($ENV{'form.markondisp'}) { - $discinfo{$lastkey} = time; - $discinfo{$ondispkey} = 1; - } elsif ($ENV{'form.markonread'}) { - if ( $ENV{'form.previous'} > 0 ) { - $discinfo{$lastkey} = $ENV{'form.previous'}; - } - $discinfo{$ondispkey} = 0; - } - &Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss', - \%discinfo,$ENV{'user.domain'},$ENV{'user.name'}); + if ($ENV{'form.markondisp'}) { + $discinfo{$symb.'_lastread'} = time; + $discinfo{$symb.'_markondisp'} = 1; + } + if ($ENV{'form.markonread'}) { + if ( $ENV{'form.previous'} > 0 ) { + $discinfo{$symb.'_lastread'} = $ENV{'form.previous'}; + } + $discinfo{$symb.'_markondisp'} = 0; } - if ($ENV{'form.allposts'} || $ENV{'form.onlyunread'} || - $ENV{'form.onlyunmark'}) { # --------------------------------- Modify display setting for this discussion - my $symb; - if ($ENV{'form.allposts'}) { - $symb = $ENV{'form.allposts'}; - } elsif ($ENV{'form.onlyunread'}) { - $symb = $ENV{'form.onlyunread'}; - } else { - $symb = $ENV{'form.onlyunmark'}; - } - ($symb,$feedurl)=&get_feedurl_and_clean_symb($symb); - my %discinfo; - if ($ENV{'form.allposts'}) { - $discinfo{$symb.'_showonlyunread'} = 0; - $discinfo{$symb.'_showonlyunmark'} = 0; - } elsif ($ENV{'form.onlyunread'}) { - $discinfo{$symb.'_showonlyunread'} = 1; - } else { - $discinfo{$symb.'_showonlyunmark'} = 1; - } - &Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss', - \%discinfo,$ENV{'user.domain'},$ENV{'user.name'}); + if ($ENV{'form.allposts'}) { + $discinfo{$symb.'_showonlyunread'} = 0; + $discinfo{$symb.'_showonlyunmark'} = 0; } + if ($ENV{'form.onlyunread'}) { $discinfo{$symb.'_showonlyunread'} = 1; } + if ($ENV{'form.onlyunmark'}) { $discinfo{$symb.'_showonlyunmark'} = 1; } +# ----------------------------------------------------- Mark new posts not NEW + if ($ENV{'form.markread'}) { $discinfo{$symb.'_lastread'} = time; } + &Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss', + \%discinfo,$ENV{'user.domain'},$ENV{'user.name'}); my $previous=$ENV{'form.previous'}; if ($ENV{'form.markondisp'}) { $previous=undef; } &redirect_back($r,$feedurl,&mt('Changed display status').'
', '0','0','',$previous); return OK; - } elsif ($ENV{'form.markread'}) { -# ----------------------------------------------------- Mark new posts not NEW - &Apache::loncommon::content_type($r,'text/html'); - $r->send_http_header; - my ($symb,$feedurl)=&get_feedurl_and_clean_symb($ENV{'form.markread'}); - &Apache::lonnet::logthis("\n last read w symb ".$symb); - my %discinfo; - $discinfo{$symb.'_lastread'} = time; - &Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss', - \%discinfo,$ENV{'user.domain'},$ENV{'user.name'}); - &redirect_back($r,$feedurl,&mt('Changed reading status').'
', - '0','0'); - return OK; } elsif (($ENV{'form.hide'}) || ($ENV{'form.unhide'})) { # ----------------------------------------------------------------- Hide/unhide - &Apache::loncommon::content_type($r,'text/html'); - $r->send_http_header; - my $entry=$ENV{'form.hide'}?$ENV{'form.hide'}:$ENV{'form.unhide'}; my ($symb,$idx)=split(/\:\:\:/,$entry); ($symb,my $feedurl)=&get_feedurl_and_clean_symb($symb); @@ -3019,43 +2969,37 @@ ENDREDIR &redirect_back($r,$feedurl,&mt('Changed discussion status').'
', '0','0','',$ENV{'form.previous'}); - } elsif (($ENV{'form.threadedon'}) || ($ENV{'form.threadedoff'})) { - &Apache::loncommon::content_type($r,'text/html'); - $r->send_http_header; - my $symb; - if ($ENV{'form.threadedon'}) { - $symb=$ENV{'form.threadedon'}; + 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') { &Apache::lonnet::put('environment',{'threadeddiscussion' => 'on'}); &Apache::lonnet::appenv('environment.threadeddiscussion' => 'on'); } else { - $symb=$ENV{'form.threadedoff'}; &Apache::lonnet::del('environment',['threadeddiscussion']); &Apache::lonnet::delenv('environment\.threadeddiscussion'); } - my ($symb,$feedurl)=&get_feedurl_and_clean_symb($symb); &redirect_back($r,$feedurl,&mt('Changed discussion view mode').'
', '0','0','',$ENV{'form.previous'}); + return OK; } elsif ($ENV{'form.deldisc'}) { # --------------------------------------------------------------- Hide for good - &Apache::loncommon::content_type($r,'text/html'); - $r->send_http_header; - my ($symb,$idx)=split(/\:\:\:/,$ENV{'form.deldisc'}); ($symb,my $feedurl)=&get_feedurl_and_clean_symb($symb); my %contrib=&Apache::lonnet::restore($symb,$ENV{'request.course.id'}, $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, $ENV{'course.'.$ENV{'request.course.id'}.'.num'}); - my %newhash=('deleted' => $contrib{'deleted'}.".$idx."); - &Apache::lonnet::store(\%newhash,$symb,$ENV{'request.course.id'}, - $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, - $ENV{'course.'.$ENV{'request.course.id'}.'.num'}); - &redirect_back($r,$feedurl,&mt('Changed discussion status').'
', - '0','0','',$ENV{'form.previous'}); + my %newhash=('deleted' => $contrib{'deleted'}.".$idx."); + &Apache::lonnet::store(\%newhash,$symb,$ENV{'request.course.id'}, + $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, + $ENV{'course.'.$ENV{'request.course.id'}.'.num'}); + &redirect_back($r,$feedurl,&mt('Changed discussion status').'
', + '0','0','',$ENV{'form.previous'}); + return OK; } elsif ($ENV{'form.preview'}) { # -------------------------------------------------------- User wants a preview - &Apache::loncommon::content_type($r,'text/html'); - $r->send_http_header; &show_preview($r); + return OK; } elsif ($ENV{'form.attach'}) { # -------------------------------------------------------- Work on attachments &Apache::loncommon::content_type($r,'text/html'); @@ -3081,6 +3025,7 @@ ENDREDIR } &modify_attachments($r,\@currnewattach,\@currdelold,$symb,$idx, $attachmenturls); + return OK; } elsif ($ENV{'form.export'}) { &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; @@ -3096,7 +3041,6 @@ ENDREDIR my $bodytag=&Apache::loncommon::bodytag('Resource Feedback and Discussion'); $r->print($bodytag.$discussion); return OK; - #FIXME deleted CHGREADS needs to be readded } else { # ------------------------------------------------------------- Normal feedback my $feedurl=$ENV{'form.postdata'}; @@ -3141,9 +3085,6 @@ ENDREDIR return OK; } # Go ahead with feedback, no ambiguous reference - &Apache::loncommon::content_type($r,'text/html'); - $r->send_http_header; - unless ( ( ($feedurl=~m:^/res:) && ($feedurl!~m:^/res/adm:) @@ -3153,11 +3094,15 @@ ENDREDIR || ($ENV{'request.course.id'} && ($symb=~/^bulletin\_\_\_/)) ) { + &Apache::loncommon::content_type($r,'text/html'); + $r->send_http_header; # Unable to give feedback &no_redirect_back($r,$feedurl); } # --------------------------------------------------- Print login screen header unless ($ENV{'form.sendit'}) { + &Apache::loncommon::content_type($r,'text/html'); + $r->send_http_header; my $options=&screen_header($feedurl); if ($options) { &mail_screen($r,$feedurl,$options);