--- loncom/interface/lonmsgdisplay.pm 2010/05/29 23:19:52 1.151 +++ loncom/interface/lonmsgdisplay.pm 2012/02/14 17:28:25 1.157.4.1 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging display # -# $Id: lonmsgdisplay.pm,v 1.151 2010/05/29 23:19:52 raeburn Exp $ +# $Id: lonmsgdisplay.pm,v 1.157.4.1 2012/02/14 17:28:25 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -110,7 +110,7 @@ use Apache::lonfeedback; use Apache::lonrss(); use Apache::lonselstudent(); use lib '/home/httpd/lib/perl/'; -use LONCAPA; +use LONCAPA qw(:DEFAULT :match); # Querystring component with sorting type my $sqs=''; @@ -225,18 +225,18 @@ function folder_choice(targetform,caller '); } $r->print('
'.$lt{'fold'}.'
'."\n". - &Apache::loncommon::select_form($folder,'folder',%formhash).' + &Apache::loncommon::select_form($folder,'folder',\%formhash).'
'.$lt{'show'}.'
'."\n". &Apache::loncommon::select_form($env{'form.interdis'},'interdis', - %show).' + \%show).'
'.$lt{'status'}.'
'."\n". - &Apache::loncommon::select_form($msgstatus,'msgstatus',%statushash).' + &Apache::loncommon::select_form($msgstatus,'msgstatus',\%statushash).'
'.$lt{'actn'}.'
'."\n".' '. - &Apache::loncommon::select_form('view','folderaction',%actions). + &Apache::loncommon::select_form('view','folderaction',\%actions). ' @@ -626,9 +626,7 @@ sub disgroup { return; } else { $hasfloat = 1; - unless($env{'environment.wysiwygeditor'} eq 'on') { - $r->print('
'); - } + $r->print('
'); my %Sortby = ( active => {}, previous => {}, @@ -701,9 +699,7 @@ sub disgroup { } } } - unless($env{'environment.wysiwygeditor'} eq 'on') { - $r->print('
'); - } + $r->print('
'); } return $hasfloat; } @@ -818,6 +814,15 @@ sub discrit { foreach my $key (sort(keys(%what))) { my %content=&Apache::lonmsg::unpackagemsg($what{$key}); next if ($content{'senderdomain'} eq ''); + my $description; + if ($content{'courseid'} ne '') { + if ($content{'courseid'} =~ m{/^$match_domain\_$match_courseid$}) { + my %courseinfo=&Apache::lonnet::coursedescription($content{'courseid'},{'one_time' => 1}); + if ($courseinfo{'description'} ne '') { + $description = $courseinfo{'description'}; + } + } + } $result .= &Apache::lonhtmlcommon::start_pick_box() .&Apache::lonhtmlcommon::row_title(&mt('From'),undef,'LC_oddrow_value') .''.&Apache::loncommon::aboutmewrapper( @@ -829,8 +834,13 @@ sub discrit { .&Apache::lonhtmlcommon::row_closure(1) .&Apache::lonhtmlcommon::row_title(&mt('Subject'),undef,'LC_oddrow_value') .$content{'subject'} - .&Apache::lonhtmlcommon::row_closure(1) - .&Apache::lonhtmlcommon::row_title(&mt('Message'),undef,'LC_evenrow_value') + .&Apache::lonhtmlcommon::row_closure(1); + if ($description ne '') { + $result .= &Apache::lonhtmlcommon::row_title(&mt('Course'),undef,'LC_oddrow_value') + .$description + .&Apache::lonhtmlcommon::row_closure(1); + } + $result .= &Apache::lonhtmlcommon::row_title(&mt('Message'),undef,'LC_evenrow_value') .'
'.&Apache::lontexconvert::msgtexconverted($content{'message'}).'
' .&Apache::lonhtmlcommon::row_closure() .&Apache::lonhtmlcommon::row_title('',undef,'LC_oddrow_value') @@ -985,10 +995,15 @@ sub get_course_desc { if (defined($env{'course.'.$fromcid.'.description'})) { $description = $env{'course.'.$fromcid.'.description'}; } else { - my %courseinfo=&Apache::lonnet::coursedescription($fromcid); - $description = $courseinfo{'description'}; + if ($fromcid =~ m{/^$match_domain\_$match_courseid$}) { + my %courseinfo=&Apache::lonnet::coursedescription($fromcid, + {'one_time' => 1}); + $description = $courseinfo{'description'}; + } + } + if ($description ne '') { + $$descriptions{$fromcid} = $description; } - $$descriptions{$fromcid} = $description; } return $description; } @@ -1257,7 +1272,7 @@ ENDDISHEADER $userfolders{$key} = $key; } $userfolders{''} = ""; - $r->print(&Apache::loncommon::select_form('','movetofolder',%userfolders). + $r->print(&Apache::loncommon::select_form('','movetofolder',\%userfolders). '
'. @@ -1423,11 +1438,7 @@ sub compout { if ($group eq '') { my $studentsel = &discourse(\%access_status); if ($studentsel) { - if ($env{'environment.wysiwygeditor'} eq 'on') { - $r->print($studentsel); - } else { - $r->print('
'.$studentsel.'
'); - } + $r->print('
'.$studentsel.'
'); $hasfloat = 1; } } else { @@ -1523,11 +1534,7 @@ ENDREPSCRIPT if ($env{'form.text'}) { $dismsg=$env{'form.text'}; } if ($env{'form.subject'}) { $dissub=$env{'form.subject'}; } if ($hasfloat) { - if ($env{'environment.wysiwygeditor'} eq 'on') { - $r->print($broadcast_js); - } else { - $r->print($broadcast_js.'
'); - } + $r->print($broadcast_js.'
'); $onsubmit = ' onsubmit="javascript:courseRecipients();" '; } $r->print( @@ -1637,7 +1644,11 @@ ENDREPSCRIPT } } my $latexHelp = &Apache::loncommon::helpLatexCheatsheet(undef,undef,1); - my $wysiwyglink=&Apache::lonhtmlcommon::htmlareaselectactive('message').'
'; + my $textareaclass; + if (&Apache::lonhtmlcommon::htmlareabrowser()) { + $r->print(&Apache::lonhtmlcommon::htmlareaselectactive()); + $textareaclass = 'class="LC_richDefaultOff"'; + } my $subj_size; if ($multiforward) { $r->print(&additional_rec_row(\%lt)); @@ -1659,8 +1670,7 @@ ENDREPSCRIPT
'."\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(''); @@ -1680,8 +1690,9 @@ $wysiwyglink); $attachrow

$latexHelp
-$wysiwyglink + +
$sendmode $dispcrit $disbase @@ -1706,8 +1717,8 @@ ENDCOMP Subject:

$lt{'gmt'}:
-$wysiwyglink

+

$lt{'tff'}: ENDBLOCK @@ -1733,9 +1744,7 @@ ENDUPLOAD } $r->print(''); if ($hasfloat) { - unless($env{'environment.wysiwygeditor'} eq 'on') { - $r->print('

'); - } + $r->print(''); } $r->print(&generate_preview_form); } @@ -1756,12 +1765,18 @@ sub check_group_priv { sub recipient_input_row { my ($dom,%lt) = @_; - my $domform = &Apache::loncommon::select_dom_form($dom,'recdomain'); + my $domform; + if (($dom eq 'relate') && (!$env{'user.adv'})) { + $domform = ''.$dom.''. + ''; + } else { + $domform = &Apache::loncommon::select_dom_form($dom,'recdomain'); + } my $selectlink= &Apache::loncommon::selectstudent_link('compemail','recuname', 'recdomain'); my $output = <<"ENDREC"; -$lt{'to'} $lt{'us'}:  $lt{'do'}: $domform  $selectlink +$lt{'to'} $lt{'us'}:  $lt{'do'}: $domform  $selectlink ENDREC return $output; } @@ -2412,7 +2427,6 @@ sub displaymessage { 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'}); # Prepare available functions my @functionlist; @@ -2656,12 +2670,14 @@ sub displaymessage { } if ($content{'group'} ne '') { if (&check_group_priv($content{'group'})) { - $groupcclist = join(', ',@{$recipients{'group_cc_broadcast'}}); - if ($groupcclist) { - $r->print(&Apache::lonhtmlcommon::row_title(&mt('Group Cc')) - .$groupcclist - .&Apache::lonhtmlcommon::row_closure() - ); + if (ref($recipients{'group_cc_broadcast'}) eq 'ARRAY') { + $groupcclist = join(', ',@{$recipients{'group_cc_broadcast'}}); + if ($groupcclist) { + $r->print(&Apache::lonhtmlcommon::row_title(&mt('Group Cc')) + .$groupcclist + .&Apache::lonhtmlcommon::row_closure() + ); + } } } } @@ -2669,14 +2685,22 @@ sub displaymessage { } # Course - if ($content{'courseid'}) { - $r->print(&Apache::lonhtmlcommon::row_title(&mt($crstype)) - .$courseinfo{'description'} - ); - if ($content{'coursesec'}) { - $r->print(' ('.&mt('Section').': '.$content{'coursesec'}.')'); + if ($content{'courseid'} ne '') { + if ($content{'courseid'} =~ m{^$match_domain\_$match_courseid$}) { + my %courseinfo; + %courseinfo=&Apache::lonnet::coursedescription($content{'courseid'}, + {'one_time' => 1}); + my $description = $courseinfo{'description'}; + if ($description ne '') { + $r->print(&Apache::lonhtmlcommon::row_title(&mt($crstype)) + .$description + ); + if ($content{'coursesec'}) { + $r->print(' ('.&mt('Section').': '.$content{'coursesec'}.')'); + } + $r->print(&Apache::lonhtmlcommon::row_closure()); + } } - $r->print(&Apache::lonhtmlcommon::row_closure()); } $r->print(&Apache::lonhtmlcommon::row_title(&mt('Time')) .$content{'time'} @@ -3310,6 +3334,9 @@ sub sendoffmail { $r->print($message); } } + } else { + &printheader($r,'','Messages cancelled.'); + return 'cancelled'; } return $sendstatus; }