--- loncom/interface/lonfeedback.pm 2004/11/20 20:40:51 1.143
+++ loncom/interface/lonfeedback.pm 2005/02/17 04:11:20 1.151
@@ -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.151 2005/02/17 04:11:20 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -68,13 +68,18 @@ sub discussion_visible {
}
sub list_discussion {
- my ($mode,$status,$ressymb)=@_;
+ my ($mode,$status,$ressymb,$imsextras)=@_;
my $outputtarget=$ENV{'form.grade_target'};
if (defined($ENV{'form.export'})) {
if($ENV{'form.export'}) {
$outputtarget = 'export';
}
}
+ if (defined($imsextras)) {
+ if ($$imsextras{'caller'} eq 'imsexport') {
+ $outputtarget = 'export';
+ }
+ }
if (not &discussion_visible($status)) { return ''; }
my @bgcols = ("#cccccc","#eeeeee");
my $discussiononly=0;
@@ -151,13 +156,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'},
@@ -320,15 +330,26 @@ sub list_discussion {
} elsif ($outputtarget eq 'export') {
# Create temporary directory if this is an export
my $now = time;
- $tempexport = $Apache::lonnet::perlvar{'lonDaemons'}.'/tmp/ims_exports';
- if (!-e $tempexport) {
- mkdir($tempexport,0700);
- }
- $tempexport .= '/'.$now;
- if (!-e $tempexport) {
- mkdir($tempexport,0700);
+ if ((defined($imsextras)) && ($$imsextras{'caller'} eq 'imsexport')) {
+ $tempexport = $$imsextras{'tempexport'};
+ if (!-e $tempexport) {
+ mkdir($tempexport,0700);
+ }
+ $tempexport .= '/'.$$imsextras{'count'};
+ if (!-e $tempexport) {
+ mkdir($tempexport,0700);
+ }
+ } else {
+ $tempexport = $Apache::lonnet::perlvar{'lonDaemons'}.'/tmp/ims_exports';
+ if (!-e $tempexport) {
+ mkdir($tempexport,0700);
+ }
+ $tempexport .= '/'.$now;
+ if (!-e $tempexport) {
+ mkdir($tempexport,0700);
+ }
+ $tempexport .= '/'.$ENV{'user.domain'}.'_'.$ENV{'user.name'};
}
- $tempexport .= '/'.$ENV{'user.domain'}.'_'.$ENV{'user.name'};
if (!-e $tempexport) {
mkdir($tempexport,0700);
}
@@ -408,7 +429,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) ) {
@@ -492,8 +512,8 @@ imscp_v1p1.xsd http://www.imsglobal.org/
$imsitems{$alldiscussion{$_}}{'isvisible'}.'" identifieref="RES-'.$ressymb.'-'.$alldiscussion{$_}.'">'.
''.$imsitems{$alldiscussion{$_}}{'title'}.'';
$imsresources .= "\n".
- ''.
- ''."\n".
+ ''."\n".
+ ''."\n".
$imsfiles{$alldiscussion{$_}}{$imsitems{$alldiscussion{$_}}{'currversion'}}."\n".
'';
}
@@ -550,7 +570,7 @@ END
$discussion .= < |
|
-
+ |
$lt{'chgt'}?
|
@@ -565,13 +585,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 +602,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};
@@ -629,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. ';
@@ -724,7 +749,7 @@ ENDDISCUSS
if ($outputtarget ne 'tex') {
$discussion.='';
}
}
@@ -763,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;
@@ -949,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;
@@ -1016,6 +1041,7 @@ sub build_posting_display {
my $cc_regexp = $roleregexp.':[^:]*:'.$statusregexp;
if ($role =~ /$cc_regexp/) {
$$shown{$idx} = 1;
+ last;
}
} elsif ($role =~ /^$rolematch$/) {
$$shown{$idx} = 1;
@@ -1727,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" |
+ |
|
@@ -1776,30 +1802,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 +1849,30 @@ sub print_sortfilter_options {
$lt{'diso'}
+
$bodytag
@@ -1991,7 +2024,7 @@ END
next;
} else {
$count ++;
- $r->print(''.$count.' | | '.$last.', '.$first.' ('.$uname.','.$udom.') | '.$postcounts{$_}.' |
');
+ $r->print(''.$count.' | | '.$last.', '.$first.' ('.$uname.','.$udom.') | '.$postcounts{$_}.' |
');
}
}
}
@@ -2072,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
@@ -2082,7 +2116,7 @@ sub fail_redirect {;
-
+
Sorry, no recipients ...
Continue
@@ -2160,6 +2194,7 @@ sub redirect_back {
}
}
$feedurl=&Apache::lonenc::check_encrypt($feedurl);
+ my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');
$r->print (<
@@ -2168,7 +2203,7 @@ sub redirect_back {
-
+
$typestyle
Sent $sendsomething message(s), and $sendposts post(s).
$status
@@ -2201,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
@@ -2219,23 +2255,25 @@ sub screen_header {
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'}) {
@@ -2243,17 +2281,17 @@ sub screen_header {
&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;
}
@@ -2594,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("
");
}
@@ -2604,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("
");
}
@@ -3021,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 (<
@@ -3029,7 +3068,7 @@ END
-
+
$textline