--- loncom/interface/lonmsgdisplay.pm 2008/11/04 06:22:53 1.95 +++ loncom/interface/lonmsgdisplay.pm 2009/01/06 21:38:43 1.108 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging display # -# $Id: lonmsgdisplay.pm,v 1.95 2008/11/04 06:22:53 raeburn Exp $ +# $Id: lonmsgdisplay.pm,v 1.108 2009/01/06 21:38:43 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -243,9 +243,9 @@ function folder_choice(targetform,caller      '. - '

-
'.&mt('New Folder').'
'. + '
'.&mt('Name').'
'. '
@@ -353,7 +353,7 @@ sub makefolder { } } else { $outcome = - &mt('Error - could not obtain lock on email folders record.'); + &mt('Error - could not obtain lock on message folders record.'); } return ($outcome,$warning); } @@ -555,16 +555,16 @@ sub discourse { } sub disgroup { - my ($cdom,$cnum,$group,$access_status) = @_; - my $result; + my ($r,$cdom,$cnum,$group,$access_status) = @_; + my $hasfloat; # Needs to be in a course if (!($env{'request.course.fn'})) { - $result = &mt('Error: you must have a course role selected to be able to send a broadcast message to a group in the course.'); - return $result; + $r->print(''.&mt('Error: you must have a course role selected to be able to send a broadcast message to a group in the course.').''); + return; } if ($cdom eq '' || $cnum eq '') { - $result = &mt('Error: could not determine domain or number of course'); - return $result; + $r->print(''.&mt('Error: could not determine domain or number of course').''); + return; } my ($memberinfo,$numitems) = &Apache::longroup::group_memberlist($cdom,$cnum,$group,{},[]); @@ -577,10 +577,13 @@ sub disgroup { push(@statustypes,('future','previous')); } if (keys(%{$memberinfo}) == 0) { - $result = &mt('As this group has no members, there are no '. - 'recipients to select.'); - return $result; + $r->print(''. + &mt('As this group has no members, there are no recipients to select'). + ''); + return; } else { + $hasfloat = 1; + $r->print('
'); my %Sortby = ( active => {}, previous => {}, @@ -606,7 +609,7 @@ sub disgroup { push(@{$Sortby{$status}{$$memberinfo{$user}{fullname}}},$user); } } - $result .= &group_check_uncheck(); + $r->print(&group_check_uncheck()); foreach my $status (@statustypes) { if (ref($numitems) eq 'HASH') { if ((defined($$numitems{$status})) && ($$numitems{$status})) { @@ -614,46 +617,46 @@ sub disgroup { if (ref($access_status) eq 'HASH') { $access_status->{$status} = $$numitems{$status}; } - $result.='
'.$lt{$status}. - '
'. - ''. - ''. - '  '. - ''. - ''; + $r->print('
'.$lt{$status}. + ''. + ''. + ''. + '  '. + ''. + ''); if ($status eq 'active') { - $result .= '   '; + $r->print((' 'x3).''); } - $result .= '
'.&Apache::loncommon::start_data_table(). + $r->print('
'.&Apache::loncommon::start_data_table(). &Apache::loncommon::start_data_table_header_row(). - "$lt{'name'}". - "$lt{'usnm'}". - "$lt{'doma'}". - &Apache::loncommon::end_data_table_header_row(); + "$lt{'name'}". + "$lt{'usnm'}". + "$lt{'doma'}". + &Apache::loncommon::end_data_table_header_row()); foreach my $key (sort(keys(%{$Sortby{$status}}))) { foreach my $user (@{$Sortby{$status}{$key}}) { - $result .= - &Apache::loncommon::start_data_table_row(). - 'print(&Apache::loncommon::start_data_table_row(). + ''. - $$memberinfo{$user}{'fullname'}.''. + $$memberinfo{$user}{'fullname'}.''. ''.$$memberinfo{$user}{'uname'}.''. ''.$$memberinfo{$user}{'udom'}.''. - &Apache::loncommon::end_data_table_row(); + &Apache::loncommon::end_data_table_row()); } } - $result .= &Apache::loncommon::end_data_table().'

'; + $r->print(&Apache::loncommon::end_data_table().''. + '

