--- loncom/interface/lonfeedback.pm 2004/06/28 16:41:08 1.96 +++ loncom/interface/lonfeedback.pm 2004/07/04 23:56:58 1.97 @@ -1,7 +1,7 @@ # The LearningOnline Network # Feedback # -# $Id: lonfeedback.pm,v 1.96 2004/06/28 16:41:08 albertel Exp $ +# $Id: lonfeedback.pm,v 1.97 2004/07/04 23:56:58 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -325,54 +325,50 @@ sub list_discussion { my $color = &Apache::loncommon::designparm($function.'.tabbg', $ENV{'user.domain'}); my %lt = &Apache::lonlocal::texthash( - 'cuse' => 'Current settings for this discussion', + 'cuse' => 'Current discussion settings', 'allposts' => 'All posts', 'unread' => 'New posts only', 'ondisp' => 'Once displayed', 'onmark' => 'Once marked read', 'disa' => 'Posts to be displayed', 'npce' => 'Posts cease to be marked "NEW"', - 'chgt' => 'Change to ', + 'chgt' => 'Change', + 'disp' => 'Display', + 'nolo' => 'Not new', ); my $currdisp = $lt{'allposts'}; my $currmark = $lt{'onmark'}; my $dispchange = $lt{'unread'}; my $markchange = $lt{'ondisp'}; - my $displink = '/adm/feedback?onlyunread='.$ressymb; - my $marklink = '/adm/feedback?markondisp='.$ressymb; + my $chglink = '/adm/feedback?modifydisp='.$ressymb; + my $displink = 'onlyunread'; + my $marklink = 'markondisp'; if ($markondisp) { $currmark = $lt{'ondisp'}; $markchange = $lt{'onmark'}; - $marklink = '/adm/feedback?markonread='.$ressymb; - if ($newpostsflag) { - $marklink .= '&previous='.$prevread; - } + $marklink = 'markonread'; } if ($showonlyunread) { $currdisp = $lt{'unread'}; $dispchange = $lt{'allposts'}; - $displink = '/adm/feedback?allposts='.$ressymb; + $displink = 'allposts'; } + + $chglink .= '&changes='.$displink.'_'.$marklink; if ($newpostsflag) { - $displink .= '&previous='.$prevread; + $chglink .= '&previous='.$prevread; } if ($visible) { # Print the discusssion if ($outputtarget ne 'tex') { + my $colspan=$maxdepth+1; $discussion.=''; - my $colspan=$maxdepth+1; - $discussion .= ''. - ' + +
'. - ''. - ''. - ''. - ''. - '
'.$lt{'cuse'}.'    '.$lt{'chgt'}.'
'.$lt{'disa'}.': '.$currdisp.'    '.$dispchange.'
'.$lt{'npce'}.': '.$currmark.'    '.$markchange.'
'. + $discussion .='
'. ''; if ($visible>2) { $discussion.='
'. @@ -456,7 +452,40 @@ sub list_discussion { } } if ($outputtarget ne 'tex') { - $discussion.='


'; + my $colspan=$maxdepth+1; + $discussion .= < +
+ + + + +
+ + + + +END + if ($newpostsflag) { + $discussion .= + ''; + } else { + $discussion .= + ''; + } + $discussion .= <  + + +
+ $lt{'cuse'}: 1. '.$lt{'disp'}.' - '.$currdisp.'  2. '.$lt{'nolo'}.' - '.$currmark.''.$lt{'disp'}.' - '.$currdisp.' + $lt{'chgt'}?
+
+
+

