version 1.42, 2006/11/23 16:40:17
|
version 1.44, 2006/11/29 07:46:39
|
Line 649 sub disnew {
|
Line 649 sub disnew {
|
my @msgids = sort(&Apache::lonnet::getkeys('nohist_email')); |
my @msgids = sort(&Apache::lonnet::getkeys('nohist_email')); |
my @newmsgs; |
my @newmsgs; |
my %setters = (); |
my %setters = (); |
my $startblock = 0; |
|
my $endblock = 0; |
|
my %blocked = (); |
my %blocked = (); |
my $numblocked = 0; |
my $numblocked = 0; |
# Check for blocking of display because of scheduled online exams. |
# Check for blocking of display because of scheduled online exams. |
&blockcheck(\%setters,\$startblock,\$endblock); |
my ($startblock,$endblock) = &Apache::loncommon::blockcheck(\%setters,'com'); |
my %status_cache = |
my %status_cache = |
&Apache::lonnet::get('email_status',\@msgids); |
&Apache::lonnet::get('email_status',\@msgids); |
my %descriptions; |
my %descriptions; |
Line 715 ENDLINK
|
Line 713 ENDLINK
|
} |
} |
$r->print( |
$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').'.'); |
&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); |
$r->print(&Apache::loncommon::build_block_table($startblock,$endblock, |
|
\%setters)); |
} |
} |
} |
} |
|
|
Line 740 sub disfolder {
|
Line 739 sub disfolder {
|
my ($r,$folder)=@_; |
my ($r,$folder)=@_; |
my %blocked = (); |
my %blocked = (); |
my %setters = (); |
my %setters = (); |
my $startblock; |
|
my $endblock; |
|
my $numblocked = 0; |
my $numblocked = 0; |
&blockcheck(\%setters,\$startblock,\$endblock); |
my ($startblock,$endblock) = &Apache::loncommon::blockcheck(\%setters,'com'); |
$r->print(<<ENDDISHEADER); |
$r->print(<<ENDDISHEADER); |
<script type="text/javascript"> |
<script type="text/javascript"> |
function checkall() { |
function checkall() { |
Line 887 ENDDISHEADER
|
Line 884 ENDDISHEADER
|
my $finishblock = &Apache::lonlocal::locallocaltime($endblock); |
my $finishblock = &Apache::lonlocal::locallocaltime($endblock); |
$r->print('<br /><br />'. |
$r->print('<br /><br />'. |
$numblocked.' '.&mt('message(s) is/are not viewable because 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.')); |
$numblocked.' '.&mt('message(s) is/are not viewable because 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); |
$r->print(&Apache::loncommon::build_block_table($startblock,$endblock, |
|
\%setters)); |
} |
} |
} |
} |
|
|
Line 1039 sub compout {
|
Line 1037 sub compout {
|
my $latexHelp = Apache::loncommon::helpLatexCheatsheet(); |
my $latexHelp = Apache::loncommon::helpLatexCheatsheet(); |
if ($broadcast ne 'upload') { |
if ($broadcast ne 'upload') { |
$r->print(<<"ENDCOMP"); |
$r->print(<<"ENDCOMP"); |
<tr><td>$lt{'ad'}<br /><tt>username\@domain,username\@domain, ... |
<tr><td>$lt{'ad'}<br /><tt>username:domain,username:domain, ... |
</tt></td><td> |
</tt></td><td> |
<input type="text" size="50" name="additionalrec" /></td></tr> |
<input type="text" size="50" name="additionalrec" /></td></tr> |
<tr><td>$lt{'sb'}:</td><td><input type="text" size="50" name="subject" value="$dissub" /> |
<tr><td>$lt{'sb'}:</td><td><input type="text" size="50" name="subject" value="$dissub" /> |
Line 1077 Subject: <input type="text" size="50" na
|
Line 1075 Subject: <input type="text" size="50" na
|
<p> |
<p> |
The file format for the uploaded portion of the message is: |
The file format for the uploaded portion of the message is: |
<pre> |
<pre> |
username1\@domain1: text |
username1:domain1: text |
username2\@domain2: text |
username2:domain2: text |
username3\@domain1: text |
username3:domain1: text |
</pre> |
</pre> |
</p> |
</p> |
<p> |
<p> |
The messages will be assembled from all lines with the respective |
The messages will be assembled from all lines with the respective |
<tt>username\@domain</tt>, and appended to the general message text.</p> |
<tt>username:domain</tt>, and appended to the general message text.</p> |
<p> |
<p> |
<input type="file" name="upfile" size="40" /></p><p> |
<input type="file" name="upfile" size="40" /></p><p> |
$dispcrit |
$dispcrit |
Line 1311 ENDBFORM
|
Line 1309 ENDBFORM
|
sub examblock { |
sub examblock { |
my ($r,$action) = @_; |
my ($r,$action) = @_; |
unless ($env{'request.course.id'}) { return;} |
unless ($env{'request.course.id'}) { return;} |
if (!&Apache::lonnet::allowed('srm',$env{'request.course.id'}) |
if (!&Apache::lonnet::allowed('dcm',$env{'request.course.id'}) |
&& ! &Apache::lonnet::allowed('srm',$env{'request.course.id'}. |
&& ! &Apache::lonnet::allowed('dcm',$env{'request.course.id'}. |
'/'.$env{'request.course.sec'})) { |
'/'.$env{'request.course.sec'})) { |
$r->print('Not allowed'); |
$r->print('Not allowed'); |
return; |
return; |
Line 1331 sub examblock {
|
Line 1329 sub examblock {
|
'dura' => 'Duration', |
'dura' => 'Duration', |
'setb' => 'Set by', |
'setb' => 'Set by', |
'even' => 'Event', |
'even' => 'Event', |
|
'blck' => 'Blocked?', |
'actn' => 'Action', |
'actn' => 'Action', |
'star' => 'Start', |
'star' => 'Start', |
'endd' => 'End' |
'endd' => 'End' |
Line 1388 sub blockstore {
|
Line 1387 sub blockstore {
|
my %blocking = (); |
my %blocking = (); |
$r->print('<h3>'.$lt{'head'}.'</h3>'); |
$r->print('<h3>'.$lt{'head'}.'</h3>'); |
foreach my $envkey (keys(%env)) { |
foreach my $envkey (keys(%env)) { |
if ($envkey =~ m/^form\.modify_(\w+)$/) { |
if ($envkey =~ m/^form\.modify_(\d+)$/) { |
$adds{$1} = $1; |
$adds{$1} = $1; |
$removals{$1} = $1; |
$removals{$1} = $1; |
$modtotal ++; |
$modtotal ++; |
Line 1401 sub blockstore {
|
Line 1400 sub blockstore {
|
} elsif ($envkey =~ m/^form\.add_(\d+)$/) { |
} elsif ($envkey =~ m/^form\.add_(\d+)$/) { |
$adds{$1} = $1; |
$adds{$1} = $1; |
$addtotal ++; |
$addtotal ++; |
} |
} |
} |
} |
|
|
foreach my $key (keys(%removals)) { |
foreach my $key (keys(%removals)) { |
Line 1415 sub blockstore {
|
Line 1414 sub blockstore {
|
unless ( defined($cancels{$key}) ) { |
unless ( defined($cancels{$key}) ) { |
my ($newstart,$newend) = &get_dates_from_form($key); |
my ($newstart,$newend) = &get_dates_from_form($key); |
my $newkey = $newstart.'____'.$newend; |
my $newkey = $newstart.'____'.$newend; |
$blocking{$newkey} = $env{'user.name'}.':'.$env{'user.domain'}.':'.$env{'form.title_'.$key}; |
my $blocktypes = &get_block_choices($key); |
|
$blocking{$newkey} = { |
|
setter => $env{'user.name'}.':'.$env{'user.domain'}, |
|
event => &escape($env{'form.title_'.$key}), |
|
blocks => $blocktypes, |
|
}; |
} |
} |
} |
} |
if ($addtotal + $modtotal > 0) { |
if ($addtotal + $modtotal > 0) { |
Line 1466 sub get_blockdates {
|
Line 1470 sub get_blockdates {
|
} |
} |
} |
} |
|
|
|
sub get_block_choices { |
|
my $item = shift; |
|
my $blocklist; |
|
my ($typeorder,$types) = &blocktype_text(); |
|
foreach my $type (@{$typeorder}) { |
|
if ($env{'form.'.$type.'_'.$item}) { |
|
$blocklist->{$type} = 'on'; |
|
} else { |
|
$blocklist->{$type} = 'off'; |
|
} |
|
} |
|
return $blocklist; |
|
} |
|
|
sub display_blocker_status { |
sub display_blocker_status { |
my ($r,$records,$ltext) = @_; |
my ($r,$records,$ltext) = @_; |
my $parmcount = 0; |
my $parmcount = 0; |
Line 1474 sub display_blocker_status {
|
Line 1492 sub display_blocker_status {
|
'modi' => 'Modify', |
'modi' => 'Modify', |
'canc' => 'Cancel', |
'canc' => 'Cancel', |
); |
); |
|
my ($typeorder,$types) = &blocktype_text(); |
$r->print(&Apache::loncommon::start_data_table()); |
$r->print(&Apache::loncommon::start_data_table()); |
$r->print(<<"END"); |
$r->print(<<"END"); |
<tr> |
<tr> |
<th>$$ltext{'dura'}</th> |
<th>$ltext->{'dura'}</th> |
<th>$$ltext{'setb'}</th> |
<th>$ltext->{'setb'}</th> |
<th>$$ltext{'even'}</th> |
<th>$ltext->{'even'}</th> |
<th>$$ltext{'actn'}?</th> |
<th>$ltext->{'blck'}</th> |
|
<th>$ltext->{'actn'}?</th> |
</tr> |
</tr> |
END |
END |
foreach my $record (sort(keys(%{$records}))) { |
foreach my $record (sort(keys(%{$records}))) { |
Line 1491 END
|
Line 1511 END
|
my $startform = &Apache::lonhtmlcommon::date_setter('blockform','startdate_'.$parmcount,$start,$onchange); |
my $startform = &Apache::lonhtmlcommon::date_setter('blockform','startdate_'.$parmcount,$start,$onchange); |
my $endform = &Apache::lonhtmlcommon::date_setter('blockform','enddate_'.$parmcount,$end,$onchange); |
my $endform = &Apache::lonhtmlcommon::date_setter('blockform','enddate_'.$parmcount,$end,$onchange); |
|
|
my ($setuname,$setudom,$title) = |
my ($setuname,$setudom,$title,$blocks) = |
&parse_block_record($$records{$record}); |
&Apache::loncommon::parse_block_record($$records{$record}); |
$title = &HTML::Entities::encode($title,'"<>&'); |
$title = &HTML::Entities::encode($title,'"<>&'); |
my $settername = &Apache::loncommon::plainname($setuname,$setudom); |
my $settername = |
|
&Apache::loncommon::aboutmewrapper( |
|
&Apache::loncommon::plainname($setuname,$setudom), |
|
$setuname,$setudom); |
$r->print(&Apache::loncommon::start_data_table_row()); |
$r->print(&Apache::loncommon::start_data_table_row()); |
$r->print(<<"END"); |
$r->print(<<"END"); |
<td>$$ltext{'star'}: $startform<br/>$$ltext{'endd'}: $endform</td> |
<td>$ltext->{'star'}: $startform<br/>$ltext->{'endd'}: $endform</td> |
<td>$settername</td> |
<td>$settername</td> |
<td><input type="text" name="title_$parmcount" size="15" value="$title" /><input type="hidden" name="key_$parmcount" value="$record" /></td> |
<td><input type="text" name="title_$parmcount" size="15" value="$title" /><input type="hidden" name="key_$parmcount" value="$record" /></td> |
|
<td> |
|
END |
|
foreach my $block (@{$typeorder}) { |
|
my $blockstatus = ''; |
|
if ($blocks->{$block} eq 'on') { |
|
$blockstatus = 'checked="true"'; |
|
} |
|
$r->print('<label><input type="checkbox" name="'.$block.'_'.$parmcount.'" '.$blockstatus.' value="1" />'.$types->{$block}.'</label><br />'); |
|
} |
|
$r->print(<<"END"); |
|
</td> |
<td><label>$lt{'modi'}? <input type="checkbox" name="modify_$parmcount" /></label><br /><label>$lt{'canc'}? <input type="checkbox" name="cancel_$parmcount" /></label> |
<td><label>$lt{'modi'}? <input type="checkbox" name="modify_$parmcount" /></label><br /><label>$lt{'canc'}? <input type="checkbox" name="cancel_$parmcount" /></label> |
END |
END |
$r->print(&Apache::loncommon::end_data_table_row()); |
$r->print(&Apache::loncommon::end_data_table_row()); |
Line 1513 END
|
Line 1547 END
|
return $parmcount; |
return $parmcount; |
} |
} |
|
|
sub parse_block_record { |
|
my ($record) = @_; |
|
my ($setuname,$setudom,$title); |
|
my @data = split(/:/,$record,3); |
|
if (scalar(@data) eq 2) { |
|
$title = $data[1]; |
|
($setuname,$setudom) = split(/@/,$data[0]); |
|
} else { |
|
($setuname,$setudom,$title) = @data; |
|
} |
|
return ($setuname,$setudom,$title); |
|
} |
|
|
|
sub display_addblocker_table { |
sub display_addblocker_table { |
my ($r,$parmcount,$ltext) = @_; |
my ($r,$parmcount,$ltext) = @_; |
my $start = time; |
my $start = time; |
Line 1540 sub display_addblocker_table {
|
Line 1561 sub display_addblocker_table {
|
'exam' => 'e.g., Exam 1', |
'exam' => 'e.g., Exam 1', |
'addn' => 'Add new communication blocking periods' |
'addn' => 'Add new communication blocking periods' |
); |
); |
|
my ($typeorder,$types) = &blocktype_text(); |
$r->print(<<"END"); |
$r->print(<<"END"); |
<h4>$lt{'addn'}</h4> |
<h4>$lt{'addn'}</h4> |
END |
END |
$r->print(&Apache::loncommon::start_data_table()); |
$r->print(&Apache::loncommon::start_data_table()); |
$r->print(<<"END"); |
$r->print(<<"END"); |
<tr> |
<tr> |
<th>$$ltext{'dura'}</th> |
<th>$ltext->{'dura'}</th> |
<th>$$ltext{'even'} $lt{'exam'}</th> |
<th>$ltext->{'even'} $lt{'exam'}</th> |
<th>$$ltext{'actn'}?</th> |
<th>$ltext->{'blck'}</th> |
|
<th>$ltext->{'actn'}?</th> |
</tr> |
</tr> |
END |
END |
$r->print(&Apache::loncommon::start_data_table_row()); |
$r->print(&Apache::loncommon::start_data_table_row()); |
$r->print(<<"END"); |
$r->print(<<"END"); |
<td>$$ltext{'star'}: $startform<br />$$ltext{'endd'}: $endform</td> |
<td>$ltext->{'star'}: $startform<br />$ltext->{'endd'}: $endform</td> |
<td><input type="text" name="title_$parmcount" size="15" value="" /></td> |
<td><input type="text" name="title_$parmcount" size="15" value="" /></td> |
|
<td> |
|
END |
|
foreach my $block (@{$typeorder}) { |
|
$r->print('<label><input type="checkbox" name="'.$block.'_'.$parmcount.'" value="1" />'.$types->{$block}.'</label><br />'); |
|
} |
|
$r->print(<<"END"); |
|
</td> |
<td><label>$lt{'addb'}? <input type="checkbox" name="add_$parmcount" value="1" /></label></td> |
<td><label>$lt{'addb'}? <input type="checkbox" name="add_$parmcount" value="1" /></label></td> |
END |
END |
$r->print(&Apache::loncommon::end_data_table_row()); |
$r->print(&Apache::loncommon::end_data_table_row()); |
Line 1562 END
|
Line 1592 END
|
return; |
return; |
} |
} |
|
|
sub blockcheck { |
sub blocktype_text { |
my ($setters,$startblock,$endblock) = @_; |
my %types = &Apache::lonlocal::texthash( |
# Retrieve active student roles and active course coordinator/instructor roles |
'com' => 'Messaging', |
my %live_courses = |
'chat' => 'Chat', |
map { $_ => 1} &Apache::loncommon::findallcourses(); |
'boards' => 'Discussion', |
# FIXME should really probe for apriv, but ::allowed can only probe the |
'port' => 'Portfolio', |
# currently active role |
'groups' => 'Groups' |
my %staff_of = |
|
map { $_ => 1} &Apache::loncommon::findallcourses(['cc','in']); |
|
|
|
# Retrieve blocking times and identity of blocker for active courses |
|
# for students. |
|
return if (!%live_courses); |
|
|
|
foreach my $course (keys(%live_courses)) { |
|
my $cdom = $env{'course.'.$course.'.domain'}; |
|
my $cnum = $env{'course.'.$course.'.num'}; |
|
|
|
# if they are a staff member and are currently not playing student |
|
next if ( $staff_of{$course} |
|
&& ($env{'request.role'} !~ m{^st\./$cdom/$cnum})); |
|
|
|
$setters->{$course} = {}; |
|
$setters->{$course}{'staff'} = []; |
|
$setters->{$course}{'times'} = []; |
|
my %records = &Apache::lonnet::dump('comm_block',$cdom,$cnum); |
|
foreach my $record (keys(%records)) { |
|
my ($start,$end) = ($record =~ m/^(\d+)____(\d+)$/); |
|
if ($start <= time && $end >= time) { |
|
my ($staff_name,$staff_dom,$title) = |
|
&parse_block_record($records{$record}); |
|
push(@{$$setters{$course}{'staff'}}, [$staff_name,$staff_dom]); |
|
push(@{$$setters{$course}{'times'}}, [$start,$end]); |
|
if ( ($$startblock == 0) || ($$startblock > $1) ) { |
|
$$startblock = $1; |
|
} |
|
if ( ($$endblock == 0) || ($$endblock < $2) ) { |
|
$$endblock = $2; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
sub build_block_table { |
|
my ($r,$startblock,$endblock,$setters) = @_; |
|
my %lt = &Apache::lonlocal::texthash( |
|
'cacb' => 'Currently active communication blocks', |
|
'cour' => 'Course/Group', |
|
'dura' => 'Duration', |
|
'blse' => 'Block set by' |
|
); |
); |
$r->print(<<"END"); |
my $typeorder = ['com','chat','boards','port','groups']; |
<br /><br />$lt{'cacb'}:<br /><br /> |
return ($typeorder,\%types); |
END |
|
$r->print(&Apache::loncommon::start_data_table()); |
|
$r->print(<<"END"); |
|
<tr> |
|
<th>$lt{'cour'}</th> |
|
<th>$lt{'dura'}</th> |
|
<th>$lt{'blse'}</th> |
|
</tr> |
|
END |
|
foreach my $course (keys(%{$setters})) { |
|
my %courseinfo=&Apache::lonnet::coursedescription($course); |
|
for (my $i=0; $i<@{$$setters{$course}{staff}}; $i++) { |
|
my ($uname,$udom) = @{$$setters{$course}{staff}[$i]}; |
|
my $fullname = &Apache::loncommon::plainname($uname,$udom); |
|
my ($openblock,$closeblock) = @{$$setters{$course}{times}[$i]}; |
|
$openblock = &Apache::lonlocal::locallocaltime($openblock); |
|
$closeblock= &Apache::lonlocal::locallocaltime($closeblock); |
|
$r->print(&Apache::loncommon::start_data_table_row(). |
|
'<td>'.$courseinfo{'description'}.'</td>'. |
|
'<td>'.$openblock.' to '.$closeblock.'</td>'. |
|
'<td>'.$fullname.' ('.$uname.':'.$udom. |
|
')</td>'. |
|
&Apache::loncommon::end_data_table_row()); |
|
} |
|
} |
|
$r->print(&Apache::loncommon::end_data_table()); |
|
} |
} |
|
|
# ----------------------------------------------------------- Display a message |
# ----------------------------------------------------------- Display a message |
Line 1651 sub displaymessage {
|
Line 1611 sub displaymessage {
|
my $suffix=&Apache::lonmsg::foldersuffix($folder); |
my $suffix=&Apache::lonmsg::foldersuffix($folder); |
my %blocked = (); |
my %blocked = (); |
my %setters = (); |
my %setters = (); |
my $startblock = 0; |
|
my $endblock = 0; |
|
my $numblocked = 0; |
my $numblocked = 0; |
my $crstype = &Apache::loncommon::course_type(); |
my $crstype = &Apache::loncommon::course_type(); |
|
|
# info to generate "next" and "previous" buttons and check if message is blocked |
# info to generate "next" and "previous" buttons and check if message is blocked |
&blockcheck(\%setters,\$startblock,\$endblock); |
my ($startblock,$endblock) = &Apache::loncommon::blockcheck(\%setters,'com'); |
my @messages=&sortedmessages(\%blocked,$startblock,$endblock,\$numblocked,$folder); |
my @messages=&sortedmessages(\%blocked,$startblock,$endblock,\$numblocked,$folder); |
if ( $blocked{$msgid} eq 'ON' ) { |
if ( $blocked{$msgid} eq 'ON' ) { |
&printheader($r,'/adm/email',&mt('Display a Message')); |
&printheader($r,'/adm/email',&mt('Display a Message')); |
Line 1906 sub sendoffmail {
|
Line 1864 sub sendoffmail {
|
} |
} |
} elsif ($env{'form.sendmode'} eq 'upload') { |
} elsif ($env{'form.sendmode'} eq 'upload') { |
foreach my $line (split(/[\n\r\f]+/,$env{'form.upfile'})) { |
foreach my $line (split(/[\n\r\f]+/,$env{'form.upfile'})) { |
my ($rec,$txt)=split(/\s*\:\s*/,$line); |
my ($rec,$txt) = ($line =~ /^([^:]+:[^:]+):(.*)$/); |
if ($txt) { |
if ($txt) { |
$rec=~s/\@/\:/; |
$rec =~ s/^\s+//; |
|
$rec =~ s/\s+$//; |
$toaddr{$rec}.=$txt."\n"; |
$toaddr{$rec}.=$txt."\n"; |
} |
} |
} |
} |
Line 1919 sub sendoffmail {
|
Line 1878 sub sendoffmail {
|
} |
} |
if ($env{'form.additionalrec'}) { |
if ($env{'form.additionalrec'}) { |
foreach my $rec (split(/\,/,$env{'form.additionalrec'})) { |
foreach my $rec (split(/\,/,$env{'form.additionalrec'})) { |
my ($auname,$audom)=split(/\@/,$rec); |
my ($auname,$audom)=split(/:/,$rec); |
if (($auname ne "") && ($audom ne "")) { |
if (($auname ne "") && ($audom ne "")) { |
$toaddr{$auname.':'.$audom}=''; |
$toaddr{$auname.':'.$audom}=''; |
} |
} |
Line 2261 sub handler {
|
Line 2220 sub handler {
|
&storedcommentlisting($r); |
&storedcommentlisting($r); |
} else { |
} else { |
&printheader($r,'','Display All Messages'); |
&printheader($r,'','Display All Messages'); |
&Apache::loncommunicate::menu($r); |
&Apache::loncommunicate::menu($r); |
&disall($r,($folder?$folder:$dismode)); |
&disall($r,($folder?$folder:$dismode)); |
} |
} |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |