--- loncom/interface/lonfeedback.pm 2006/07/17 23:02:33 1.208
+++ loncom/interface/lonfeedback.pm 2006/08/08 19:02:04 1.214
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.208 2006/07/17 23:02:33 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.214 2006/08/08 19:02:04 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -138,25 +138,10 @@ sub list_discussion {
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['previous','sortposts','rolefilter','statusfilter','sectionpick','grouppick','totposters']);
my $sortposts = $env{'form.sortposts'};
my $statusfilter = $env{'form.statusfilter'};
- my @sectionpick = ();
- if ($env{'form.sectionpick'} =~ /,/) {
- @sectionpick = split/,/,$env{'form.sectionpick'};
- } else {
- $sectionpick[0] = $env{'form.sectionpick'};
- }
- my @grouppick = ();
- if ($env{'form.grouppick'} =~ /,/) {
- @grouppick = split/,/,$env{'form.grouppick'};
- } else {
- $grouppick[0] = $env{'form.grouppick'};
- }
+ my @sectionpick = split(/,/,$env{'form.sectionpick'});
+ my @grouppick = split(/,/,$env{'form.grouppick'});
+ my @rolefilter = split(/,/,$env{'form.rolefilter'});
- my @rolefilter = ();
- if ($env{'form.rolefilter'} =~ /,/) {
- @rolefilter = split/,/,$env{'form.rolefilter'};
- } else {
- $rolefilter[0] = $env{'form.rolefilter'};
- }
my $totposters = $env{'form.totposters'};
$previous = $env{'form.previous'};
if ($previous > 0) {
@@ -201,8 +186,8 @@ sub list_discussion {
push @{$roleinfo{$student}}, 'st:'.$section.':'.$status;
}
($classgroups,$studentgroups) =
- &Apache::loncoursedata::get_group_memberships($classlist,$keylist,
- $cdom,$cnum);
+ &Apache::loncoursedata::get_group_memberships($classlist,$keylist,
+ $cdom,$cnum);
}
# Get discussion display default settings for user
@@ -286,11 +271,6 @@ sub list_discussion {
my $imsresources;
my $copyresult;
- my $grp_arg;
- if ($group ne '') {
- $grp_arg = &grp_args($group);
- }
-
my $function = &Apache::loncommon::get_users_function();
my $color = &Apache::loncommon::designparm($function.'.tabbg',
$env{'user.domain'});
@@ -355,9 +335,7 @@ sub list_discussion {
if ($newpostsflag) {
$chglink .= '&previous='.$prevread;
}
- if ($group ne '') {
- $chglink.='&'.$grp_arg;
- }
+ $chglink.=&group_args($group);
if ($visible) {
# Print the discusssion
@@ -436,25 +414,19 @@ imscp_v1p1.xsd http://www.imsglobal.org/
if ($newpostsflag) {
$discussion .= '&previous='.$prevread;
}
- if ($group ne '') {
- $discussion .= '&'.$grp_arg;
- }
+ $discussion .= &group_args($group);
$discussion .='">'.&mt('Threaded View').' '.
''.&mt('Chronological View').'
'.&mt('Sorting/Filtering options').'  ';
} else {
$discussion .= '
';
@@ -463,22 +435,16 @@ imscp_v1p1.xsd http://www.imsglobal.org/
if ($newpostsflag) {
$discussion .= '&previous='.$prevread;
}
- if ($group ne '') {
- $discussion .= '&'.$grp_arg;
- }
+ $discussion .= &group_args($group);
$discussion .= '">'.&mt('Export').'? | ';
if ($newpostsflag) {
if (!$markondisp) {
$discussion .=''.
&mt('Preferences on what is marked as NEW').
' '.&mt('Mark NEW posts no longer new').'';
} else {
$discussion .= ' | | ';
@@ -496,9 +462,7 @@ imscp_v1p1.xsd http://www.imsglobal.org/
if ($newpostsflag) {
$discussion .= '&previous='.$prevread;
}
- if ($group ne '') {
- $discussion .= '&'.$grp_arg;
- }
+ $discussion .= &group_args($group);
$discussion .= '">'.&mt('Show all posts').' '.&mt('to display').' '.
$numhidden.' ';
if ($showunmark) {
@@ -749,8 +713,8 @@ END
if ($discussiononly) {
my $now = time;
my $attachnum = 0;
- my $currnewattach;
- my $currdelold;
+ my $currnewattach = [];
+ my $currdelold = [];
my $comment = '';
my $subject = '';
if ($env{'form.origpage'}) {
@@ -767,15 +731,16 @@ END
if (($group ne '') && ($mode eq 'board')) {
if (&check_group_priv($group,'pgd') eq 'ok') {
$discussion .=
- &postingform_display($mode,$ressymb,$now,$subject,$comment,
- $outputtarget,$attachnum,$currnewattach,
- $currdelold,$group);
+ &postingform_display($mode,$ressymb,$now,$subject,
+ $comment,$outputtarget,$attachnum,
+ $currnewattach,$currdelold,
+ $group);
}
} else {
$discussion.=
- &postingform_display($mode,$ressymb,$now,$subject,$comment,
- $outputtarget,$attachnum,$currnewattach,
- $currdelold);
+ &postingform_display($mode,$ressymb,$now,$subject,
+ $comment,$outputtarget,$attachnum,
+ $currnewattach,$currdelold);
}
}
} else {
@@ -858,15 +823,15 @@ 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,$grouppick,$classgroups,$statusfilter,$toggkey,$outputtarget,$anonhash,$anoncnt,$group) = @_;
my @original=();
my @index=();
- my $skipgrpcheck = 0;
+ my $skip_group_check = 0;
my $symb=&Apache::lonenc::check_decrypt($ressymb);
my $escsymb=&escape($ressymb);
my %contrib=&Apache::lonnet::restore($symb,$env{'request.course.id'},
$env{'course.'.$env{'request.course.id'}.'.domain'},
$env{'course.'.$env{'request.course.id'}.'.num'});
- if ((@{$grouppick} == 0) || (grep/^all$/,@{$grouppick})) {
- $skipgrpcheck = 1;
+ if ((@{$grouppick} == 0) || (grep(/^all$/,@{$grouppick}))) {
+ $skip_group_check = 1;
}
if ($contrib{'version'}) {
my $oldest = $contrib{'1:timestamp'};
@@ -1013,9 +978,7 @@ sub build_posting_display {
if ($$newpostsflag) {
$sender .= '&previous='.$prevread;
}
- if ($group ne '') {
- $sender.='&'.&grp_args($group);
- }
+ $sender .= &group_args($group);
$sender .= '" '.$target.'>'.&mt('Edit').'';
unless ($seeid) {
@@ -1040,9 +1003,7 @@ sub build_posting_display {
if ($$newpostsflag) {
$sender .= '&previous='.$prevread;
}
- if ($group ne '') {
- $sender.='&'.&grp_args($group);
- }
+ $sender .= &group_args($group);
$sender .= '">'.&mt('Hide').'';
}
$sender.=' '.&mt('Delete').'';
}
} else {
@@ -1088,7 +1047,7 @@ sub build_posting_display {
if ($$newpostsflag) {
$sender .= '&previous='.$prevread;
}
- $sender .= '&'.&grp_args($group);
+ $sender .= &group_args($group);
$sender .= '" '.$target.'>'.&mt('Reply').'';
} elsif (&Apache::lonnet::allowed('pch',
$env{'request.course.id'}.
@@ -1182,7 +1141,7 @@ sub build_posting_display {
}
}
}
- if ($$shown{$idx} && !$skipgrpcheck) {
+ if ($$shown{$idx} && !$skip_group_check) {
my $showflag = 0;
if (ref($$classgroups{$poster}{active}) eq 'HASH') {
foreach my $grp (@{$grouppick}) {
@@ -1230,9 +1189,7 @@ sub build_posting_display {
$$discussionitems[$idx] .= &mt('This post has been edited by the author.');
if ($seeid) {
$$discussionitems[$idx] .= ' '.&mt('Display all versions').'';
}
$$discussionitems[$idx].='
'.&mt('Earlier version(s) were posted on: ');
@@ -1726,7 +1683,7 @@ END
}
}
if ($attachmsg) {
- $r->print("Retained attachments:$attachmsg
\n");
+ $r->print("
Retained attachments:$attachmsg
\n");
}
if ($newattachmsg) {
$r->print("$newattachmsg
");
@@ -1973,8 +1930,8 @@ sub print_sortfilter_options {
unshift(@sections,'all'); # Put 'all' at the front of the list
}
- foreach (@sections) {
- $section_sel .= " $_\n";
+ foreach my $sec (@sections) {
+ $section_sel .= " \n";
}
if (&check_group_priv() eq 'ok') {
@@ -1999,8 +1956,8 @@ sub print_sortfilter_options {
$numgroupvis = 1;
}
}
- foreach (@groups) {
- $group_sel .= " $_\n";
+ foreach my $group (@groups) {
+ $group_sel .= " \n";
}
my $function = &Apache::loncommon::get_users_function();
@@ -2090,32 +2047,33 @@ $start_page
|
|
|
|
|
|
@@ -2963,7 +2921,7 @@ END
}
}
}
- if (@{$currnewattach} > 0) {
+ if ((ref($currnewattach) eq 'ARRAY') && (@{$currnewattach} > 0)) {
$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#/([^/]+)$#;
@@ -3211,8 +3169,9 @@ sub sort_filter_names {
);
%{$status_types} = (
all => 'Roles of any status',
- Active => 'Only active roles',
- Expired => 'Only inactive roles'
+ Active => 'Only active roles',
+ Expired => 'Only past roles',
+ Future => 'Only future roles',
);
}
@@ -3808,11 +3767,12 @@ sub check_group_priv {
return '';
}
-sub grp_args {
+sub group_args {
my ($group) = @_;
- my $extra_args = 'group='.$group;
+ if ($group eq '') { return ''; }
+ my $extra_args = '&group='.$group;
if (exists($env{'form.ref'})) {
- $extra_args .= '&ref='.$env{'form.ref'};
+ $extra_args .= '&ref='.$env{'form.ref'};
}
return $extra_args;
}