--- loncom/interface/lonmsg.pm 2004/11/09 16:29:32 1.112
+++ loncom/interface/lonmsg.pm 2004/11/15 21:28:58 1.118
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging
#
-# $Id: lonmsg.pm,v 1.112 2004/11/09 16:29:32 www Exp $
+# $Id: lonmsg.pm,v 1.118 2004/11/15 21:28:58 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -523,20 +523,26 @@ sub folderlist {
&mt('Folder').': '.
&Apache::loncommon::select_form($folder,'folder',
('' => &mt('INBOX'),'trash' => &mt('TRASH'),
+ 'new' => &mt('New Messages Only'),
+ 'critical' => &mt('Critical'),
'sent' => &mt('Sent Messages'),
map { $_ => $_ } @allfolders)).
' '.&mt('Show').' '.
&Apache::loncommon::select_form($interdis,'interdis',
(' 10' => '10', ' 20' => '20', ' 50' => '50', '100' => '100', '200' => '200')).
'
'.
+ ($folder=~/^(new|critical)/?'':'');
+}
+
+sub scrollbuttons {
+ my ($start,$maxdis,$first,$finish,$total)=@_;
+ $start++; $maxdis++;$first++;$finish++;
''.
''.
- ''.
+ ' of '.$maxdis.
''.
- ''.
- ''.
- &mt('View Critical Messages').''.
- '';
+ '
'.
+ &mt('Messages [_1] through [_2] of [_3]',$first,$finish,$total).'';
}
# =============================================================== Folder suffix
@@ -568,6 +574,10 @@ sub statuschange {
sub makefolder {
my ($newfolder)=@_;
+ if (($newfolder eq 'sent')
+ || ($newfolder eq 'critical')
+ || ($newfolder eq 'trash')
+ || ($newfolder eq 'new')) { return; }
&Apache::lonnet::put('email_folders',{$newfolder => time});
}
@@ -858,6 +868,20 @@ ENDLINK
sub disall {
my ($r,$folder)=@_;
+ $r->print(&folderlist($folder));
+ if ($folder eq 'new') {
+ &disnew($r);
+ } elsif ($folder eq 'critical') {
+ &discrit($r);
+ } else {
+ &disfolder($r,$folder);
+ }
+}
+
+# ============================================================ Display a folder
+
+sub disfolder {
+ my ($r,$folder)=@_;
my %blocked = ();
my %setters = ();
my $startblock;
@@ -888,14 +912,14 @@ ENDDISHEADER
my $fsqs='&folder='.$folder;
my @temp=sortedmessages(\%blocked,$startblock,$endblock,\$numblocked,$folder);
my $totalnumber=$#temp+1;
- my $number=int($totalnumber/$interdis)+1;
+ my $number=int($totalnumber/$interdis);
+ if (($startdis<0) || ($startdis>$number)) { $startdis=$number; }
my $firstdis=$interdis*$startdis;
if ($firstdis>$#temp) { $firstdis=$#temp-$interdis+1; }
my $lastdis=$firstdis+$interdis-1;
if ($lastdis>$#temp) { $lastdis=$#temp; }
- $r->print('