--- loncom/interface/lonmsg.pm 2003/07/25 01:18:04 1.58
+++ loncom/interface/lonmsg.pm 2003/10/04 20:49:40 1.66
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging
#
-# $Id: lonmsg.pm,v 1.58 2003/07/25 01:18:04 bowersj2 Exp $
+# $Id: lonmsg.pm,v 1.66 2003/10/04 20:49:40 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -116,6 +116,9 @@ use Apache::lontexconvert();
use HTML::Entities();
use Mail::Send;
+# Querystring component with sorting type
+my $sqs;
+
# ===================================================================== Package
sub packagemsg {
@@ -503,6 +506,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;
@@ -553,7 +569,8 @@ $content{'sendername'}.'@'.
}
# Check to see if there were any messages.
if ($result eq '') {
- $result = "
You have no critical messages.
";
+ $result = "You have no critical messages.
".
+ 'Select a course';
} else {
$r->print($header);
}
@@ -599,6 +616,53 @@ $dispcrit
ENDREPLY
}
+sub sortedmessages {
+ my @messages = &Apache::lonnet::getkeys('nohist_email');
+ #unpack the varibles and repack into temp for sorting
+ my @temp;
+ foreach (@messages) {
+ my $msgid=&Apache::lonnet::escape($_);
+ my ($sendtime,$shortsubj,$fromname,$fromdomain,$status)=
+ &Apache::lonmsg::unpackmsgid($msgid);
+ my @temp1 = ($sendtime,$shortsubj,$fromname,$fromdomain,$status,
+ $msgid);
+ 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;
+ }
+ return @temp;
+}
+
# ======================================================== Display all messages
sub disall {
@@ -624,39 +688,65 @@ sub disall {
}
ENDDISHEADER
- $r->print(
- 'Display All Messages