version 1.110, 2004/09/28 14:38:50
|
version 1.112, 2004/11/09 16:29:32
|
Line 770 sub sortedmessages {
|
Line 770 sub sortedmessages {
|
return @temp; |
return @temp; |
} |
} |
|
|
|
# ======================================================== Display new messages |
|
|
|
|
|
sub disnew { |
|
my $r=shift; |
|
my %lt=&Apache::lonlocal::texthash( |
|
'nm' => 'New Messages', |
|
'su' => 'Subject', |
|
'da' => 'Date', |
|
'us' => 'Username', |
|
'op' => 'Open', |
|
'do' => 'Domain' |
|
); |
|
my @msgids = sort split(/\&/,&Apache::lonnet::reply |
|
('keys:'.$ENV{'user.domain'}.':'. |
|
$ENV{'user.name'}.':nohist_email', |
|
$ENV{'user.home'})); |
|
my @newmsgs; |
|
my %setters = (); |
|
my $startblock = 0; |
|
my $endblock = 0; |
|
my %blocked = (); |
|
my $numblocked = 0; |
|
# Check for blocking of display because of scheduled online exams. |
|
&blockcheck(\%setters,\$startblock,\$endblock); |
|
foreach (@msgids) { |
|
my ($sendtime,$shortsubj,$fromname,$fromdom,$status)= |
|
&Apache::lonmsg::unpackmsgid($_); |
|
if (defined($sendtime) && $sendtime!~/error/) { |
|
my $numsendtime = $sendtime; |
|
$sendtime = &Apache::lonlocal::locallocaltime($sendtime); |
|
if ($status eq 'new') { |
|
if ($numsendtime >= $startblock && ($numsendtime <= $endblock && $endblock > 0) ) { |
|
$blocked{$_} = 'ON'; |
|
$numblocked ++; |
|
} else { |
|
push @newmsgs, { |
|
msgid => $_, |
|
sendtime => $sendtime, |
|
shortsub => &Apache::lonnet::unescape($shortsubj), |
|
from => $fromname, |
|
fromdom => $fromdom |
|
} |
|
} |
|
} |
|
} |
|
} |
|
if ($#newmsgs >= 0) { |
|
$r->print(<<TABLEHEAD); |
|
<h2>$lt{'nm'}</h2> |
|
<table border=2><tr><th> </th> |
|
<th>$lt{'da'}</th><th>$lt{'us'}</th><th>$lt{'do'}</th><th>$lt{'su'}</th></tr> |
|
TABLEHEAD |
|
foreach my $msg (@newmsgs) { |
|
$r->print(<<"ENDLINK"); |
|
<tr bgcolor="#FFBB77"> |
|
<td><a href="/adm/email?display=$msg->{'msgid'}">$lt{'op'}</a></td> |
|
ENDLINK |
|
foreach ('sendtime','from','fromdom','shortsub') { |
|
$r->print("<td>$msg->{$_}</td>"); |
|
} |
|
$r->print("</td></tr>"); |
|
} |
|
$r->print('</table></body></html>'); |
|
} elsif ($numblocked == 0) { |
|
$r->print("<h3>".&mt('You have no unread messages')."</h3>"); |
|
} |
|
if ($numblocked > 0) { |
|
my $beginblock = &Apache::lonlocal::locallocaltime($startblock); |
|
my $finishblock = &Apache::lonlocal::locallocaltime($endblock); |
|
if ($numblocked == 1) { |
|
$r->print("<h3>".&mt('You have').' '.$numblocked.' '.&mt('blocked unread message').".</h3>"); |
|
$r->print(&mt('This message is not viewable because').' '); |
|
} else { |
|
$r->print("<h3>".&mt('You have').' '.$numblocked.' '.&mt('blocked unread messages').".</h3>"); |
|
$r->print(&mt('These').' '.$numblocked.' '.&mt('messages are not viewable because ')); |
|
} |
|
$r->print( |
|
&mt('display of LON-CAPA messages sent to you by other students between').' '.$beginblock.' '.&mt('and').' '.$finishblock.' '.&mt('is currently being blocked because of online exams').'.'); |
|
&build_block_table($r,$startblock,$endblock,\%setters); |
|
} |
|
} |
|
|
|
|
# ======================================================== Display all messages |
# ======================================================== Display all messages |
|
|
sub disall { |
sub disall { |
Line 970 sub compout {
|
Line 1054 sub compout {
|
$dismsg=~s/\f/\n/g; |
$dismsg=~s/\f/\n/g; |
$dismsg=~s/\n+/\n\> /g; |
$dismsg=~s/\n+/\n\> /g; |
} |
} |
|
my $citation=&displayresource(%content); |
if ($ENV{'form.recdom'}) { $defdom=$ENV{'form.recdom'}; } |
if ($ENV{'form.recdom'}) { $defdom=$ENV{'form.recdom'}; } |
$r->print( |
$r->print( |
'<form action="/adm/email" name="compemail" method="post"'. |
'<form action="/adm/email" name="compemail" method="post"'. |
Line 1010 $latexHelp
|
Line 1095 $latexHelp
|
</textarea></p><br /> |
</textarea></p><br /> |
$dispcrit |
$dispcrit |
<input type="submit" name="send" value="$func $lt{'ma'}" /> |
<input type="submit" name="send" value="$func $lt{'ma'}" /> |
<input type="submit" name="cancel" value="$lt{'ca'}" /> |
<input type="submit" name="cancel" value="$lt{'ca'}" /><hr /> |
|
$citation |
ENDCOMP |
ENDCOMP |
} else { # $broadcast is 'upload' |
} else { # $broadcast is 'upload' |
$r->print(<<ENDUPLOAD); |
$r->print(<<ENDUPLOAD); |
Line 1634 sub displaymessage {
|
Line 1720 sub displaymessage {
|
'<br /><b>'.&mt('Time').':</b> '.$content{'time'}. |
'<br /><b>'.&mt('Time').':</b> '.$content{'time'}. |
'<p><pre>'. |
'<p><pre>'. |
&Apache::lontexconvert::msgtexconverted($content{'message'},1). |
&Apache::lontexconvert::msgtexconverted($content{'message'},1). |
'</pre><hr />'.$content{'citation'}.'</p>'); |
'</pre><hr />'.&displayresource(%content).'</p>'); |
return; |
return; |
} |
} |
|
|
|
# =========================================================== Show the citation |
|
|
|
sub displayresource { |
|
my %content=@_; |
|
# |
|
# If the recipient is in the same course that the message was sent from and |
|
# has sufficient privileges, show "all details," else show citation |
|
# |
|
if (($ENV{'request.course.id'} eq $content{'courseid'}) |
|
&& (&Apache::lonnet::allowed('vgr',$content{'courseid'}))) { |
|
my $symb=&Apache::lonnet::symbread($content{'baseurl'}); |
|
# Could not get a symb, give up |
|
unless ($symb) { return $content{'citation'}; } |
|
# Have a symb, can render |
|
return '<h2>'.&mt('Current attempts of student (if applicable)').'</h2>'. |
|
&Apache::loncommon::get_previous_attempt($symb, |
|
$content{'sendername'}, |
|
$content{'senderdomain'}, |
|
$content{'courseid'}). |
|
'<hr /><h2>'.&mt('Current screen output (if applicable)').'</h2>'. |
|
&Apache::loncommon::get_student_view($symb, |
|
$content{'sendername'}, |
|
$content{'senderdomain'}, |
|
$content{'courseid'}). |
|
'<h2>'.&mt('Correct Answer(s) (if applicable)').'</h2>'. |
|
&Apache::loncommon::get_student_answers($symb, |
|
$content{'sendername'}, |
|
$content{'senderdomain'}, |
|
$content{'courseid'}); |
|
} else { |
|
return $content{'citation'}; |
|
} |
|
} |
|
|
# ================================================================== The Header |
# ================================================================== The Header |
|
|
sub header { |
sub header { |