version 1.169, 2006/01/05 20:10:54
|
version 1.173, 2006/01/23 23:15:51
|
Line 538 sub user_normal_msg_raw {
|
Line 538 sub user_normal_msg_raw {
|
my ($user,$domain,$subject,$message,$citation,$baseurl,$attachmenturl, |
my ($user,$domain,$subject,$message,$citation,$baseurl,$attachmenturl, |
$toperm,$currid,$newid,$sentmessage)=@_; |
$toperm,$currid,$newid,$sentmessage)=@_; |
# Check if allowed missing |
# Check if allowed missing |
my $status=''; |
my ($status,$packed_message); |
my $msgid='undefined'; |
my $msgid='undefined'; |
my $text=$message; |
my $text=$message; |
unless (($message)&&($user)&&($domain)) { $status='empty'; }; |
unless (($message)&&($user)&&($domain)) { $status='empty'; }; |
my $homeserver=&Apache::lonnet::homeserver($user,$domain); |
my $homeserver=&Apache::lonnet::homeserver($user,$domain); |
if ($homeserver ne 'no_host') { |
if ($homeserver ne 'no_host') { |
($msgid,$message)=&packagemsg($subject,$message,$citation,$baseurl, |
($msgid,$packed_message)= |
|
&packagemsg($subject,$message,$citation,$baseurl, |
|
$attachmenturl,$user,$domain,$currid); |
|
(undef, my $packed_message_no_citation)= |
|
&packagemsg($subject,$message,undef ,$baseurl, |
$attachmenturl,$user,$domain,$currid); |
$attachmenturl,$user,$domain,$currid); |
# Store in user folder |
# Store in user folder |
$status=&Apache::lonnet::critical( |
$status=&Apache::lonnet::critical( |
'put:'.$domain.':'.$user.':nohist_email:'. |
'put:'.$domain.':'.$user.':nohist_email:'. |
&Apache::lonnet::escape($msgid).'='. |
&Apache::lonnet::escape($msgid).'='. |
&Apache::lonnet::escape($message),$homeserver); |
&Apache::lonnet::escape($packed_message),$homeserver); |
# Save new message received time |
# Save new message received time |
&Apache::lonnet::put |
&Apache::lonnet::put |
('email_status',{'recnewemail'=>time},$domain,$user); |
('email_status',{'recnewemail'=>time},$domain,$user); |
Line 558 sub user_normal_msg_raw {
|
Line 562 sub user_normal_msg_raw {
|
unless (($env{'request.course.id'}) && |
unless (($env{'request.course.id'}) && |
(($env{'form.sendmode'} eq 'group') || |
(($env{'form.sendmode'} eq 'group') || |
(($env{'form.critmsg'}) || ($env{'form.sendbck'})) && |
(($env{'form.critmsg'}) || ($env{'form.sendbck'})) && |
(&Apache::lonnet::allowed('srm',$env{'request.course.id'})))) { |
(&Apache::lonnet::allowed('srm',$env{'request.course.id'}) |
$status .= &store_sent_mail($msgid,$message); |
|| &Apache::lonnet::allowed('srm',$env{'request.course.id'}. |
|
'/'.$env{'request.course.sec'})))) { |
|
$status .= &store_sent_mail($msgid,$packed_message_no_citation); |
} |
} |
} else { |
} else { |
$status='no_host'; |
$status='no_host'; |
Line 568 sub user_normal_msg_raw {
|
Line 574 sub user_normal_msg_raw {
|
$$newid = $msgid; |
$$newid = $msgid; |
} |
} |
if (defined($sentmessage)) { |
if (defined($sentmessage)) { |
$$sentmessage = $message; |
$$sentmessage = $packed_message; |
} |
} |
|
|
# Notifications |
# Notifications |
Line 607 sub user_normal_msg {
|
Line 613 sub user_normal_msg {
|
$domain,$user); |
$domain,$user); |
my $msgforward=$userenv{'msgforward'}; |
my $msgforward=$userenv{'msgforward'}; |
if ($msgforward) { |
if ($msgforward) { |
foreach (split(/\,/,$msgforward)) { |
foreach (split(/\,/,$msgforward)) { |
my ($forwuser,$forwdomain)=split(/\:/,$_); |
my ($forwuser,$forwdomain)=split(/\:/,$_); |
$status.= |
$status.= |
&user_normal_msg_raw($forwuser,$forwdomain,$subject,$message, |
&user_normal_msg_raw($forwuser,$forwdomain,$subject,$message, |
$citation,$baseurl,$attachmenturl,$toperm,undef,undef,$sentmessage).' '; |
$citation,$baseurl,$attachmenturl,$toperm, |
} |
undef,undef,$sentmessage).' '; |
|
} |
} else { |
} else { |
$status=&user_normal_msg_raw($user,$domain,$subject,$message, |
$status=&user_normal_msg_raw($user,$domain,$subject,$message, |
$citation,$baseurl,$attachmenturl,$toperm,undef,undef,$sentmessage); |
$citation,$baseurl,$attachmenturl,$toperm, |
|
undef,undef,$sentmessage); |
} |
} |
return $status; |
return $status; |
} |
} |
|
|
sub store_sent_mail { |
sub store_sent_mail { |
my ($msgid,$message) = @_; |
my ($msgid,$message) = @_; |
my $status =' '.&Apache::lonnet::critical( |
my $status =' '.&Apache::lonnet::critical( |
'put:'.$env{'user.domain'}.':'.$env{'user.name'}. |
'put:'.$env{'user.domain'}.':'.$env{'user.name'}. |
':nohist_email_sent:'. |
':nohist_email_sent:'. |
&Apache::lonnet::escape($msgid).'='. |
&Apache::lonnet::escape($msgid).'='. |
&Apache::lonnet::escape($message),$env{'user.home'}); |
&Apache::lonnet::escape($message),$env{'user.home'}); |
return $status; |
return $status; |
} |
} |
|
|
Line 1228 sub compout {
|
Line 1236 sub compout {
|
'ca' => 'Cancel', |
'ca' => 'Cancel', |
'ma' => 'Mail'); |
'ma' => 'Mail'); |
|
|
if (&Apache::lonnet::allowed('srm',$env{'request.course.id'})) { |
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"); |
my $crithelp = Apache::loncommon::help_open_topic("Course_Critical_Message"); |
$dispcrit= |
$dispcrit= |
'<p><label><input type="checkbox" name="critmsg" /> '.&mt('Send as critical message').'</label> ' . $crithelp . |
'<p><label><input type="checkbox" name="critmsg" /> '.&mt('Send as critical message').'</label> ' . $crithelp . |
Line 1354 $dispcrit
|
Line 1364 $dispcrit
|
ENDUPLOAD |
ENDUPLOAD |
} |
} |
if ($broadcast eq 'group') { |
if ($broadcast eq 'group') { |
&discourse; |
&discourse($r); |
} |
} |
$r->print('</form>'. |
$r->print('</form>'. |
&Apache::lonfeedback::generate_preview_button('compemail','message'). |
&Apache::lonfeedback::generate_preview_button('compemail','message'). |
Line 1367 sub retrieve_instructor_comments {
|
Line 1377 sub retrieve_instructor_comments {
|
my ($user,$domain)=@_; |
my ($user,$domain)=@_; |
my $target=$env{'form.grade_target'}; |
my $target=$env{'form.grade_target'}; |
if (! $env{'request.course.id'}) { return; } |
if (! $env{'request.course.id'}) { return; } |
if (! &Apache::lonnet::allowed('srm',$env{'request.course.id'})) { |
if (! &Apache::lonnet::allowed('srm',$env{'request.course.id'}) |
|
&& ! &Apache::lonnet::allowed('srm',$env{'request.course.id'}. |
|
'/'.$env{'request.course.sec'})) { |
return; |
return; |
} |
} |
my %records=&Apache::lonnet::dump('nohist_email', |
my %records=&Apache::lonnet::dump('nohist_email', |
Line 1392 sub disfacetoface {
|
Line 1404 sub disfacetoface {
|
my ($r,$user,$domain)=@_; |
my ($r,$user,$domain)=@_; |
my $target=$env{'form.grade_target'}; |
my $target=$env{'form.grade_target'}; |
unless ($env{'request.course.id'}) { return; } |
unless ($env{'request.course.id'}) { return; } |
unless (&Apache::lonnet::allowed('srm',$env{'request.course.id'})) { |
if (!&Apache::lonnet::allowed('srm',$env{'request.course.id'}) |
|
&& ! &Apache::lonnet::allowed('srm',$env{'request.course.id'}. |
|
'/'.$env{'request.course.sec'})) { |
|
$r->print('Not allowed'); |
return; |
return; |
} |
} |
my %records=&Apache::lonnet::dump('nohist_email', |
my %records=&Apache::lonnet::dump('nohist_email', |
Line 1446 $content{'sendername'}.'@'.
|
Line 1461 $content{'sendername'}.'@'.
|
|
|
sub facetoface { |
sub facetoface { |
my ($r,$stage)=@_; |
my ($r,$stage)=@_; |
unless (&Apache::lonnet::allowed('srm',$env{'request.course.id'})) { |
if (!&Apache::lonnet::allowed('srm',$env{'request.course.id'}) |
|
&& ! &Apache::lonnet::allowed('srm',$env{'request.course.id'}. |
|
'/'.$env{'request.course.sec'})) { |
|
$r->print('Not allowed'); |
return; |
return; |
} |
} |
&printheader($r, |
&printheader($r, |
Line 1521 ENDBFORM
|
Line 1539 ENDBFORM
|
sub examblock { |
sub examblock { |
my ($r,$action) = @_; |
my ($r,$action) = @_; |
unless ($env{'request.course.id'}) { return;} |
unless ($env{'request.course.id'}) { return;} |
unless (&Apache::lonnet::allowed('srm',$env{'request.course.id'})) { $r->print('Not allowed'); } |
if (!&Apache::lonnet::allowed('srm',$env{'request.course.id'}) |
|
&& ! &Apache::lonnet::allowed('srm',$env{'request.course.id'}. |
|
'/'.$env{'request.course.sec'})) { |
|
$r->print('Not allowed'); |
|
return; |
|
} |
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'comb' => 'Communication Blocking', |
'comb' => 'Communication Blocking', |
'cbds' => 'Communication blocking during scheduled exams', |
'cbds' => 'Communication blocking during scheduled exams', |
Line 2012 sub displayresource {
|
Line 2035 sub displayresource {
|
$content{'sendername'}, |
$content{'sendername'}, |
$content{'senderdomain'}, |
$content{'senderdomain'}, |
$content{'courseid'}); |
$content{'courseid'}); |
} else { |
} elsif ($env{'user.adv'}) { |
return $content{'citation'}; |
return $content{'citation'}; |
} |
} |
|
return ''; |
} |
} |
|
|
# ================================================================== The Header |
# ================================================================== The Header |
Line 2137 sub sendoffmail {
|
Line 2161 sub sendoffmail {
|
my $msgtype; |
my $msgtype; |
my %sentmessage; |
my %sentmessage; |
if ((($env{'form.critmsg'}) || ($env{'form.sendbck'})) && |
if ((($env{'form.critmsg'}) || ($env{'form.sendbck'})) && |
(&Apache::lonnet::allowed('srm',$env{'request.course.id'}))) { |
(&Apache::lonnet::allowed('srm',$env{'request.course.id'}) |
|
|| &Apache::lonnet::allowed('srm',$env{'request.course.id'}. |
|
'/'.$env{'request.course.sec'}) |
|
)) { |
$savemsg=&Apache::lonfeedback::clear_out_html($env{'form.message'},1); |
$savemsg=&Apache::lonfeedback::clear_out_html($env{'form.message'},1); |
$msgtype = 'critical'; |
$msgtype = 'critical'; |
} else { |
} else { |
Line 2150 sub sendoffmail {
|
Line 2177 sub sendoffmail {
|
if ($toaddr{$_}) { $msgtxt.='<hr />'.$toaddr{$_}; } |
if ($toaddr{$_}) { $msgtxt.='<hr />'.$toaddr{$_}; } |
my $thismsg; |
my $thismsg; |
if ((($env{'form.critmsg'}) || ($env{'form.sendbck'})) && |
if ((($env{'form.critmsg'}) || ($env{'form.sendbck'})) && |
(&Apache::lonnet::allowed('srm',$env{'request.course.id'}))) { |
(&Apache::lonnet::allowed('srm',$env{'request.course.id'}) |
|
|| &Apache::lonnet::allowed('srm',$env{'request.course.id'}. |
|
'/'.$env{'request.course.sec'}))) { |
$r->print(&mt('Sending critical message').' '.$recuname.'@'.$recdomain.': '); |
$r->print(&mt('Sending critical message').' '.$recuname.'@'.$recdomain.': '); |
$thismsg=&user_crit_msg($recuname,$recdomain, |
$thismsg=&user_crit_msg($recuname,$recdomain, |
&Apache::lonfeedback::clear_out_html($env{'form.subject'}), |
&Apache::lonfeedback::clear_out_html($env{'form.subject'}), |