+END } } if ($discussiononly) { @@ -611,6 +640,131 @@ $r->print(&generate_preview_button(). ''); } +sub print_display_options { + my ($r,$symb,$previous,$dispchg,$markchg,$feedurl) = @_; + my $function = &Apache::loncommon::get_users_function(); + my $tabcolor = &Apache::loncommon::designparm($function.'.tabbg', + $ENV{'user.domain'}); + my $bodytag=&Apache::loncommon::bodytag('Discussion options', + '',''); + + my %lt = &Apache::lonlocal::texthash( + 'dido' => 'Discussion display options', + 'pref' => 'Display Preference', + 'curr' => 'Current setting ', + 'actn' => 'Action', + 'deff' => 'Default for all discussions', + 'prca' => 'Preferences can be set for this discussion that determine ....', + 'whpo' => 'Which posts are displayed when you display this bulletin board or resource, and', + 'unwh' => 'Under what circumstances posts are identfied as "New."', + 'allposts' => 'All posts', + 'unread' => 'New posts only', + 'ondisp' => 'Once displayed', + 'onmark' => 'Once marked as read', + 'disa' => 'Posts displayed?', + 'npmr' => 'New posts cease to be identified as "New"?', + 'chgt' => 'Change to ', + 'mkdf' => 'Set to ', + 'yhni' => 'You have not indicated that you wish to change either of the discussion settings', + 'ywbr' => 'You will be returned to the previous page if you click OK.' + ); + + my $dispchange = $lt{'unread'}; + my $markchange = $lt{'ondisp'}; + my $currdisp = $lt{'allposts'}; + my $currmark = $lt{'onmark'}; + my $discdisp = 'allposts'; + my $discmark = 'onmark'; + + if ($dispchg eq 'allposts') { + $dispchange = $lt{'allposts'}; + $currdisp = $lt{'unread'}; + $discdisp = 'unread'; + } + + if ($markchg eq 'markonread') { + $markchange = $lt{'onmark'}; + $currmark = $lt{'ondisp'}; + $discmark = 'ondisp'; + } + $r->print(< + +$lt{'dido'} + + + +$bodytag +
+$lt{'sdpf'}
$lt{'prca'}
  1. $lt{'whpo'}
  2. $lt{'unwh'}
+
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + +
$lt{'pref'}$lt{'curr'}$lt{'actn'}?
$lt{'disa'}$lt{$discdisp} $lt{'chgt'} "$dispchange"
$lt{'npmr'}$lt{$discmark}$lt{'chgt'} "$markchange"
+
+
+
+
+ + + + +
+
+
+ + +END + return; +} + sub fail_redirect { my ($r,$feedurl) = @_; if ($feedurl=~/^\/adm\//) { $feedurl.='?register=1' }; @@ -971,58 +1125,66 @@ sub handler { # --------------------------- Get query string for limited number of parameters - &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, - ['hide','unhide','deldisc','postdata','preview','replydisc','threadedon','threadedoff','onlyunread','allposts','previous','markread','markonread','markondisp']); - - if (($ENV{'form.markondisp'}) || ($ENV{'form.markonread'})) { -# ---------------------- Modify setting for identification of 'NEW' posts in this discussion - + &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, + ['hide','unhide','deldisc','postdata','preview','replydisc','threadedon','threadedoff','onlyunread','allposts','previous','markread','markonread','markondisp','modifydisp','changes']); + if ($ENV{'form.modifydisp'}) { &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; - my $symb=$ENV{'form.markondisp'}?$ENV{'form.markondisp'}:$ENV{'form.markonread'}; - my $ressymb = $symb; + my $symb=$ENV{'form.modifydisp'}; my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb); - unless ($ressymb =~ m|bulletin___\d+___adm/wrapper|) { - $ressymb=~s|(bulletin___\d+___)|$1adm/wrapper|; - } - - my %discinfo = (); - my $lastkey = $ressymb.'_lastread'; - my $ondispkey = $ressymb.'_markondisp'; - if ($ENV{'form.markondisp'}) { - $discinfo{$lastkey} = time; - $discinfo{$ondispkey} = 1; - } elsif ($ENV{'form.markonread'}) { - if ( defined($ENV{'previous'}) ) { - $discinfo{$lastkey} = $ENV{'previous'}; - } - $discinfo{$ondispkey} = 0; - } - &Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss',\%discinfo,$ENV{'user.domain'},$ENV{'user.name'}); - if ($ENV{'form.markondisp'}) { - &redirect_back($r,&Apache::lonnet::clutter($url),&mt('Changed display status').'
','0','0'); - } else { - &redirect_back($r,&Apache::lonnet::clutter($url),&mt('Changed display status').'
','0','0','',$ENV{'form.previous'}); - } + my $previous=$ENV{'form.previous'}; + my ($dispchg,$markchg) = split/_/,$ENV{'form.changes'}; + my $feedurl = &Apache::lonnet::clutter($url); + &print_display_options($r,$symb,$previous,$dispchg,$markchg,$feedurl); return OK; - } elsif (($ENV{'form.allposts'}) || ($ENV{'form.onlyunread'})) { -# ----------------------------------------------------------------- Modify display setting for this discussion + } elsif (($ENV{'form.markondisp'}) || ($ENV{'form.markonread'}) || ($ENV{'form.allposts'}) || ($ENV{'form.onlyunread'}) ) { &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; - my $symb=$ENV{'form.allposts'}?$ENV{'form.allposts'}:$ENV{'form.onlyunread'}; - my $ressymb = $symb; - my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb); - unless ($ressymb =~ m|bulletin___\d+___adm/wrapper|) { - $ressymb=~s|(bulletin___\d+___)|$1adm/wrapper|; + my $previous=$ENV{'form.previous'}; + my ($map,$ind,$url); + if (($ENV{'form.markondisp'}) || ($ENV{'form.markonread'})) { +# ---------------------- Modify setting for identification of 'NEW' posts in this discussion + my $symb=$ENV{'form.markondisp'}?$ENV{'form.markondisp'}:$ENV{'form.markonread'}; + my $ressymb = $symb; + ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb); + unless ($ressymb =~ m|bulletin___\d+___adm/wrapper|) { + $ressymb=~s|(bulletin___\d+___)|$1adm/wrapper|; + } + my %discinfo = (); + my $lastkey = $ressymb.'_lastread'; + my $ondispkey = $ressymb.'_markondisp'; + if ($ENV{'form.markondisp'}) { + $discinfo{$lastkey} = time; + $discinfo{$ondispkey} = 1; + } elsif ($ENV{'form.markonread'}) { + if ( $previous > 0 ) { + $discinfo{$lastkey} = $previous; + } + $discinfo{$ondispkey} = 0; + } + &Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss',\%discinfo,$ENV{'user.domain'},$ENV{'user.name'}); + } + if (($ENV{'form.allposts'}) || ($ENV{'form.onlyunread'})) { +# ----------------------------------------------------------------- Modify display setting for this discussion + my $symb=$ENV{'form.allposts'}?$ENV{'form.allposts'}:$ENV{'form.onlyunread'}; + my $ressymb = $symb; + ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb); + unless ($ressymb =~ m|bulletin___\d+___adm/wrapper|) { + $ressymb=~s|(bulletin___\d+___)|$1adm/wrapper|; + } + my %discinfo = (); + if ($ENV{'form.allposts'}) { + $discinfo{$ressymb.'_showonlyunread'} = 0; + } elsif ($ENV{'form.onlyunread'}) { + $discinfo{$ressymb.'_showonlyunread'} = 1; + } + &Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss',\%discinfo,$ENV{'user.domain'},$ENV{'user.name'}); } - my %discinfo = (); - if ($ENV{'form.allposts'}) { - $discinfo{$ressymb.'_showonlyunread'} = 0; - } elsif ($ENV{'form.onlyunread'}) { - $discinfo{$ressymb.'_showonlyunread'} = 1; + if (($ENV{'form.markonread'}) || ($ENV{'form.allposts'}) || ($ENV{'form.onlyunread'}) ) { + &redirect_back($r,&Apache::lonnet::clutter($url),&mt('Changed display status').'
','0','0','',$previous); + } else { + &redirect_back($r,&Apache::lonnet::clutter($url),&mt('Changed display status').'
','0','0'); } - &Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss',\%discinfo,$ENV{'user.domain'},$ENV{'user.name'}); - &redirect_back($r,&Apache::lonnet::clutter($url),&mt('Changed display status').'
','0','0','',$ENV{'form.previous'}); return OK; } elsif ($ENV{'form.markread'}) { # ----------------------------------------------------------------- Mark new posts as read