'); } } } } - return $result; + return $hasfloat; } sub group_check_uncheck { @@ -717,13 +720,13 @@ sub groupmail_header { {href=>"/adm/email?compose=group&group=". "$env{'form.group'}&$refarg", text=>"Send a Message in a Group", - title=>"Compose Group Email Message"},); + title=>"Compose Group Message"},); if ($action eq 'sending') { &Apache::lonhtmlcommon::add_breadcrumb ({text=>"Messages being sent.", - title=>"Messages sent"},); + title=>"E-mails sent"},); } - my $groupheader = &Apache::loncommon::start_page('Group Email'); + my $groupheader = &Apache::loncommon::start_page('Group Message'); $groupheader .= &Apache::lonhtmlcommon::breadcrumbs ('Group - '.$env{'form.group'}.' Email'); return $groupheader; @@ -737,7 +740,7 @@ sub groupmail_sent { } my $output .= '

'. - &mt('Send another group email').''.'   '. + &mt('Send another group message').''.'   '. ''. &mt('Return to group page').''; return $output; @@ -1107,10 +1110,10 @@ ENDDISHEADER } my $localsenttime = &Apache::lonlocal::locallocaltime($sendtime); my $count = $n +1; - $r->print(''.(($status eq 'new')?'':''). + $r->print(''.(($status eq 'new')?'':''). $count.'.'.(($status eq 'new')?'':'').' '. ''); + ' value="'.$origID.'" />'); foreach my $item ($localsenttime,$dis_name,$dis_domain,$shortsubj) { $r->print(''.(($status eq 'new')?'':''). ''. @@ -1286,7 +1289,7 @@ sub compout { $dispcrit= ''.$crithelp.'  '.&mt('Require return receipt?').'  
'. '
'. +&mt('Send copy to permanent e-mail address (if known)').'
'. '
'; } @@ -1322,10 +1325,7 @@ sub compout { } else { $can_grp_broadcast = &check_group_priv($group); if ($can_grp_broadcast) { - $r->print('
'. - &disgroup($cdom,$cnum,$group,\%access_status). - '
'); - $hasfloat = 1; + $hasfloat = &disgroup($r,$cdom,$cnum,$group,\%access_status); } } if ($hasfloat) { @@ -1675,6 +1675,7 @@ ENDADD sub submit_button_row { my ($folder,$dismode,$sendtext,$lt,$is_crsform,$group) = @_; my $pre=&mt("Show Preview and Check Spelling"); + my $value=&mt('Send'); my $prevbutton = ''; my $output = qq| @@ -1687,7 +1688,7 @@ sub submit_button_row { } $output .= qq|
- +  $prevbutton
|; @@ -1812,7 +1813,7 @@ $content{'sendername'}.':'. } # Check to see if there were any messages. if ($result eq '') { - my $lctype = lc(&Apache::loncommon::course_type()); + my $lctype = &mt(lc(&Apache::loncommon::course_type())); if ($target ne 'tex') { $r->print("

".&mt('No notes, face-to-face discussion records, critical messages, or broadcast messages in this [_1].',$lctype)."

