';
+ }
+ }
if ($dischash{$toggkey}) {
my $storebutton = &mt('Store read/unread changes');
$discussion.='
'.
@@ -579,27 +650,31 @@ END
|;
close($manifestfile);
+ if ((defined($imsextras)) && ($$imsextras{'caller'} eq 'imsexport')) {
+ $discussion = $copyresult;
+ } else {
#Create zip file in prtspool
- my $imszipfile = '/prtspool/'.
- $ENV{'user.name'}.'_'.$ENV{'user.domain'}.'_'.
- time.'_'.rand(1000000000).'.zip';
+ my $imszipfile = '/prtspool/'.
+ $ENV{'user.name'}.'_'.$ENV{'user.domain'}.'_'.
+ time.'_'.rand(1000000000).'.zip';
# zip can cause an sh launch which can pass along all of %ENV
# which can be too large for /bin/sh to handle
- my %oldENV=%ENV;
- undef(%ENV);
- my $cwd = &getcwd();
- my $imszip = '/home/httpd/'.$imszipfile;
- chdir $tempexport;
- open(OUTPUT, "zip -r $imszip * 2> /dev/null |");
- close(OUTPUT);
- chdir $cwd;
- %ENV=%oldENV;
- undef(%oldENV);
- $discussion .= 'Download the zip file from Discussion Posting Archive ';
- if ($copyresult) {
- $discussion .= 'The following errors occurred during export - '.$copyresult;
+ my %oldENV=%ENV;
+ undef(%ENV);
+ my $cwd = &getcwd();
+ my $imszip = '/home/httpd/'.$imszipfile;
+ chdir $tempexport;
+ open(OUTPUT, "zip -r $imszip * 2> /dev/null |");
+ close(OUTPUT);
+ chdir $cwd;
+ %ENV=%oldENV;
+ undef(%oldENV);
+ $discussion .= 'Download the zip file from Discussion Posting Archive ';
+ if ($copyresult) {
+ $discussion .= 'The following errors occurred during export - '.$copyresult;
+ }
}
} else {
$discussion .= ' Unfortunately you will not be able to retrieve an archive of the discussion posts at this time, because there was a problem creating a manifest file. ';
@@ -639,42 +714,42 @@ to course faculty Title:
';
}
}
@@ -684,7 +759,6 @@ 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,$statusfilter,$toggkey,$outputtarget) = @_;
-
my @original=();
my @index=();
my $symb=&Apache::lonenc::check_decrypt($ressymb);
@@ -697,6 +771,11 @@ sub build_posting_display {
if ($prevread eq '0') {
$prevread = $oldest-1;
}
+ my ($skiptest,$rolematch,$roleregexp,$secregexp,$statusregexp);
+ if ($sortposts) {
+ ($skiptest,$roleregexp,$secregexp,$statusregexp) = &filter_regexp($rolefilter,$sectionpick,$statusfilter);
+ $rolematch = $roleregexp.':'.$secregexp.':'.$statusregexp;
+ }
for (my $id=1;$id<=$contrib{'version'};$id++) {
my $idx=$id;
my $posttime = $contrib{$idx.':timestamp'};
@@ -709,7 +788,7 @@ sub build_posting_display {
my $origindex='0.';
my $numoldver=0;
if ($contrib{$idx.':replyto'}) {
- if ( (($ENV{'environment.threadeddiscussion'}) && (($sortposts eq '') || ($sortposts eq 'ascdate'))) || ($sortposts eq 'thread') || ($outputtarget eq 'export')) {
+ if ( (($ENV{'environment.threadeddiscussion'}) && ($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;
@@ -895,16 +974,16 @@ sub build_posting_display {
$contrib{$idx.':sendername'},$contrib{$idx.':senderdomain'},$ressymb);
}
if ($$dischash{$readkey}=~/\.$idx\./) {
- $ctlink = ''.&mt('Mark unread').'? ';
+ $ctlink = '';
} else {
- $ctlink = ''.&mt('Mark read').'? ';
+ $ctlink = '';
}
}
#figure out at what position this needs to print
}
if ($outputtarget eq 'export' || $message) {
my $thisindex=$idx;
- if ( (($ENV{'environment.threadeddiscussion'}) && (($sortposts eq '') || ($sortposts eq 'ascdate'))) || ($sortposts eq 'thread') || ($outputtarget eq 'export')) {
+ if ( (($ENV{'environment.threadeddiscussion'}) && ($sortposts eq '')) || ($sortposts eq 'thread') || ($outputtarget eq 'export')) {
$thisindex=$origindex.substr('00'.$$replies[$$depth[$idx]],-2,2);
}
$$alldiscussion{$thisindex}=$idx;
@@ -945,48 +1024,33 @@ sub build_posting_display {
my $uname = $contrib{$idx.':sendername'};
my $udom = $contrib{$idx.':senderdomain'};
my $poster = $uname.':'.$udom;
- my $rolematch = '';
- my $skiptest = 1;
- if ($totposters > 0) {
- if (grep/^$poster$/,@{$posters}) {
- $$shown{$idx} = 1;
- }
- } else {
- if ($rolefilter) {
- if ($rolefilter eq 'all') {
- $rolematch = '([^:]+)';
- } else {
- $rolematch = $rolefilter;
- $skiptest = 0;
- }
- }
- if ($sectionpick) {
- if ($sectionpick eq 'all') {
- $rolematch .= ':([^:]*)';
- } else {
- $rolematch .= ':'.$sectionpick;
- $skiptest = 0;
- }
- }
- if ($statusfilter) {
- if ($statusfilter eq 'all') {
- $rolematch .= ':([^:]+)';
- } else {
- $rolematch .= ':'.$statusfilter;
- $skiptest = 0;
+ if (defined($ENV{'form.totposters'})) {
+ if ($totposters == 0) {
+ $$shown{$idx} = 0;
+ } elsif ($totposters > 0) {
+ if (grep/^$poster$/,@{$posters}) {
+ $$shown{$idx} = 1;
}
}
+ } elsif ($sortposts) {
if ($skiptest) {
$$shown{$idx} = 1;
} else {
foreach my $role (@{$$roleinfo{$poster}}) {
- &Apache::lonnet::logthis("\n rolematch $rolematch\nrole $role");
- if ($role =~ m/^$rolematch$/) {
+ if ($role =~ /^cc:/) {
+ my $cc_regexp = $roleregexp.':[^:]*:'.$statusregexp;
+ if ($role =~ /$cc_regexp/) {
+ $$shown{$idx} = 1;
+ last;
+ }
+ } elsif ($role =~ /^$rolematch$/) {
$$shown{$idx} = 1;
last;
}
}
}
+ } else {
+ $$shown{$idx} = 1;
}
}
unless ($$notshown{$idx} == 1) {
@@ -1036,6 +1100,60 @@ sub build_posting_display {
}
}
+sub filter_regexp {
+ my ($rolefilter,$sectionpick,$statusfilter) = @_;
+ my ($roleregexp,$secregexp,$statusregexp);
+ my $skiptest = 1;
+ if (@{$rolefilter} > 0) {
+ my @okrolefilter = ();
+ foreach (@{$rolefilter}) {
+ unless ($_ eq '') {
+ push @okrolefilter, $_;
+ }
+ }
+ if (@okrolefilter > 0) {
+ if (grep/^all$/,@okrolefilter) {
+ $roleregexp='[^:]+';
+ } else {
+ if (@okrolefilter == 1) {
+ $roleregexp=$okrolefilter[0];
+ } else {
+ $roleregexp='('.join('|',@okrolefilter).')';
+ }
+ $skiptest = 0;
+ }
+ }
+ }
+ if (@{$sectionpick} > 0) {
+ my @oksectionpick = ();
+ foreach (@{$sectionpick}) {
+ unless ($_ eq '') {
+ push @oksectionpick, $_;
+ }
+ }
+ if ((@oksectionpick > 0) && (!grep/^all$/,@oksectionpick)) {
+ if (@oksectionpick == 1) {
+ $secregexp = $oksectionpick[0];
+ } else {
+ $secregexp .= '('.join('|',@oksectionpick).')';
+ }
+ $skiptest = 0;
+ } else {
+ $secregexp .= '[^:]*';
+ }
+ }
+ if (defined($statusfilter) && $statusfilter ne '') {
+ if ($statusfilter eq 'all') {
+ $statusregexp = '[^:]+';
+ } else {
+ $statusregexp = $statusfilter;
+ $skiptest = 0;
+ }
+ }
+ return ($skiptest,$roleregexp,$secregexp,$statusregexp);
+}
+
+
sub get_post_contents {
my ($contrib,$idx,$seeid,$type,$messages,$subjects,$allattachments,$attachtxt,$imsfiles,$screenname,$plainname,$numver) = @_;
my $discussion = '';
@@ -1635,18 +1753,18 @@ $lt{'sdpf'} $lt{'prca'}
$l
$lt{'disa'}
$lt{$discdisp}
-
$lt{'chgt'} "$dispchangeA"
+
- $lt{'chgt'} "$dispchangeB"
+
$lt{'npmr'}
$lt{$discmark}
-
$lt{'chgt'} "$markchange"
+
$lt{'dotm'}
$lt{$disctogg}
-
$lt{'chgt'} "$toggchange"
+
@@ -1657,6 +1775,7 @@ $lt{'sdpf'} $lt{'prca'}
$l
+
@@ -1678,34 +1797,18 @@ sub print_sortfilter_options {
&Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
+ &Apache::lonenc::check_encrypt(\$symb);
my @sections = ();
my $section_sel = '';
my $numsections = 0;
my $numvisible = 5;
- my ($classlist) = &Apache::loncoursedata::get_classlist(
- $ENV{'request.course.id'},
- $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
- $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
-
- my $sec_index = &Apache::loncoursedata::CL_SECTION();
- my $status_index = &Apache::loncoursedata::CL_STATUS();
my %sectioncount = ();
- while (my ($student,$data) = each %$classlist) {
- my ($section,$status) = ($data->[$sec_index],
- $data->[$status_index]);
- unless ($section eq '' || $section =~ /^\s*$/) {
- if (!defined($sectioncount{$section})) {
- $sectioncount{$section} = 1;
- $numsections ++;
- } else {
- $sectioncount{$section} ++;
- }
- }
- }
-
- if ($ENV{'request.course.sec'} !~ /^\s*$/) {
- @sections = ($ENV{'request.course.sec'});
- $numvisible = 1;
+
+ $numsections = &Apache::loncommon::get_sections($ENV{'course.'.$ENV{'request.course.id'}.'.domain'},$ENV{'course.'.$ENV{'request.course.id'}.'.num'},\%sectioncount);
+
+ if ($ENV{'request.course.sec'} !~ /^\s*$/) { #Restrict section choice to current section
+ @sections = ('all',$ENV{'request.course.sec'});
+ $numvisible = 2;
} else {
@sections = sort {$a cmp $b} keys(%sectioncount);
unshift(@sections,'all'); # Put 'all' at the front of the list
@@ -1727,19 +1830,49 @@ sub print_sortfilter_options {
'diop' => 'Display Options',
'curr' => 'Current setting ',
'actn' => 'Action',
- 'prca' => 'Options can be set that control the sort order of the posts, in addition to which posts are displayed.',
+ 'prca' => 'Set options that control the sort order of posts, and/or which posts are displayed.',
'soor' => 'Sort order',
- 'disp' => 'Specific user roles',
- 'actv' => 'Specific role status',
+ 'spur' => 'Specific user roles',
+ 'sprs' => 'Specific role status',
'spse' => 'Specific sections',
'psub' => 'Pick specific users (by name)',
'shal' => 'Show a list of current posters'
);
+
+ my %sort_types = ();
+ my %role_types = ();
+ my %status_types = ();
+ &sort_filter_names(\%sort_types,\%role_types,\%status_types);
+
$r->print(<$lt{'diso'}
+
$bodytag
@@ -1814,15 +1948,14 @@ END
sub print_showposters {
my ($r,$symb,$previous,$feedurl,$sortposts) = @_;
-# backward compatibility (bulletin boards used to be 'wrapped')
- my $ressymb=&wrap_symb($symb);
+ &Apache::lonenc::check_encrypt(\$symb);
my $crs='/'.$ENV{'request.course.id'};
if ($ENV{'request.course.sec'}) {
$crs.='_'.$ENV{'request.course.sec'};
}
$crs=~s/\_/\//g;
my $seeid=&Apache::lonnet::allowed('rin',$crs);
- my %contrib=&Apache::lonnet::restore($ressymb,$ENV{'request.course.id'},
+ 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 %namesort = ();
@@ -1891,7 +2024,7 @@ END
next;
} else {
$count ++;
- $r->print('
'.$count.'
'.$last.', '.$first.' ('.$uname.','.$udom.')
'.$postcounts{$_}.'
');
+ $r->print('
'.$count.'
'.$last.', '.$first.' ('.$uname.','.$udom.')
'.$postcounts{$_}.'
');
}
}
}
@@ -1972,9 +2105,10 @@ sub get_post_attachments {
return;
}
-sub fail_redirect {;
+sub fail_redirect {
my ($r,$feedurl) = @_;
if ($feedurl=~/^\/adm\//) { $feedurl.='?register=1' };
+ my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');
$r->print (<Feedback not sent
@@ -1982,7 +2116,7 @@ sub fail_redirect {;
-
+
Sorry, no recipients ... Continue
@@ -1991,7 +2125,7 @@ ENDFAILREDIR
}
sub redirect_back {
- my ($r,$feedurl,$typestyle,$sendsomething,$sendposts,$status,$previous,$sort,$rolefilter,$statusfilter,$secpick,$numpicks) = @_;
+ my ($r,$feedurl,$typestyle,$sendsomething,$sendposts,$status,$previous,$sort,$rolefilter,$statusfilter,$sectionpick,$numpicks) = @_;
my $sorttag = '';
my $roletag = '';
my $statustag = '';
@@ -2022,21 +2156,45 @@ sub redirect_back {
$feedurl .= '?'.$sortqry;
}
$sorttag = '';
- if ( (defined($numpicks)) && ($numpicks > 0) ) {
+ if (defined($numpicks)) {
my $userpickqry = 'totposters='.$numpicks;
$feedurl .= '&'.$userpickqry;
$userpicktag = '';
} else {
- my $roleqry = 'rolefilter='.$rolefilter;
- $feedurl .= '&'.$roleqry;
- $roletag = '';
+ if (ref($sectionpick) eq 'ARRAY') {
+ $feedurl .= '§ionpick=';
+ $sectag .= '';
+ } else {
+ $feedurl .= '§ionpick='.$sectionpick;
+ $sectag = '';
+ }
+ if (ref($rolefilter) eq 'ARRAY') {
+ $feedurl .= '&rolefilter=';
+ $roletag .= '';
+ } else {
+ $feedurl .= '&rolefilter='.$rolefilter;
+ $roletag = '';
+ }
$feedurl .= '&statusfilter='.$statusfilter;
$statustag ='';
- $feedurl .= '§ionpick='.$secpick;
- $sectag = '';
}
}
$feedurl=&Apache::lonenc::check_encrypt($feedurl);
+ my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');
$r->print (<
@@ -2045,7 +2203,7 @@ sub redirect_back {
-
+
$typestyle
Sent $sendsomething message(s), and $sendposts post(s).
$status
@@ -2078,10 +2236,11 @@ ENDNOREDIR
&Apache::lonenc::check_encrypt($feedurl).'">');
}
$feedurl=&Apache::lonenc::check_encrypt($feedurl);
+ my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');
$r->print (<
-
+
$nofeed $continue
@@ -2090,47 +2249,49 @@ ENDNOREDIRTWO
}
sub screen_header {
- my ($feedurl) = @_;
+ my ($feedurl,$symb) = @_;
my $msgoptions='';
my $discussoptions='';
unless (($ENV{'form.replydisc'}) || ($ENV{'form.editdisc'})) {
if (($feedurl=~/^\/res\//) && ($feedurl!~/^\/res\/adm/)) {
$msgoptions=
- '
'.
- &mt('Feedback to resource author').'
';
+ '';
}
if (&feedback_available(1)) {
$msgoptions.=
- ' '.
- &mt('Question about resource content');
+ '';
}
if (&feedback_available(0,1)) {
$msgoptions.=
- ' '.
- &mt('Question/Comment/Feedback about course content');
+ '';
}
if (&feedback_available(0,0,1)) {
$msgoptions.=
- ' '.
- &mt('Question/Comment/Feedback about course policy');
+ '';
}
}
if ($ENV{'request.course.id'}) {
- if (&discussion_open() &&
+ if (&discussion_open(undef,$symb) &&
&Apache::lonnet::allowed('pch',
$ENV{'request.course.id'}.
($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) {
- $discussoptions=' '.
&mt('Contribution to course discussion of resource');
- $discussoptions.=' '.
+ $discussoptions.=' ';
+ }
}
- if ($msgoptions) { $msgoptions='
'.&mt('Sending Messages').'
'.$msgoptions; }
+ if ($msgoptions) { $msgoptions='
'.&mt('Sending Messages').'
'.$msgoptions; }
if ($discussoptions) {
- $discussoptions='
'.&mt('Discussion Contributions').'
'.$discussoptions; }
+ $discussoptions='
'.&mt('Discussion Contributions').'
'.$discussoptions; }
return $msgoptions.$discussoptions;
}
@@ -2444,6 +2605,7 @@ sub modify_attachments {
if ($idx) {
&extract_attachments($attachmenturls,$idx,$numoldver,\$msg,\%attachments,\%currattach,$currdelold);
}
+ &Apache::lonenc::check_encrypt(\$symb);
$r->print(<
@@ -2470,7 +2632,7 @@ END
foreach my $id (@currold) {
my $attachurl = &HTML::Entities::decode($attachments{$id}{'filename'});
$attachurl =~ m#/([^/]+)$#;
- $r->print(' '.$1.' '."\n");
+ $r->print(' '."\n");
}
$r->print(" ");
}
@@ -2480,7 +2642,7 @@ END
$r->print("The following attachments have been uploaded for inclusion with this posting. Check the checkboxes for any you wish to remove \n");
foreach (@{$currnewattach}) {
$_ =~ m#/([^/]+)$#;
- $r->print(' '.$1.' '."\n");
+ $r->print(' '."\n");
}
$r->print(" ");
}
@@ -2724,7 +2886,34 @@ sub has_discussion {
}
}
return;
-}
+}
+
+sub sort_filter_names {
+ my ($sort_types,$role_types,$status_types) = @_;
+ %{$sort_types} = (
+ ascdate => 'Date order - oldest first',
+ descdate => 'Date order - newest first',
+ thread => 'Threaded',
+ subject => 'By subject',
+ username => 'By domain and username',
+ lastfirst => 'By last name, first name'
+ );
+ %{$role_types} = (
+ all => 'All roles',
+ st => 'Students',
+ cc => 'Course Coordinators',
+ in => 'Instructors',
+ ta => 'TAs',
+ ep => 'Exam proctors',
+ ad => 'Administrators',
+ cr => 'Custom roles'
+ );
+ %{$status_types} = (
+ all => 'Roles of any status',
+ Active => 'Only active roles',
+ Expired => 'Only inactive roles'
+ );
+}
sub handler {
my $r = shift;
@@ -2737,7 +2926,8 @@ 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';
@@ -2768,7 +2958,7 @@ sub handler {
&Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
my $bodytag=&Apache::loncommon::bodytag('Discussion Post Versions');
- $r->print (<print(<Post Versions
@@ -2822,10 +3012,10 @@ END
&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'});
+ $ENV{'form.sectionpick'});
return OK;
- } elsif ($ENV{'form.sortfilter'}) {
- 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'}) {
@@ -2869,6 +3059,7 @@ END
}
&Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
+ my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');
$r->print (<
@@ -2877,7 +3068,7 @@ END
-
+
$textline
@@ -2896,77 +3087,39 @@ ENDREDIR
} elsif ($ENV{'form.markondisp'} || $ENV{'form.markonread'} ||
$ENV{'form.allposts'} || $ENV{'form.onlyunread'} ||
$ENV{'form.onlyunmark'} || $ENV{'form.toggoff'} ||
- $ENV{'form.toggon'} ) {
- 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'}=0; }
+ if ($ENV{'form.toggon'}) { $discinfo{$symb.'_readtoggle'}=1; }
# --------- 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
- 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
my $entry=$ENV{'form.hide'}?$ENV{'form.hide'}:$ENV{'form.unhide'};
@@ -3007,18 +3160,15 @@ ENDREDIR
&redirect_back($r,$feedurl,&mt('Changed discussion status').' ',
'0','0','',$ENV{'form.previous'});
return OK;
- } elsif (($ENV{'form.threadedon'}) || ($ENV{'form.threadedoff'})) {
- my $symb;
- if ($ENV{'form.threadedon'}) {
- $symb=$ENV{'form.threadedon'};
+ } 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;
@@ -3051,7 +3201,7 @@ ENDREDIR
unless (length($ENV{'form.addnewattach'})>131072) {
my $subdir = 'feedback/'.$ENV{'form.timestamp'};
my $newattachment=&Apache::lonnet::userfileupload('addnewattach',undef,$subdir);
- push @currnewattach, $newattachment;
+ push @currnewattach, $newattachment;
}
}
my $attachmenturls;
@@ -3143,7 +3293,7 @@ ENDREDIR
unless ($ENV{'form.sendit'}) {
&Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
- my $options=&screen_header($feedurl);
+ my $options=&screen_header($feedurl,$symb);
if ($options) {
&mail_screen($r,$feedurl,$options);
} else {