--- loncom/interface/lonmsg.pm 2005/01/31 11:27:14 1.132 +++ loncom/interface/lonmsg.pm 2005/03/01 03:28:14 1.139 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging # -# $Id: lonmsg.pm,v 1.132 2005/01/31 11:27:14 www Exp $ +# $Id: lonmsg.pm,v 1.139 2005/03/01 03:28:14 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -414,7 +414,7 @@ sub user_crit_msg_raw { =cut sub user_crit_msg { - my ($user,$domain,$subject,$message,$sendback)=@_; + my ($user,$domain,$subject,$message,$sendback,$toperm)=@_; my $status=''; my %userenv = &Apache::lonnet::get('environment',['msgforward'], $domain,$user); @@ -424,10 +424,10 @@ sub user_crit_msg { my ($forwuser,$forwdomain)=split(/\:/,$_); $status.= &user_crit_msg_raw($forwuser,$forwdomain,$subject,$message, - $sendback).' '; + $sendback,$toperm).' '; } } else { - $status=&user_crit_msg_raw($user,$domain,$subject,$message,$sendback); + $status=&user_crit_msg_raw($user,$domain,$subject,$message,$sendback,$toperm); } return $status; } @@ -639,9 +639,9 @@ sub discourse { my $r=shift; my $classlist = &Apache::loncoursedata::get_classlist(); my $now=time; - my %lt=&Apache::lonlocal::texthash('cfa' => 'Check for All', - 'cfs' => 'Check for Section/Group', - 'cfn' => 'Check for None'); + my %lt=&Apache::lonlocal::texthash('cfa' => 'Check All', + 'cfs' => 'Check Section/Group', + 'cfn' => 'Uncheck All'); $r->print(<   -  + 