"); } else { @@ -2261,29 +2262,66 @@ sub displaymessage { # start output &printheader($r,'/adm/email?display='.&escape($msgid),'Display a Message','',$content{'baseurl'}); my %courseinfo=&Apache::lonnet::coursedescription($content{'courseid'}); -# Functions - $r->print(''); + +# Functions and Actions + my $li_start='• '; + my $li_end=' '; + +# Prepare available functions + my $functionlist=''; if (!$content{'noreplies'}) { - $r->print(''); - } - $r->print(''. - ''. - ''. - ''); + $functionlist.=$li_start + .'' + .&mt('Reply') + .'' + .$li_end; + } + $functionlist.=$li_start + .'' + .&mt('Forward') + .'' + .$li_end; + $functionlist.=$li_start + .'' + .&mt('Mark Unread') + .'' + .$li_end; + $functionlist.=$li_start + .'' + .&mt('Delete') + .'' + .$li_end; + $functionlist.=$li_start + .'' + .&mt('Back to Folder Display') + .'' + .$li_end; if ($counter > 0){ - $r->print(''); + $functionlist.=$li_start + .'' + .&mt('Previous') + .'' + .$li_end; } if ($counter < $number_of_messages - 1){ - $r->print(''); - } - $r->print('
'.&mt('Functions').':'.&mt('Reply').''.&mt('Forward').''.&mt('Mark Unread').''.&mt('Delete').''.&mt('Back to Folder Display').''.&mt('Previous').''.&mt('Next').'
'); + $functionlist.=$li_start + .'' + .&mt('Next') + .'' + .$li_end; + } +# Print functions + $r->print('
' + .'
' + .'' + .&mt('Functions') + .'' + .$functionlist + .'
' + .'
' + ); + +# Prepare available actions my $symb; if (defined($content{'symb'})) { $symb = $content{'symb'}; @@ -2292,33 +2330,40 @@ sub displaymessage { } if ($env{'user.adv'}) { my $actionlist=''; + if (&Apache::lonnet::allowed('vgr',$env{'request.course.id'})) { - $actionlist.='' + $actionlist.=$li_start .&Apache::loncommon::track_student_link( &mt('View recent activity'),$content{'sendername'},$content{'senderdomain'},'check') - .''; + .$li_end; } if (&Apache::lonnet::allowed('opa',$env{'request.course.id'}) && $symb) { - $actionlist.='' + $actionlist.=$li_start .&Apache::loncommon::pprmlink( &mt('Set/Change parameters'),$content{'sendername'},$content{'senderdomain'},$symb,'check') - .''; + .$li_end; } if (&Apache::lonnet::allowed('mgr',$env{'request.course.id'}) && $symb) { - $actionlist.='' + $actionlist.=$li_start .&Apache::loncommon::pgrdlink( &mt('Set/Change grades'),$content{'sendername'},$content{'senderdomain'},$symb,'check') - .''; + .$li_end; } + +# Print actions if ($actionlist) { - $r->print('' - .'' + $r->print('
' + .'
' + .'' + .&mt('[_1]Currently available actions[_2] (will open extra window):','','') + .'' .$actionlist - .'
' - .&mt('Currently available actions (will open extra window):') - .'
'); + .'' + .'' + ); } } + my ($tonum,$tolist,$cclist,$bcclist,$groupcclist,%recipients); if ($content{'recipid'}) { $tonum = &retrieve_recips('display',\%content,\%recipients); @@ -2332,7 +2377,16 @@ sub displaymessage { $bcclist = join(', ',@{$recipients{'bcc'}}); } } - if (!$tolist && ref($content{'recuser'}) eq 'ARRAY') { + + my $broadcast_link; + if (($content{'courseid'}) && ($content{'recipid'} && + (ref($recipients{'course_broadcast'}) eq 'ARRAY') || + (ref($recipients{'group_cc_broadcast'}) eq 'ARRAY') || + (ref($recipients{'group_bcc_broadcast'}) eq 'ARRAY'))) { + $broadcast_link = &recipients_link($r,\%content,\%recipients); + } + + if (((!$tolist) && (!$broadcast_link)) && ref($content{'recuser'}) eq 'ARRAY') { my @recipients; for (my $i=0; $i<@{$content{'recuser'}}; $i++) { $recipients[$i] = &Apache::loncommon::aboutmewrapper( @@ -2354,21 +2408,14 @@ sub displaymessage { if (defined($content{'baseurl'})) { $baseurl = &Apache::lonenc::check_encrypt($content{'baseurl'}); } + $r->print('' .&Apache::lonhtmlcommon::start_pick_box() .&Apache::lonhtmlcommon::row_title(&mt('Subject')) .$content{'subject'} @@ -2376,10 +2423,12 @@ sub displaymessage { ); if ($folder eq 'sent') { # To - $r->print(&Apache::lonhtmlcommon::row_title(&mt('To')) - .$tolist - .&Apache::lonhtmlcommon::row_closure() - ); + if ($tolist) { + $r->print(&Apache::lonhtmlcommon::row_title(&mt('To')) + .$tolist + .&Apache::lonhtmlcommon::row_closure() + ); + } if ($cclist) { $r->print(&Apache::lonhtmlcommon::row_title(&mt('Cc')) .$cclist @@ -2633,13 +2682,13 @@ sub recipients_link { $nothing=&Apache::lonhtmlcommon::javascript_nothing(); $height = 400; $width = 600; - my $start_page = - &Apache::loncommon::start_page('Broadcast List', undef, - {only_body => 1, - js_ready => 1,}); - my $end_page = &Apache::loncommon::end_page({js_ready => 1,}); - my $body = '

'.&mt("Recipients of broadcast message").'

'. - &Apache::loncommon::start_data_table(); + $start_page = + &Apache::loncommon::start_page('Broadcast List', undef, + {only_body => 1, + js_ready => 1,}); + $end_page = &Apache::loncommon::end_page({js_ready => 1,}); + $body = '

'.&mt("Recipients of broadcast message").'

'. + &Apache::loncommon::start_data_table(); my $cell = 0; $body .= &Apache::loncommon::start_data_table_row(); foreach my $item (@{$recipients->{$show.'_broadcast'}}) {