--- loncom/interface/lonmsgdisplay.pm 2008/12/03 21:09:44 1.99 +++ loncom/interface/lonmsgdisplay.pm 2009/01/04 17:43:19 1.107 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging display # -# $Id: lonmsgdisplay.pm,v 1.99 2008/12/03 21:09:44 schafran Exp $ +# $Id: lonmsgdisplay.pm,v 1.107 2009/01/04 17:43:19 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,17 +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 -e-mail 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,{},[]); @@ -578,10 +577,13 @@ e-mail to a group in the course.'); 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 => {}, @@ -607,7 +609,7 @@ e-mail to a group in the course.'); 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})) { @@ -615,46 +617,46 @@ e-mail to a group in the course.'); 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 { @@ -1108,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')?'':''). ''. @@ -1287,7 +1289,7 @@ sub compout { $dispcrit= ''.$crithelp.'  '.&mt('Require return receipt?').'  
'. '
'. +&mt('Send copy to permanent e-mail address (if known)').'
'. '
'; } @@ -1323,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) { @@ -1814,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 { @@ -2263,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'}; @@ -2294,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); @@ -2334,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( @@ -2356,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'} @@ -2378,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