--- loncom/interface/lonfeedback.pm 2004/07/28 18:50:26 1.108
+++ loncom/interface/lonfeedback.pm 2004/07/29 22:42:25 1.110
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.108 2004/07/28 18:50:26 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.110 2004/07/29 22:42:25 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -508,11 +508,15 @@ sub list_discussion {
$discussionitems[$idx] .= '
'.
''.$subject.' '.
$sender.' '.$vgrlink.' ('.
- localtime($posttime).') | '.
+ &Apache::lonlocal::locallocaltime($posttime).')'.
''.$message.'
';
if ($contrib{$idx.':history'}) {
my @postversions = ();
- $discussionitems[$idx] .= '
'.&mt('This post has been edited by the author.').'
'.&mt('Earlier version(s) were posted on: ');
+ $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: ');
if ($contrib{$idx.':history'} =~ m/:/) {
@postversions = split/:/,$contrib{$idx.':history'};
} else {
@@ -522,7 +526,6 @@ sub list_discussion {
my $version = $i+1;
$discussionitems[$idx] .= ''.$version.'. - '.&Apache::lonlocal::locallocaltime($postversions[$i]).' ';
}
- $discussionitems[$idx] .= '
';
}
}
}
@@ -1853,6 +1856,7 @@ sub adddiscuss {
$contrib{'history'} = '';
my $numoldver = 0;
my ($oldsymb,$oldidx)=split(/\:\:\:/,$ENV{'form.editdisc'});
+ $oldsymb=~s|(bulletin___\d+___)adm/wrapper/|$1|;
# get timestamp for last post and history
my %oldcontrib=&Apache::lonnet::restore($oldsymb,$ENV{'request.course.id'},
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
@@ -2254,7 +2258,97 @@ 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','previous','markread','markonread','markondisp','modifydisp','changes','navmaps','navurl','sortfilter','sortposts','applysort','rolefilter','statusfilter','sectionpick','posterlist','userpick','attach','origpage','currnewattach','deloldattach','keepold']);
+ ['hide','unhide','deldisc','postdata','preview','replydisc','editdisc','threadedon','threadedoff','onlyunread','allposts','previous','markread','markonread','markondisp','modifydisp','changes','navmaps','navurl','sortfilter','sortposts','applysort','rolefilter','statusfilter','sectionpick','posterlist','userpick','attach','origpage','currnewattach','deloldattach','keepold','allversions']);
+ if ($ENV{'form.allversions'}) {
+ &Apache::loncommon::content_type($r,'text/html');
+ $r->send_http_header;
+ my $bodytag=&Apache::loncommon::bodytag('Discussion Post Versions',
+ '','');
+ $r->print (<
+
+Post Versions
+
+
+$bodytag
+END
+ 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 ($symb,$idx)=split(/\:\:\:/,$ENV{'form.allversions'});
+ my $ressymb=$symb;
+ unless ($ressymb =~ m|bulletin___\d+___adm/wrapper|) {
+ $ressymb=~s|(bulletin___\d+___)|$1adm/wrapper|;
+ }
+ if ($idx > 0) {
+ my %contrib=&Apache::lonnet::restore($ressymb,$ENV{'request.course.id'},
+ $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
+ $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
+ if ($contrib{$idx.':history'}) {
+ my $attachmenturls = $contrib{$idx.':attachmenturl'};
+ my @postversions = ();
+ if ($contrib{$idx.':history'} =~ m/:/) {
+ @postversions = split/:/,$contrib{$idx.':history'};
+ } else {
+ @postversions = ("$contrib{$idx.':history'}");
+ }
+ if (@postversions > 0) {
+ push @postversions,$contrib{$idx.':timestamp'};
+ my $screenname=&Apache::loncommon::screenname(
+ $contrib{$idx.':sendername'},
+ $contrib{$idx.':senderdomain'});
+ my $plainname=&Apache::loncommon::nickname(
+ $contrib{$idx.':sendername'},
+ $contrib{$idx.':senderdomain'});
+ my $sender=&Apache::loncommon::aboutmewrapper(
+ $plainname,
+ $contrib{$idx.':sendername'},
+ $contrib{$idx.':senderdomain'}).' ('.
+ $contrib{$idx.':sendername'}.' at '.
+ $contrib{$idx.':senderdomain'}.')';
+ if ($contrib{$idx.':anonymous'}) {
+ $sender.=' ['.&mt('anonymous').'] '.$screenname;
+ }
+ $r->print(''.$sender.'
');
+ for (my $i=0; $i<@postversions; $i++) {
+ my ($timesent,$message,$subject,$attachmsg);
+ $timesent = &Apache::lonlocal::locallocaltime($postversions[$i]);
+ if ($i == @postversions-1) {
+ ($message)=($contrib{$idx.':message'} =~ /.*::::\Q$i\E::::(.+?)$/si);
+ ($subject)=($contrib{$idx.':subject'} =~ /.*::::\Q$i\E::::(.+?)$/si);
+ } else {
+ ($message)=($contrib{$idx.':message'} =~ /::::\Q$i\E::::(.+?)::::/si);
+ ($subject)=($contrib{$idx.':subject'} =~ /::::\Q$i\E::::(.+?)::::/si);
+ }
+ $message=~s/\n/\
/g;
+ $message=&Apache::lontexconvert::msgtexconverted($message);
+ $subject=~s/\n/\
/g;
+ $subject=&Apache::lontexconvert::msgtexconverted($subject);
+ if ($attachmenturls) {
+ my @attachments = ();
+ my %currattach = ();
+ &extract_attachments($attachmenturls,$idx,$i,\$attachmsg,\@attachments,\%currattach);
+ }
+ if ($attachmsg) {
+ $attachmsg = '
Attachments:'.$attachmsg.'
';
+ } else {
+ $attachmsg = '
';
+ }
+ $r->print (<$subject, $timesent
+$message
+$attachmsg
+END
+ }
+ $r->print('