--- loncom/interface/lonmsg.pm 2003/08/12 20:12:05 1.60 +++ loncom/interface/lonmsg.pm 2003/08/29 20:38:12 1.65 @@ -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.65 2003/08/29 20:38:12 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;
@@ -600,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 {
@@ -625,39 +688,65 @@ sub disall {
}
ENDDISHEADER
- $r->print(
- '