ENDDISHEADER @@ -693,7 +693,15 @@ ENDDISHEADER } } $r->print(''); - while (my ($student,$info) = each(%$classlist)) { + my $sort = sub { + my $aname=lc($classlist->{$a}[&Apache::loncoursedata::CL_FULLNAME()]); + if (!$aname) { $aname=$a; } + my $bname=lc($classlist->{$b}[&Apache::loncoursedata::CL_FULLNAME()]); + if (!$bname) { $bname=$b; } + return $aname cmp $bname; + }; + foreach my $student (sort $sort (keys(%{$classlist}))) { + my $info=$classlist->{$student}; my ($sname,$sdom,$status,$fullname,$section) = (@{$info}[&Apache::loncoursedata::CL_SNAME(), &Apache::loncoursedata::CL_SDOM(), @@ -704,8 +712,8 @@ ENDDISHEADER my $key = 'send_to_&&&'.$section.'&&&_'.$student; if (! defined($fullname) || $fullname eq '') { $fullname = $sname; } $r->print(''); } $r->print('
'.$sname.'@'.$sdom.''.$section. + qq{}.(' 'x2). + $fullname.''.$sname.'@'.$sdom.''.$section. '
'); @@ -716,8 +724,8 @@ ENDDISHEADER sub discrit { my $r=shift; my $header = '

'.&mt('Critical Messages').'

'. - '
'. - ''; + ''. + ''; my %what=&Apache::lonnet::dump('critical'); my $result = ''; foreach (sort keys %what) { @@ -734,9 +742,9 @@ $content{'sendername'}.'@'. ''. &mt('You have to confirm that you received this message. After confirmation, this message will be moved to your regular inbox'). '
'. - ''. - ''; + ''. + ''; } # Check to see if there were any messages. if ($result eq '') { @@ -869,7 +877,7 @@ ENDLINK } $r->print(""); } - $r->print(''); + $r->print(''.&Apache::loncommon::endbodytag().''); } elsif ($numblocked == 0) { $r->print("

".&mt('You have no unread messages')."

"); } @@ -979,9 +987,9 @@ ENDDISHEADER } $r->print(''); if ($ENV{'form.sortedby'} eq "revstatus") { - $r->print(''.&mt('Status').''); + $r->print(''.&mt('Status').''); } else { - $r->print(''.&mt('Status').''); + $r->print(''.&mt('Status').''); } $r->print("\n"); for (my $n=$firstdis;$n<=$lastdis;$n++) { @@ -996,10 +1004,10 @@ ENDDISHEADER } else { $r->print(''); } - $r->print(''.&mt('Open').''. ($folder ne 'trash'?''.&mt('Delete'):' ').''. + '">'.&mt('Delete'):' ').''. ''.&Apache::lonlocal::locallocaltime($sendtime).''. $fromname.''.$fromdomain.''. &Apache::lonnet::unescape($shortsubj).''. @@ -1082,10 +1090,12 @@ sub compout { if (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) { my $crithelp = Apache::loncommon::help_open_topic("Course_Critical_Message"); $dispcrit= - ' '.&mt('Send as critical message').' ' . $crithelp . - '
'. - ' '.&mt('Send as critical message').' ' . - &mt('and return receipt') . $crithelp . '

'; + '

' . $crithelp . + '

'. + '' . $crithelp . + '

'; } my %message; my %content; @@ -1119,8 +1129,8 @@ sub compout { if ($content{'baseurl'}) { $disbase=''; if ($ENV{'user.adv'}) { - $disbase.=''.&mt('Store message for re-use'). - ' '.&mt('Store message for re-use'). + ' '. &mt('Show re-usable messages').'
'; } @@ -1148,7 +1158,7 @@ sub compout { my $selectlink=&Apache::loncommon::selectstudent_link ('compemail','recuname','recdomain'); $r->print(<<"ENDREC"); -$lt{'us'}:$selectlink +$lt{'us'}:$selectlink $lt{'do'}: $domform ENDREC @@ -1398,12 +1408,13 @@ sub examblock { $r->print($lt{'ncbc'}.'

'); } &display_addblocker_table($r,$parmcount,\%ltext); + my $endbody=&Apache::loncommon::endbodytag(); $r->print(<<"END");
- +$endbody END return; @@ -1549,8 +1560,8 @@ END $$ltext{'star'}: $startform
$$ltext{'endd'}:  $endform $settername - - $lt{'modi'}? 
$lt{'canc'}?   + +
END $parmcount ++; @@ -1602,8 +1613,8 @@ sub display_addblocker_table { $$ltext{'star'}: $startform
$$ltext{'endd'}:  $endform - - $lt{'addb'}?  + + @@ -1837,7 +1848,9 @@ sub displayresource { sub header { my ($r,$title,$baseurl)=@_; - $r->print('Communication and Messages'); + $r->print(&Apache::lonxml::xmlbegin(). + ''.&Apache::lonxml::fontsettings(). + 'Communication and Messages'); if ($baseurl) { $r->print(""); } @@ -1877,7 +1890,8 @@ sub storedcommentlisting { my ($r)=@_; my %msgs=&Apache::lonnet::dump('nohist_stored_comments',undef,undef, '^'.&Apache::lonnet::escape(&Apache::lonnet::escape($ENV{'form.showcommentbaseurl'}))); - $r->print(''); + $r->print(&Apache::lonxml::xmlbegin().''. + &Apache::lonxml::fontsettings().''); if ((keys %msgs)[0]=~/^error\:/) { $r->print(&mt('No stored comments yet.')); } else { @@ -1960,13 +1974,13 @@ sub sendoffmail { $thismsg=&user_crit_msg($recuname,$recdomain, &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}), $msgtxt, - $ENV{'form.sendbck'}); + $ENV{'form.sendbck'},$ENV{'form.permanent'}); } else { $r->print(&mt('Sending').' '.$recuname.'@'.$recdomain.': '); $thismsg=&user_normal_msg($recuname,$recdomain, &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}), $msgtxt, - $content{'citation'}); + $content{'citation'},undef,undef,$ENV{'form.permanent'}); if (($ENV{'request.course.id'}) && ($ENV{'form.sendmode'} eq 'group')) { &user_normal_msg_raw( $ENV{'course.'.$ENV{'request.course.id'}.'.num'}, @@ -2148,7 +2162,7 @@ sub handler { &Apache::loncommunicate::menu($r); &disall($r,$folder); } - $r->print(''); + $r->print(&Apache::loncommon::endbodytag().''); return OK; } # ================================================= Main program, reset counter