--- loncom/interface/lonmsgdisplay.pm 2007/05/05 02:50:27 1.77 +++ loncom/interface/lonmsgdisplay.pm 2010/01/06 18:25:38 1.139.2.1 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging display # -# $Id: lonmsgdisplay.pm,v 1.77 2007/05/05 02:50:27 raeburn Exp $ +# $Id: lonmsgdisplay.pm,v 1.139.2.1 2010/01/06 18:25:38 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -113,8 +113,8 @@ use lib '/home/httpd/lib/perl/'; use LONCAPA; # Querystring component with sorting type -my $sqs; -my $startdis; +my $sqs=''; +my $startdis=''; # ============================================================ List all folders @@ -136,6 +136,9 @@ sub folderlist { ); + # set se lastvisit for the new mail check in the toplevel menu + &Apache::lonnet::appenv({'user.mailcheck.lastvisit'=>time}); + my %actions = &Apache::lonlocal::texthash( view => 'View Folder', rename => 'Rename Folder', @@ -170,6 +173,7 @@ sub folderlist { $formhash{'select_form_order'} = ['','critical',@userorder,'sent','trash']; my $output = qq||; my %show = ('select_form_order' => [10,20,50,100,200], map {$_=>$_} (10,20,50,100,200)); @@ -236,16 +241,16 @@ function folder_choice(targetform,caller
- | '.
- ''.&mt('New Folder').' '. + | '.
+ ''.&mt('Name').' '. ' |
'.
- ' '. - &Apache::loncommon::start_data_table(). - &Apache::loncommon::start_data_table_header_row(); - $result .= " | $lt{'name'} | ". - "$lt{'usnm'} | ". - "$lt{'doma'} | ". - &Apache::loncommon::end_data_table_header_row(); + my $formname = $status.'users'; + if (ref($access_status) eq 'HASH') { + $access_status->{$status} = $$numitems{$status}; + } + $r->print(''; } - $result .= ' |
---|
' . $crithelp . - '
'. - '' . $crithelp . - '
'. -''; + ''.$crithelp.' '.&mt('Require return receipt?').''.&mt('Replying to').' '. - &Apache::loncommon::aboutmewrapper( + if ($content{'noreplies'}) { + $r->print(' | |
'.&mt('This message was designated by the sender not to allow replies.').' |
'.&mt('[_1]Send reply[_2] to other recipients','','').': '.$replyall.' | '.$tolist.' |
'.&mt('[_1]Cc[_2] to other copied recipients','','').': '.$replyall.' | '.$cclist.' |
'.&mt('[_1]Cc[_2] to other copied group members','','').': '.$replyall.' | '.$groupcclist.' |
'."\n".
+$latexHelp." \n". +&mt("Any new text to display before the text of the original messages:").' '."\n". +''. +$wysiwyglink); my @to_forward = &Apache::loncommon::get_env_multiple('form.delmark'); foreach my $msg (@to_forward) { $r->print(''); } - $r->print(&submit_button_row($folder,$dismode,$func.' '.$lt{'msg'}, + $r->print(&submit_button_row($folder,$dismode,&mt($func1.' '.$func2{'msg'}), \%lt)); } elsif ($broadcast ne 'upload') { $subj_size = '50'; $r->print(&additional_rec_row(\%lt)); + if (&Apache::lonnet::allowed('srm',$env{'request.course.id'}) + || &Apache::lonnet::allowed('srm',$env{'request.course.id'}. + '/'.$env{'request.course.sec'})) { + $r->print(&reply_to_row(\%lt)); + } $r->print(&msg_subject_row($dissub,\%lt,$subj_size)); $r->print(<<"ENDCOMP"); - |
$lt{'gmt'}:
$lt{'tff'}: ENDBLOCK @@ -1438,22 +1694,32 @@ $dispcrit
ENDUPLOAD } - if ($broadcast eq 'group') { - if ($group eq '') { - my $studentsel = &discourse(); - $r->print($studentsel); - } - } if ($env{'form.displayedcrit'}) { $r->print(''); } - $r->print('+ + + | $prevbutton |
".&mt('No notes, face-to-face discussion records, critical messages, or broadcast messages in this [_1].',$lctype)."
"); } else { $r->print('\textbf{'.&mt('No notes, face-to-face discussion records, critical messages or broadcast messages in this [_1].',$lctype).'}\\\\'); } + } elsif ($target ne 'tex') { + $r->print($result.'$lt{'user'}: | - | -$stdbrws - | -
$lt{'dom'}: | -$domform |
'); my $escmsgid=&escape($msgid); foreach (@messages) { if ($_->[5] eq $escmsgid){ @@ -2029,66 +2351,148 @@ sub displaymessage { } $counter++; } - $r->print(''); + + my $see_anonymous; + my $from_student = 0; + if ($env{'request.course.id'} eq $content{'courseid'}) { + my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; + my $username = $content{'sendername'}.':'.$content{'senderdomain'}; + my %classlist_entry = + &Apache::lonnet::get('classlist',[$username],$cdom,$cnum); + if (exists($classlist_entry{$username})) { + $from_student = 1; + $see_anonymous = &Apache::lonnet::allowed('rin',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:'')); + } + } + + my $number_of_messages = scalar(@messages); #subtract 1 for last index # start output &printheader($r,'/adm/email?display='.&escape($msgid),'Display a Message','',$content{'baseurl'}); my %courseinfo=&Apache::lonnet::coursedescription($content{'courseid'}); -# Functions - $r->print('
'.&mt('Functions').': | '. - ''.&mt('Reply').' | '. - ''.&mt('Forward').' | '. - ''.&mt('Mark Unread').' | '. - ''.&mt('Delete').' | '. - ''.&mt('Back to Folder Display').' | '); + +# Prepare available functions + my @functionlist; + if (!$content{'noreplies'}) { + push(@functionlist,'' + .&mt('Reply') + .''); + } + push(@functionlist,'' + .&mt('Forward') + .''); + push(@functionlist,'' + .&mt('Mark Unread') + .''); + push(@functionlist,'' + .&mt('Delete') + .''); + push(@functionlist,'' + .&mt('Back to Folder Display') + .''); if ($counter > 0){ - $r->print(''.&mt('Previous').' | '); + push(@functionlist,'' + .&mt('Previous') + .''); } if ($counter < $number_of_messages - 1){ - $r->print(''.&mt('Next').' | '); + push(@functionlist,'' + .&mt('Next') + .''); } - $r->print('
'.&mt('Currently available actions (will open extra window)').': | '); + if (&Apache::lonnet::allowed('vgr',$env{'request.course.id'})) { - $r->print(''.&Apache::loncommon::track_student_link(&mt('View recent activity'),$content{'sendername'},$content{'senderdomain'},'check').' | '); - } + push(@actionlist,&Apache::loncommon::track_student_link( + &mt('View recent activity') + ,$content{'sendername'} + ,$content{'senderdomain'} + ,'check')); + } if (&Apache::lonnet::allowed('opa',$env{'request.course.id'}) && $symb) { - $r->print(''.&Apache::loncommon::pprmlink(&mt('Set/Change parameters'),$content{'sendername'},$content{'senderdomain'},$symb,'check').' | '); + push(@actionlist,&Apache::loncommon::pprmlink( + &mt('Set/Change parameters') + ,$content{'sendername'} + ,$content{'senderdomain'} + ,$symb + ,'check')); } if (&Apache::lonnet::allowed('mgr',$env{'request.course.id'}) && $symb) { - $r->print(''.&Apache::loncommon::pgrdlink(&mt('Set/Change grades'),$content{'sendername'},$content{'senderdomain'},$symb,'check').' | '); + push(@actionlist,&Apache::loncommon::pgrdlink( + &mt('Set/Change grades') + ,$content{'sendername'} + ,$content{'senderdomain'} + ,$symb + ,'check')); } - $r->print('
'. - &Apache::lontexconvert::msgtexconverted($content{'message'},1). - '
' + .&Apache::lontexconvert::msgtexconverted($content{'message'},1) + .'' + ); + if (&displayresource(%content)) { + $r->print(&Apache::lonhtmlcommon::row_closure() + .&Apache::lonhtmlcommon::row_title(&mt('Resource Details')) + .&displayresource(%content) + ); + } + $r->print(&Apache::lonhtmlcommon::row_closure(1). + &Apache::lonhtmlcommon::end_pick_box()); + # Display LON-CAPA Message (End) return; } -sub retrieve_cc_recips { - my ($context,%content) = @_; - my %reciphash = - &Apache::lonnet::get('nohist_emailrecip',[$content{'recipid'}], - $content{'senderdomain'},$content{'sendername'}); - my $recipinfo = $reciphash{$content{'recipid'}}; - my @ccs; - if (ref($recipinfo) eq 'HASH') { - if (ref($recipinfo->{'cc'}) eq 'HASH') { - foreach my $cc (sort(keys(%{$recipinfo->{'cc'}}))) { - my ($ccname,$ccdom) = split(/:/,$cc); - if (!(($ccname eq $env{'user.name'}) && - ($ccdom eq $env{'user.domain'}))) { - my $showcc =''; - if ($context eq 'replying') { - $showcc = '
'.&mt('Attachment not included - exceeded permitted length').'
'.&mt('Could not deliver message').' '. - &mt('Please use the browser "Back" button and correct the recipient addresses '."($sendstatus)").'
'); + $r->print(''.&Apache::lonhtmlcommon::confirm_success(&mt('Could not deliver message'),1).'
'.
+ &mt('Please use the browser "Back" button and correct the recipient addresses ([_1]).',$sendstatus).'
'); + $r->print(&mt('Marked [quant,_1,message] read',$total).'
'); &Apache::loncommunicate::menu($r); &disall($r,($folder?$folder:$dismode),$msgstatus); } elsif ($env{'form.markedaction'} eq 'markedunread') { @@ -2707,7 +3419,7 @@ sub handler { $total ++; } &printheader($r,'','Marked Messages Unread'); - $r->print(&mt('Marked [_1] message(s) unread',$total).'
'); + $r->print(&mt('Marked [quant,_1,message] unread',$total).'
'); &Apache::loncommunicate::menu($r); &disall($r,($folder?$folder:$dismode),$msgstatus); } elsif ($env{'form.markedaction'} eq 'markedmove') { @@ -2731,14 +3443,17 @@ sub handler { } } if ($failed) { - $r->print('
- '.&mt('Failed to move [_1] message(s)',$failed). - '
'); + $r->print('' + .&mt('Failed to move [quant,_1,message]',$failed) + .'
'); $r->print(''. join("
\n",@failed_msg). "
\n"); } - $r->print(&mt('Moved [_1] message(s)',$total).''); + $r->print('
' + .&mt('Moved [quant,_1,message]',$total) + .'
' + .''); } &Apache::loncommunicate::menu($r); &disall($r,($folder?$folder:$dismode),$msgstatus); @@ -2757,14 +3472,17 @@ sub handler { } &printheader($r,'','Deleted Messages'); if ($failed) { - $r->print('
- '.&mt('Failed to delete [_1] message(s)',$failed). - '
'); + $r->print('' + .&mt('Failed to delete [quant,_1,message]',$failed) + .'
'); $r->print(''. join("
\n",@failed_msg). "
\n"); } - $r->print(&mt('Deleted [_1] message(s)',$total).''); + $r->print('
' + .&mt('Deleted [quant,_1,message]',$total) + .'
' + .'');
&Apache::loncommunicate::menu($r);
&disall($r,($folder?$folder:$dismode),$msgstatus);
} elsif ($env{'form.markunread'}) {
@@ -2788,7 +3506,7 @@ sub handler {
foreach my $item (@to_forward) {
my $msgid=&unescape($item);
my %message=&Apache::lonnet::get('nohist_email'.$suffix,[$msgid]);
- my %content=&Apache::lonmsg::unpackagemsg($message{$msgid},1);
+ my %content=&Apache::lonmsg::unpackagemsg($message{$msgid},1,1);
if ($env{'form.showorigsubj'}) {
$env{'form.subject'} = $fixed_subj.$content{'subject'};
} else {
@@ -2802,8 +3520,10 @@ sub handler {
&Apache::loncommon::plainname($uname,$udom).' ('.
$uname.':'.$udom.')';
}
- $env{'form.message'} .= "\n\n-- Forwarded message --\n\n".
- $content{'message'};
+ $env{'form.message'}.="\n\n-- Forwarded message --\n\n".
+ $content{'message'};
+ $env{'form.attachmenturl'} = $content{'attachmenturl'};
+ $env{'form.multiforwid'} = $item;
$fwdcount ++;
$r->print($fwdcount.': ');
$sendresult{$msgid} = &sendoffmail($r,$folder);
@@ -2854,10 +3574,14 @@ sub handler {
my $showfolder = $env{'form.newfolder'};
my ($makeresult,$warning) = &makefolder($env{'form.newfolder'});
if ($makeresult eq 'ok') {
- $r->print(&mt('Mail folder "[_1]" created.',$showfolder).'
');
+ $r->print('
' + .&mt('Folder "[_1]" created.',$showfolder) + .'
'); } else { - $r->print(&mt('Creation failed.').' '.$makeresult.''
+ .&mt('Creation failed.').' '.$makeresult.'
'
+ .$warning
+ .'
' + .&mt('Folder "[_1]" deleted.',$folder) + .'
'); $env{'form.folder'} = ''; } else { - $r->print(&mt('Deletion failed.').' '.$delresult.'' + .&mt('Deletion failed.').' '.$delresult + .'
'); $showfolder = $folder; } &Apache::loncommunicate::menu($r); @@ -2882,9 +3610,13 @@ sub handler { my $showfolder = $env{'form.renamed'}; my $renresult = &renamefolder($folder); if ($renresult eq 'ok') { - $r->print(&mt('Mail folder "[_1]" renamed "[_2]".',$folder,$showfolder).'' + .&mt('Folder "[_1]" renamed to "[_2]".',$folder,$showfolder) + .'
'); } else { - $r->print(&mt('Renaming failed.').' '.$renresult.'' + .&mt('Renaming failed.').' '.$renresult + .'
'); $showfolder = $folder; } &Apache::loncommunicate::menu($r);