version 1.108, 2004/09/20 15:01:56
|
version 1.112, 2004/11/09 16:29:32
|
Line 600 sub movemsg {
|
Line 600 sub movemsg {
|
|
|
sub discourse { |
sub discourse { |
my $r=shift; |
my $r=shift; |
my %courselist=&Apache::lonnet::dump( |
my $classlist = &Apache::loncoursedata::get_classlist(); |
'classlist', |
|
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
|
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
|
my $now=time; |
my $now=time; |
my %lt=&Apache::lonlocal::texthash('cfa' => 'Check for All', |
my %lt=&Apache::lonlocal::texthash('cfa' => 'Check for All', |
'cfs' => 'Check for Section/Group', |
'cfs' => 'Check for Section/Group', |
Line 645 sub discourse {
|
Line 642 sub discourse {
|
<input type="button" onClick="uncheckall()" value="$lt{'cfn'}" /> |
<input type="button" onClick="uncheckall()" value="$lt{'cfn'}" /> |
<p> |
<p> |
ENDDISHEADER |
ENDDISHEADER |
my %coursepersonnel= |
my %coursepersonnel=&Apache::lonnet::get_course_adv_roles(); |
&Apache::lonnet::get_course_adv_roles(); |
$r->print('<table>'); |
foreach my $role (sort keys %coursepersonnel) { |
foreach my $role (sort keys %coursepersonnel) { |
foreach (split(/\,/,$coursepersonnel{$role})) { |
foreach (split(/\,/,$coursepersonnel{$role})) { |
my ($puname,$pudom)=split(/\:/,$_); |
my ($puname,$pudom)=split(/\:/,$_); |
$r->print( |
$r->print('<tr><td><label>'. |
'<br /><input type="checkbox" name="send_to_&&&&&&_'. |
'<input type="checkbox" name="send_to_&&&&&&_'. |
$puname.':'.$pudom.'" /> '. |
$puname.':'.$pudom.'" /> '. |
&Apache::loncommon::plainname($puname, |
&Apache::loncommon::plainname($puname,$pudom). |
$pudom).' ('.$_.'), <i>'.$role.'</i>'); |
'</label></td>'. |
} |
'<td>('.$_.'),</td><td><i>'.$role.'</i></td></tr>'); |
|
} |
} |
} |
|
$r->print('</table><table>'); |
foreach (sort keys %courselist) { |
while (my ($student,$info) = each(%$classlist)) { |
my ($end,$start)=split(/\:/,$courselist{$_}); |
my ($sname,$sdom,$status,$fullname,$section) = |
my $active=1; |
(@{$info}[&Apache::loncoursedata::CL_SNAME(), |
if (($end) && ($now>$end)) { $active=0; } |
&Apache::loncoursedata::CL_SDOM(), |
if ($active) { |
&Apache::loncoursedata::CL_STATUS(), |
my ($sname,$sdom)=split(/\:/,$_); |
&Apache::loncoursedata::CL_FULLNAME(), |
my %reply=&Apache::lonnet::get('environment', |
&Apache::loncoursedata::CL_SECTION()]); |
['firstname','middlename','lastname','generation'], |
next if ($status ne 'Active'); |
$sdom,$sname); |
my $key = 'send_to_&&&'.$section.'&&&'.$student; |
my $section=&Apache::lonnet::usection |
if (! defined($fullname) || $fullname eq '') { $fullname = $sname; } |
($sdom,$sname,$ENV{'request.course.id'}); |
$r->print('<tr><td><label>'. |
$r->print( |
qq{<input type="checkbox" name="$key">}.(' 'x2). |
'<br><input type=checkbox name="send_to_&&&'.$section.'&&&_'.$_.'"> '. |
$fullname.'</td><td>'.$sname.'@'.$sdom.'</td><td>'.$section. |
$reply{'firstname'}.' '. |
'</td></tr>'); |
$reply{'middlename'}.' '. |
|
$reply{'lastname'}.' '. |
|
$reply{'generation'}. |
|
' ('.$_.') '.$section); |
|
} |
|
} |
} |
|
$r->print('</table>'); |
} |
} |
|
|
# ==================================================== Display Critical Message |
# ==================================================== Display Critical Message |
Line 776 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 976 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 1016 $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 1640 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 { |