@@ -292,11 +297,11 @@ sub scrollbuttons {
}
return
''.&mt('Page').': '.
- ''.
- ''.
- ' of '.$maxdis.
- ''.
- ' '.
+ ''.
+ ''.
+ ' of '.$maxdis.
+ ''.
+ ' '.
&mt('[_1] messages: showing messages [_2] through [_3] of [_4].',$status,$first,$finish,$total).'';
}
# =============================================================== Status Change
@@ -353,7 +358,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);
}
@@ -502,7 +507,8 @@ sub movemsg {
# ======================================================= Display a course list
sub discourse {
- my $result;
+ my ($statushash) = @_;
+ my ($result,$active,$previous,$future);
my ($course_personnel,
$current_members,
$expired_members,
@@ -511,51 +517,80 @@ sub discourse {
unshift @$current_members, (@$course_personnel);
my %defaultUsers;
- $result .= ''."\n";
+ my $tmptext;
+ if ($tmptext = &Apache::lonselstudent::render_student_list($current_members,
+ "activeusers",
+ "current",
+ \%defaultUsers,
+ 1,"selectedusers",1,'email')
+ ) {
+ $result .= ' ';
+ if (ref($statushash) eq 'HASH') {
+ $statushash->{'active'} = 1;
+ }
+ }
+ if ($tmptext = &Apache::lonselstudent::render_student_list($expired_members,
+ "previoususers",
+ "expired",
+ \%defaultUsers,
+ 1, "selectedusers",0,'email')
+ ) {
+ $result .= ' ';
+ if (ref($statushash) eq 'HASH') {
+ $statushash->{'previous'} = 1;
+ }
- $result .= &Apache::lonselstudent::render_student_list($current_members,
- "compemail",
- "current",
- \%defaultUsers,
- 1,"selectedusers",1);
-
- $result .= &Apache::lonselstudent::render_student_list($expired_members,
- "compemail",
- "expired",
- \%defaultUsers,
- 1, "selectedusers",0);
- $result .= &Apache::lonselstudent::render_student_list($future_members,
- "compemail",
- "future",
- \%defaultUsers,
- 1, "selectedusers", 0);
+ }
+ if ($tmptext = &Apache::lonselstudent::render_student_list($future_members,
+ "futureusers",
+ "future",
+ \%defaultUsers,
+ 1, "selectedusers",0,'email')
+ ) {
+ $result .= '';
+ if (ref($statushash) eq 'HASH') {
+ $statushash->{'future'} = 1;
+ }
+
+ }
return $result;
}
sub disgroup {
- my ($cdom,$cnum,$group,$viewgrps,$editgrps) = @_;
- 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,{},[]);
my @statustypes = ('active');
+ my $viewgrps = &Apache::lonnet::allowed('vcg',$env{'request.course.id'}.
+ ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
+ my $editgrps = &Apache::lonnet::allowed('mdg',$env{'request.course.id'}.
+ ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
if ($viewgrps || $editgrps) {
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 {
- $result = &mt('Select message recipients from the group members listed below. ');
+ $hasfloat = 1;
+ unless($env{'environment.wysiwygeditor'} eq 'on') {
+ $r->print('
');
+ }
my %Sortby = (
active => {},
previous => {},
@@ -565,9 +600,9 @@ sub disgroup {
'name' => 'Name',
'usnm' => 'Username',
'doma' => 'Domain',
- 'active' => 'Active Members',
- 'previous' => 'Former Members',
- 'future' => 'Future Members',
+ 'active' => 'Broadcast to Active Members',
+ 'previous' => 'Broadcast (Bcc) to Former Members',
+ 'future' => 'Broadcast (Bcc) to Future Members',
);
foreach my $user (sort(keys(%{$memberinfo}))) {
my $status = $$memberinfo{$user}{status};
@@ -581,75 +616,81 @@ sub disgroup {
push(@{$Sortby{$status}{$$memberinfo{$user}{fullname}}},$user);
}
}
- $result .= &group_check_uncheck();
- $result .= '
'.
- '
';
+ $r->print(&group_check_uncheck());
foreach my $status (@statustypes) {
if (ref($numitems) eq 'HASH') {
if ((defined($$numitems{$status})) && ($$numitems{$status})) {
- $result.='
'.
- '');
if ($numblocked > 0) {
$r->print(&blocked_in_folder($numblocked,$startblock,$endblock,
\%setters));
@@ -1198,8 +1254,9 @@ sub compout {
&printheader($r,'/adm/email?compose=multiforward',
'Forwarding Multiple Messages');
if ($multiforward > 1) {
- $r->print(&mt('Each of the [quant,_1,message] you checked
-will be forwarded to the recipient(s) you select below.',$multiforward).' ');
+ $r->print(&mt('Each of the[_1] [quant,_2,message] [_3]you checked'
+ .' will be forwarded to the recipient(s) you select below.','',$multiforward,'')
+ .' ');
} else {
$r->print(&mt('The message you checked will be forwarded to the recipient(s) you select below.').' ');
}
@@ -1213,54 +1270,126 @@ will be forwarded to the recipient(s) yo
my $dissub='';
my $dismsg='';
my $disbase='';
- my $func=&mt('Send New');
+ my $attachrow;
+ my $func1='Send'; # do not translate here!
+ my %func2=( # do not translate here!
+ 'ma' => 'Message',
+ 'msg' => 'Messages',
+ );
my %lt=&Apache::lonlocal::texthash('us' => 'Username',
'do' => 'Domain',
'ad' => 'Additional Recipients',
+ 'rt' => 'Reply to',
+ 'ar' => 'Allow replies',
'sb' => 'Subject',
'ca' => 'Cancel',
- 'ma' => 'Mail',
- 'msg' => 'Messages',
'gen' => 'Generate messages from a file',
'gmt' => 'General message text',
'tff' => 'The file format for the uploaded portion of the message is',
'uas' => 'Upload and Send',
+ 'atta' => 'Attachment',
+ 'to' => 'To:',
);
+ my %attachmax = (
+ text => &mt('(128 KB max size)'),
+ num => 131072,
+ );
+ if (!$forwarding && !$multiforward) {
+ $attachrow = '
'.$lt{'atta'}.' '.$attachmax{'text'}.':
';
+ }
if (&Apache::lonnet::allowed('srm',$env{'request.course.id'})
|| &Apache::lonnet::allowed('srm',$env{'request.course.id'}.
'/'.$env{'request.course.sec'})) {
my $crithelp = Apache::loncommon::help_open_topic("Course_Critical_Message");
$dispcrit=
- '
' . $crithelp .
- '
'.
- '' . $crithelp .
- '
'.
-'';
+ ''.$crithelp.' '.&mt('Require return receipt?').' '.
+ ' '.
+' ';
}
if ($broadcast ne 'group') {
if (&Apache::lonnet::allowed('dff',$env{'request.course.id'}) ||
&Apache::lonnet::allowed('dff',$env{'request.course.id'}.
'/'.$env{'request.course.sec'})) {
- $dispcrit.='';
+ ' ';
}
}
my %message;
my %content;
+ my ($hasfloat,$broadcast_js,$sendmode,$can_grp_broadcast);
my $defdom=$env{'user.domain'};
+ if ($broadcast eq 'group') {
+ my %access_status = (
+ active => 0,
+ previous => 0,
+ future => 0,
+ );
+
+ if ($group eq '') {
+ my $studentsel = &discourse(\%access_status);
+ if ($studentsel) {
+ if ($env{'environment.wysiwygeditor'} eq 'on') {
+ $r->print($studentsel);
+ } else {
+ $r->print('
'.$studentsel.'
');
+ }
+ $hasfloat = 1;
+ }
+ } else {
+ $can_grp_broadcast = &check_group_priv($group);
+ if ($can_grp_broadcast) {
+ $hasfloat = &disgroup($r,$cdom,$cnum,$group,\%access_status);
+ }
+ }
+ if ($hasfloat) {
+ $sendmode = ''."\n";
+ $broadcast_js = qq|
+
+
+|;
+ }
+ }
if ($forwarding) {
%message=&Apache::lonnet::get('nohist_email'.$suffix,[$forwarding]);
%content=&Apache::lonmsg::unpackagemsg($message{$forwarding},$folder);
$dispcrit.='';
- $func=&mt('Forward');
+ $func1='Forward'; # do not translate here!
$dissub=&mt('Forwarding').': '.$content{'subject'};
$dismsg=&mt('Forwarded message from').' '.
@@ -1274,7 +1403,7 @@ will be forwarded to the recipient(s) yo
%content=&Apache::lonmsg::unpackagemsg($message{$replying},$folder);
$dispcrit.='';
- $func=&mt('Send Reply to');
+ $func1='Send Reply to'; # do not translate here!
$dissub=&mt('Reply').': '.$content{'subject'};
$dismsg='> '.$content{'message'};
@@ -1293,52 +1422,91 @@ will be forwarded to the recipient(s) yo
my $jscript = &Apache::loncommon::check_uncheck_jscript();
$r->print(<<"ENDREPSCRIPT");
ENDREPSCRIPT
}
my $citation=&displayresource(%content);
- my ($can_grp_broadcast,$viewgrps,$editgrps);
+ my $onsubmit;
if ($env{'form.recdom'}) { $defdom=$env{'form.recdom'}; }
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.'
'.&mt('[_1]Cc[_2] to other copied recipients','','').': '.$replyall.'
'.$cclist.'
');
+ }
+ }
+ if ($content{'group'} ne '') {
+ if (&check_group_priv($content{'group'})) {
+ if (ref($recips{'group_cc_broadcast'}) eq 'ARRAY') {
+ if (@{$recips{'group_cc_broadcast'}} > 0) {
+ my $replyall;
+ if (@{$recips{'group_cc_broadcast'}} > 1) {
+ $replyall = qq|
+
+
+
+
+
+|;
+ }
+ my $groupcclist = join(' ',@{$recips{'group_cc_broadcast'}});
+ $r->print('
'.&mt('[_1]Cc[_2] to other copied group members','','').': '.$replyall.'
'.$groupcclist.'
');
+ }
+ }
+ }
}
}
} else {
$r->print(&recipient_input_row($defdom,%lt));
}
}
- my $latexHelp = Apache::loncommon::helpLatexCheatsheet();
+ my $latexHelp = &Apache::loncommon::helpLatexCheatsheet(undef,undef,1);
+ my $wysiwyglink=&Apache::lonhtmlcommon::htmlareaselectactive('message').' ';
my $subj_size;
if ($multiforward) {
$r->print(&additional_rec_row(\%lt));
@@ -1363,7 +1556,7 @@ ENDREPSCRIPT
&mt('Unless you choose otherwise:').'
'.
&mt("The subject in each forwarded message will be 'Forwarding:' followed by the original subject.").'
'.
&mt("The message itself will begin with a first line: 'Forwarded message from' followed by the original sender's name.").'
');
- $func=&mt('Forward');
+ $func1='Forward'; # do not translate here!
$dissub = &mt('Forwarding').': ';
$subj_size = '10';
my $extra = '<'.&mt('original subject').'> '.
@@ -1373,31 +1566,39 @@ ENDREPSCRIPT
$r->print(&msg_subject_row($dissub,\%lt,$subj_size,$extra));
$r->print('
'.&mt('Message begins with:').'
'.$sender.' '.&mt('Yes').' '.&mt('No').'
- '.
-$latexHelp.
-&mt("Any new text to display before the text of the original messages:").'
- ');
+
+
'."\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");
-
ENDADD
return $output;
}
sub submit_button_row {
- my ($folder,$dismode,$sendtext,$lt) = @_;
- my $output = qq|
+ 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|
-
-
-
+|;
+ if ($is_crsform) {
+ $output .= ''."\n";
+ if ($group ne '') {
+ $output .= ''."\n";
+ }
+ }
+ $output .= qq|
+
+
+
+
$prevbutton
|;
return $output;
}
sub msg_subject_row {
my ($dissub,$lt,$subj_size,$extra) = @_;
- my $output = '
'.$lt->{'sb'}.':
'.$lt->{'sb'}.': '.$extra.
'
';
return $output;
}
+sub generate_preview_form {
+ my $prevbutton = (<
+
+
+
+ENDPREVIEW
+}
+
+# ---------------------------------------------------- Display all face to face
+
sub retrieve_instructor_comments {
my ($user,$domain)=@_;
my $target=$env{'form.grade_target'};
@@ -1599,7 +1842,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 {
@@ -1633,7 +1876,7 @@ sub facetoface {
return;
}
my $crstype = &Apache::loncommon::course_type();
- my $leaders = ($crstype eq 'Group') ? 'coordinators and leaders'
+ my $leaders = ($crstype eq 'Community') ? 'coordinators and leaders'
: 'faculty and staff';
&printheader($r,
'/adm/email?recordftf=query',
@@ -1656,21 +1899,23 @@ sub facetoface {
'subm' => 'Retrieve discussion and message records',
'newr' => 'New Record (record is visible to '.lc($crstype).' '.$leaders.')',
'post' => 'Post this Record');
- $r->print(<<"ENDTREC");
-
');
+ $message .= &Apache::lonhtmlcommon::confirm_success(&mt('Deleted [quant,_1,message]',$total));
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
&Apache::loncommunicate::menu($r);
&disall($r,($folder?$folder:$dismode),$msgstatus);
} elsif ($env{'form.markunread'}) {
@@ -2788,7 +3448,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 +3462,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);
@@ -2818,19 +3480,19 @@ sub handler {
}
if (keys(%forwardok) > 0) {
my $count = keys(%forwardok);
- $r->print(' '.
- &mt('[quant,_1,message] forwarded.',$count).
- '');
+ my $message = &Apache::lonhtmlcommon::confirm_success(&mt('[quant,_1,message] forwarded.',$count));
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
}
if (keys(%forwardfail) > 0) {
my $count = keys(%forwardfail);
- $r->print('
'.
- &mt('Could not forward [quant,_1,message].',$count).
- ' ');
+ my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Could not forward [quant,_1,message].',$count),1);
foreach my $key (keys(%forwardfail)) {
- $r->print(&mt('Could not deliver forwarded message.').' '.
- &mt('The recipient addresses may need to be corrected').' ('.$forwardfail{$key}.').
');
+ $message .= ' '.&mt('Could not deliver forwarded message.').' '.
+ &mt('The recipient addresses may need to be corrected').' ('.$forwardfail{$key}.')';
}
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
}
&Apache::loncommunicate::menu($r);
} else {
@@ -2854,10 +3516,13 @@ 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).' ');
+ my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Folder "[_1]" created.',$showfolder));
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
} else {
- $r->print(&mt('Creation failed.').' '.$makeresult.' '.
- $warning);
+ my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Creation failed.').' '.$makeresult.' '.$warning,1);
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
$showfolder = $folder;
}
&Apache::loncommunicate::menu($r);
@@ -2869,10 +3534,14 @@ sub handler {
my $showfolder = '';
my $delresult = &deletefolder($folder);
if ($delresult eq 'ok') {
- $r->print(&mt('Mail folder "[_1]" deleted.',$folder).' ');
+ my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Folder "[_1]" deleted.',$folder));
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
$env{'form.folder'} = '';
} else {
- $r->print(&mt('Deletion failed.').' '.$delresult.' ');
+ my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Deletion failed.').' '.$delresult,1);
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
$showfolder = $folder;
}
&Apache::loncommunicate::menu($r);
@@ -2882,9 +3551,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).' ');
+ my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Folder "[_1]" renamed to "[_2]".',$folder,$showfolder));
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
} else {
- $r->print(&mt('Renaming failed.').' '.$renresult.' ');
+ my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Renaming failed.').' '.$renresult,1);
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
$showfolder = $folder;
}
&Apache::loncommunicate::menu($r);