--- loncom/interface/lonfeedback.pm 2004/11/20 20:40:51 1.143
+++ loncom/interface/lonfeedback.pm 2004/12/09 21:58:29 1.145
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.143 2004/11/20 20:40:51 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.145 2004/12/09 21:58:29 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -151,13 +151,18 @@ sub list_discussion {
%roleshash = &Apache::lonnet::dump('nohist_userroles',$ENV{'course.'.$ENV{'request.course.id'}.'.domain'},$ENV{'course.'.$ENV{'request.course.id'}.'.num'});
foreach (keys %roleshash) {
my ($role,$uname,$udom,$sec) = split/:/,$_;
+ if ($role =~ /^cr/) {
+ $role = 'cr';
+ }
my ($end,$start) = split/:/,$roleshash{$_};
my $now = time;
my $status = 'Active';
if (($now < $start) || ($end > 0 && $now > $end)) {
$status = 'Expired';
}
- push @{$roleinfo{$uname.':'.$udom}}, $role.':'.$sec.':'.$status;
+ if ($uname && $udom) {
+ push @{$roleinfo{$uname.':'.$udom}}, $role.':'.$sec.':'.$status;
+ }
}
my ($classlist) = &Apache::loncoursedata::get_classlist(
$ENV{'request.course.id'},
@@ -408,7 +413,7 @@ imscp_v1p1.xsd http://www.imsglobal.org/
if ($numhidden > 0) {
my $colspan = $maxdepth+1;
$discussion.="\n".'
'.
- ' $b } keys %alldiscussion);
}
my $currdepth = 0;
my $firstidx = $alldiscussion{$showposts[0]};
foreach (@showposts) {
- unless (($sortposts eq 'thread') || ($sortposts eq 'ascdate' && $ENV{'environment.threadeddiscussion'}) || ($outputtarget eq 'export')) {
+ unless (($sortposts eq 'thread') || (($sortposts eq '') && ($ENV{'environment.threadeddiscussion'})) || ($outputtarget eq 'export')) {
$alldiscussion{$_} = $_;
}
unless ( ($notshown{$alldiscussion{$_}} eq '1') || ($shown{$alldiscussion{$_}} == 0) ) {
@@ -550,7 +554,7 @@ END
$discussion .= < |
|
-
+ |
$lt{'chgt'}?
|
@@ -565,13 +569,13 @@ END
$discussion .= ''.&mt('Sorted by').': '.$sort_types{$sortposts}.' ';
if (defined($ENV{'form.totposters'})) {
- $discussion .= &mt('Posts by').': ';
+ $discussion .= &mt('Posts by').':';
if ($totposters > 0) {
foreach my $poster (@posters) {
$poster =~ s/:/\@/;
- $discussion .= $poster.',';
+ $discussion .= ' '.$poster.',';
}
- $discussion =~ s/,//;
+ $discussion =~ s/,$//;
} else {
$discussion .= &mt('None selected');
}
@@ -582,11 +586,12 @@ END
$filterchoice .= ' ';
}
if (@rolefilter > 0) {
- $filterchoice .= ''.&mt('roles').'- ';
+ $filterchoice .= ''.&mt('roles').'-';
foreach (@rolefilter) {
- $filterchoice .= $role_types{$_}.', ';
+ $filterchoice .= ' '.$role_types{$_}.',';
}
- $filterchoice .= ' ';
+ $filterchoice =~ s/,$//;
+ $filterchoice .= '     ';
}
if ($statusfilter) {
$filterchoice .= ''.&mt('status').'- '.$status_types{$statusfilter};
@@ -763,7 +768,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;
@@ -958,7 +963,7 @@ sub build_posting_display {
}
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;
@@ -1016,6 +1021,7 @@ sub build_posting_display {
my $cc_regexp = $roleregexp.':[^:]*:'.$statusregexp;
if ($role =~ /$cc_regexp/) {
$$shown{$idx} = 1;
+ last;
}
} elsif ($role =~ /^$rolematch$/) {
$$shown{$idx} = 1;
@@ -1776,30 +1782,13 @@ sub print_sortfilter_options {
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
@@ -1840,6 +1829,30 @@ sub print_sortfilter_options {
$lt{'diso'}
+
$bodytag
|