--- loncom/interface/lonmsg.pm 2003/08/12 20:12:05 1.60 +++ loncom/interface/lonmsg.pm 2003/08/18 17:37:42 1.64 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging # -# $Id: lonmsg.pm,v 1.60 2003/08/12 20:12:05 www Exp $ +# $Id: lonmsg.pm,v 1.64 2003/08/18 17:37:42 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -503,6 +503,19 @@ sub discourse {

ENDDISHEADER + my %coursepersonnel= + &Apache::lonnet::get_course_adv_roles(); + foreach my $role (sort keys %coursepersonnel) { + foreach (split(/\,/,$coursepersonnel{$role})) { + my ($puname,$pudom)=split(/\:/,$_); + $r->print( + '
'. + &Apache::loncommon::plainname($puname, + $pudom).' ('.$_.'), '.$role.''); + } + } + foreach (sort keys %courselist) { my ($end,$start)=split(/\:/,$courselist{$_}); my $active=1; @@ -625,36 +638,101 @@ sub disall { } ENDDISHEADER - $r->print( - '

Display All Messages

'. - ''. - ''); - foreach (sort split(/\&/,&Apache::lonnet::reply('keys:'. - $ENV{'user.domain'}.':'. - $ENV{'user.name'}.':nohist_email', - $ENV{'user.home'}))) { - my ($sendtime,$shortsubj,$fromname,$fromdomain,$status)= + $r->print('

Display All Messages

'. + '
 DateUsernameDomainSubjectStatus
'); + } else { + $r->print('Date'); + } + $r->print(''); + } else { + $r->print('Status'); + } + $r->print(''); + my @messages = split(/\&/,&Apache::lonnet::reply('keys:'.$ENV{'user.domain'}.':'.$ENV{'user.name'}.':nohist_email',$ENV{'user.home'})); + #unpack the varibles and repack into temp for sorting + my @temp; + foreach (@messages) { + my ($sendtime,$shortsubj,$fromname,$fromdomain,$status)= &Apache::lonmsg::unpackmsgid($_); + my @temp1 = ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$_); + push @temp ,\@temp1; + } + #default sort + @temp = sort {$a->[0] <=> $b->[0]} @temp; + if ($ENV{'form.sortedby'} eq "date"){ + @temp = sort {$a->[0] <=> $b->[0]} @temp; + } + if ($ENV{'form.sortedby'} eq "revdate"){ + @temp = sort {$b->[0] <=> $a->[0]} @temp; + } + if ($ENV{'form.sortedby'} eq "user"){ + @temp = sort {lc($a->[2]) cmp lc($b->[2])} @temp; + } + if ($ENV{'form.sortedby'} eq "revuser"){ + @temp = sort {lc($b->[2]) cmp lc($a->[2])} @temp; + } + if ($ENV{'form.sortedby'} eq "domain"){ + @temp = sort {$a->[3] cmp $b->[3]} @temp; + } + if ($ENV{'form.sortedby'} eq "revdomain"){ + @temp = sort {$b->[3] cmp $a->[3]} @temp; + } + if ($ENV{'form.sortedby'} eq "subject"){ + @temp = sort {lc($a->[1]) cmp lc($b->[1])} @temp; + } + if ($ENV{'form.sortedby'} eq "revsubject"){ + @temp = sort {lc($b->[1]) cmp lc($a->[1])} @temp; + } + if ($ENV{'form.sortedby'} eq "status"){ + @temp = sort {$a->[4] cmp $b->[4]} @temp; + } + if ($ENV{'form.sortedby'} eq "revstatus"){ + @temp = sort {$b->[4] cmp $a->[4]} @temp; + } + foreach (@temp){ + my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$origID)= @$_; if (($status ne 'deleted') && defined($sendtime) && $sendtime!~/error/) { if ($status eq 'new') { $r->print(''); } elsif ($status eq 'read') { $r->print(''); } elsif ($status eq 'replied') { - $r->print(''); + $r->print(''); } else { $r->print(''); } - $r->print(''. + $r->print(''. ''); } - } + } $r->print('
 '); + if ($ENV{'form.sortedby'} eq "revdate") { + $r->print('Date'); + if ($ENV{'form.sortedby'} eq "revuser") { + $r->print('Username'); + } else { + $r->print('Username'); + } + $r->print(''); + if ($ENV{'form.sortedby'} eq "revdomain") { + $r->print('Domain'); + } else { + $r->print('Domain'); + } + $r->print(''); + if ($ENV{'form.sortedby'} eq "revsubject") { + $r->print('Subject'); + } else { + $r->print('Subject'); + } + $r->print(''); + if ($ENV{'form.sortedby'} eq "revstatus") { + $r->print('Status
OpenDeleteOpenDelete'.localtime($sendtime).''. $fromname.''.$fromdomain.''. &Apache::lonnet::unescape($shortsubj).''. $status.'

'. 'Check All '. 'Uncheck All

'. @@ -875,7 +953,7 @@ sub handler { &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['display','replyto','forward','markread','markdel','markunread', 'sendreply','compose','sendmail','critical','recname','recdom', - 'recordftf']); + 'recordftf','sortedby']); # ------------------------------------------------------ They checked for email &Apache::lonnet::put('email_status',{'recnewemail'=>0});