version 1.14, 2006/04/25 20:02:30
|
version 1.17, 2006/04/25 23:13:25
|
Line 267 sub discourse {
|
Line 267 sub discourse {
|
'cfn' => 'Uncheck All'); |
'cfn' => 'Uncheck All'); |
$r->print(<<ENDDISHEADER); |
$r->print(<<ENDDISHEADER); |
<input type="hidden" name="sendmode" value="group" /> |
<input type="hidden" name="sendmode" value="group" /> |
<script> |
<script pe="text/javascript"> |
function checkall() { |
function checkall() { |
for (i=0; i<document.forms.compemail.elements.length; i++) { |
for (i=0; i<document.forms.compemail.elements.length; i++) { |
if |
if |
Line 612 sub disfolder {
|
Line 612 sub disfolder {
|
my $numblocked = 0; |
my $numblocked = 0; |
&blockcheck(\%setters,\$startblock,\$endblock); |
&blockcheck(\%setters,\$startblock,\$endblock); |
$r->print(<<ENDDISHEADER); |
$r->print(<<ENDDISHEADER); |
<script> |
<script type="text/javascript"> |
function checkall() { |
function checkall() { |
for (i=0; i<document.forms.disall.elements.length; i++) { |
for (i=0; i<document.forms.disall.elements.length; i++) { |
if |
if |
Line 1275 sub get_blockdates {
|
Line 1275 sub get_blockdates {
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.num'} |
$env{'course.'.$env{'request.course.id'}.'.num'} |
); |
); |
$$blockcount = keys %{$records}; |
$$blockcount = keys(%{$records}); |
|
|
foreach (keys %{$records}) { |
if ((keys(%{$records}))[0] =~ /^error: 2 /) { |
if ($_ eq 'error: 2 tie(GDBM) Failed while attempting dump') { |
$records = {}; |
$$blockcount = 0; |
$$blockcount = 0; |
last; |
|
} |
|
} |
} |
} |
} |
|
|
sub display_blocker_status { |
sub display_blocker_status { |
my ($r,$records,$ltext) = @_; |
my ($r,$records,$ltext) = @_; |
my $parmcount = 0; |
my $parmcount = 0; |
my @bgcols = ("#eeeeee","#dddddd"); |
|
my $function = &Apache::loncommon::get_users_function(); |
|
my $color = &Apache::loncommon::designparm($function.'.tabbg', |
|
$env{'user.domain'}); |
|
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
'modi' => 'Modify', |
'modi' => 'Modify', |
'canc' => 'Cancel', |
'canc' => 'Cancel', |
); |
); |
$r->print(<<"END"); |
$r->print(<<"END"); |
<table border="0" cellpadding="0" cellspacing="0"> |
<table class="LC_data_table"> |
<tr> |
<tr> |
<td width="100%" bgcolor="#000000"> |
<th>$$ltext{'dura'}</th> |
<table width="100%" border="0" cellpadding="1" cellspacing="0"> |
<th>$$ltext{'setb'}</th> |
<tr> |
<th>$$ltext{'even'}</th> |
<td width="100%" bgcolor="#000000"> |
<th>$$ltext{'actn'}?</th> |
<table border="0" cellpadding="3" cellspacing="3" bgcolor="#FFFFFF"> |
</tr> |
<tr bgcolor="$color"> |
|
<td><b>$$ltext{'dura'}</b></td> |
|
<td><b>$$ltext{'setb'}</b></td> |
|
<td><b>$$ltext{'even'}</b></td> |
|
<td><b>$$ltext{'actn'}?</b></td> |
|
</tr> |
|
END |
END |
foreach (sort keys %{$records}) { |
foreach (sort keys %{$records}) { |
my $iter = $parmcount%2; |
my $iter = $parmcount%2; |
Line 1319 END
|
Line 1308 END
|
my ($start,$end) = split/____/,$_; |
my ($start,$end) = split/____/,$_; |
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 (@data,$setuname,$setudom,$title); |
|
@data = split(/:/,$$records{$_},3); |
my ($setuname,$setudom,$title) = &parse_block_record($$records{$_}); |
if (scalar(@data) eq 2) { |
|
$title = $data[1]; |
|
($setuname,$setudom) = split(/@/,$data[0]); |
|
} else { |
|
($setuname,$setudom,$title) = @data; |
|
} |
|
my $settername = &Apache::loncommon::plainname($setuname,$setudom); |
my $settername = &Apache::loncommon::plainname($setuname,$setudom); |
$r->print(<<"END"); |
$r->print(<<"END"); |
<tr bgcolor="$bgcols[$iter]"> |
<tr> |
<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="$_" /></td> |
<td><input type="text" name="title_$parmcount" size="15" value="$title" /><input type="hidden" name="key_$parmcount" value="$_" /></td> |
Line 1339 END
|
Line 1322 END
|
$parmcount ++; |
$parmcount ++; |
} |
} |
$r->print(<<"END"); |
$r->print(<<"END"); |
</table> |
|
</td> |
|
</tr> |
|
</table> |
|
</td> |
|
</tr> |
|
</table> |
</table> |
<br /> |
<br /> |
<br /> |
<br /> |
Line 1352 END
|
Line 1329 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 1361 sub display_addblocker_table {
|
Line 1351 sub display_addblocker_table {
|
'checked=true;"'; |
'checked=true;"'; |
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 $function = &Apache::loncommon::get_users_function(); |
|
my $color = &Apache::loncommon::designparm($function.'.tabbg', |
|
$env{'user.domain'}); |
|
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
'addb' => 'Add block', |
'addb' => 'Add block', |
'exam' => 'e.g., Exam 1', |
'exam' => 'e.g., Exam 1', |
Line 1371 sub display_addblocker_table {
|
Line 1358 sub display_addblocker_table {
|
); |
); |
$r->print(<<"END"); |
$r->print(<<"END"); |
<h4>$lt{'addn'}</h4> |
<h4>$lt{'addn'}</h4> |
<table border="0" cellpadding="0" cellspacing="0"> |
<table class="LC_data_table"> |
<tr> |
<tr> |
<td width="100%" bgcolor="#000000"> |
<th>$$ltext{'dura'}</th> |
<table width="100%" border="0" cellpadding="1" cellspacing="0"> |
<th>$$ltext{'even'} $lt{'exam'}</th> |
<tr> |
<th>$$ltext{'actn'}?</th> |
<td width="100%" bgcolor="#000000"> |
</tr> |
<table border="0" cellpadding="3" cellspacing="3" bgcolor="#FFFFFF"> |
<tr> |
<tr bgcolor="#CCCCFF"> |
<td>$$ltext{'star'}: $startform<br />$$ltext{'endd'}: $endform</td> |
<td><b>$$ltext{'dura'}</b></td> |
<td><input type="text" name="title_$parmcount" size="15" value="" /></td> |
<td><b>$$ltext{'even'} $lt{'exam'}</b></td> |
<td><label>$lt{'addb'}? <input type="checkbox" name="add_$parmcount" value="1" /></label></td> |
<td><b>$$ltext{'actn'}?</b></td> |
</tr> |
</tr> |
</table> |
<tr bgcolor="#eeeeee"> |
|
<td>$$ltext{'star'}: $startform<br />$$ltext{'endd'}: $endform</td> |
|
<td><input type="text" name="title_$parmcount" size="15" value="" /></td> |
|
<td><label>$lt{'addb'}? <input type="checkbox" name="add_$parmcount" value="1" /></label></td> |
|
</tr> |
|
</table> |
|
</td> |
|
</tr> |
|
</table> |
|
</td> |
|
</tr> |
|
</table> |
|
END |
END |
return; |
return; |
} |
} |
Line 1402 END
|
Line 1377 END
|
sub blockcheck { |
sub blockcheck { |
my ($setters,$startblock,$endblock) = @_; |
my ($setters,$startblock,$endblock) = @_; |
# Retrieve active student roles and active course coordinator/instructor roles |
# Retrieve active student roles and active course coordinator/instructor roles |
my @livecses = (); |
my %live_courses = |
my @staffcses = (); |
map { $_ => 1} &Apache::loncommon::findallcourses(); |
$$startblock = 0; |
# FIXME should really probe for apriv, but ::allowed can only probe the |
$$endblock = 0; |
# currently active role |
foreach (keys %env) { |
my %staff_of = |
if ($_ =~ m-^user\.role\.(st|cc|in)\./(.+)$-) { |
map { $_ => 1} &Apache::loncommon::findallcourses(['cc','in']); |
my $role = $1; |
|
my $cse = $2; |
# Retrieve blocking times and identity of blocker for active courses |
$cse =~ s|/|_|; |
# for students. |
if ($env{$_} =~ m/^(\d*)\.(\d*)$/) { |
return if (!%live_courses); |
unless (($2 > 0 && $2 < time) || ($1 > time)) { |
|
if ($role eq 'st') { |
&Apache::lonnet::logthis("hmm"); |
push @livecses, $cse; |
&Apache::lonnet::logthis(join(" ",%live_courses)); |
} else { |
&Apache::lonnet::logthis(join(" ",%staff_of)); |
unless (grep/^$cse$/,@staffcses) { |
|
push @staffcses, $cse; |
foreach my $course (keys(%live_courses)) { |
} |
my ($cdom,$cnum) = split(/_/,$course); |
} |
|
} |
# if they are a staff member and are currently not playing student |
} |
next if ( $staff_of{$course} |
} elsif ($_ =~ m-user\.role\.cr/(\w+)/(\w+)/([^/]+)\./(.+)$- ) { |
&& ($env{'request.role'} !~ m{^st\./$cdom/$cnum})); |
my $rolepriv = $env{'user.role..rolesdef_'.$3}; |
|
} |
$setters->{$course} = {}; |
} |
$setters->{$course}{'staff'} = []; |
# Retrieve blocking times and identity of blocker for active courses for students. |
$setters->{$course}{'times'} = []; |
if (@livecses > 0) { |
my %records = &Apache::lonnet::dump('comm_block',$cdom,$cnum); |
foreach my $cse (@livecses) { |
foreach my $record (keys %records) { |
my ($cdom,$crs) = split/_/,$cse; |
my ($start,$end) = ($record =~ m/^(\d+)____(\d+)$/); |
if ( (grep/^$cse$/,@staffcses) && ($env{'request.role'} !~ m-^st\./$cdom/$crs$-) ) { |
if ($start <= time && $end >= time) { |
next; |
my ($staff_name,$staff_dom,$title) = |
} else { |
&parse_block_record($records{$record}); |
%{$$setters{$cse}} = (); |
push(@{$$setters{$course}{'staff'}}, [$staff_name,$staff_dom]); |
@{$$setters{$cse}{'staff'}} = (); |
push(@{$$setters{$course}{'times'}}, [$start,$end]); |
@{$$setters{$cse}{'times'}} = (); |
if ( ($$startblock == 0) || ($$startblock > $1) ) { |
my %records = &Apache::lonnet::dump('comm_block',$cdom,$crs); |
$$startblock = $1; |
foreach (keys %records) { |
} |
if ($_ =~ m/^(\d+)____(\d+)$/) { |
if ( ($$endblock == 0) || ($$endblock < $2) ) { |
if ($1 <= time && $2 >= time) { |
$$endblock = $2; |
my ($staff,$title) = split/:/,$records{$_}; |
} |
push @{$$setters{$cse}{'staff'}}, $staff; |
} |
push @{$$setters{$cse}{'times'}}, $_; |
} |
if ( ($$startblock == 0) || ($$startblock > $1) ) { |
|
$$startblock = $1; |
|
} |
|
if ( ($$endblock == 0) || ($$endblock < $2) ) { |
|
$$endblock = $2; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
} |
} |
} |
|
|
sub build_block_table { |
sub build_block_table { |
my ($r,$startblock,$endblock,$setters) = @_; |
my ($r,$startblock,$endblock,$setters) = @_; |
my $function = &Apache::loncommon::get_users_function(); |
|
my $color = &Apache::loncommon::designparm($function.'.tabbg', |
|
$env{'user.domain'}); |
|
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
'cacb' => 'Currently active communication blocks', |
'cacb' => 'Currently active communication blocks', |
'cour' => 'Course', |
'cour' => 'Course', |
Line 1470 sub build_block_table {
|
Line 1431 sub build_block_table {
|
); |
); |
$r->print(<<"END"); |
$r->print(<<"END"); |
<br /<br />$lt{'cacb'}:<br /><br /> |
<br /<br />$lt{'cacb'}:<br /><br /> |
<table border="0" cellpadding="0" cellspacing="0"> |
<table class="LC_data_table"> |
<tr> |
<tr> |
<td width="100%" bgcolor="#000000"> |
<th>$lt{'cour'}</th> |
<table width="100%" border="0" cellpadding="1" cellspacing="0"> |
<th>$lt{'dura'}</th> |
<tr> |
<th>$lt{'blse'}</th> |
<td width="100%" bgcolor="#000000"> |
</tr> |
<table border="0" cellpadding="3" cellspacing="3" bgcolor="#FFFFFF"> |
|
<tr bgcolor="$color"> |
|
<td><b>$lt{'cour'}</b></td> |
|
<td><b>$lt{'dura'}</b></td> |
|
<td><b>$lt{'blse'}</b></td> |
|
</tr> |
|
END |
END |
foreach (keys %{$setters}) { |
foreach (keys %{$setters}) { |
my %courseinfo=&Apache::lonnet::coursedescription($_); |
my %courseinfo=&Apache::lonnet::coursedescription($_); |
for (my $i=0; $i<@{$$setters{$_}{staff}}; $i++) { |
for (my $i=0; $i<@{$$setters{$_}{staff}}; $i++) { |
my ($uname,$udom) = split/\@/,$$setters{$_}{staff}[$i]; |
my ($uname,$udom) = @{$$setters{$_}{staff}[$i]}; |
my $fullname = &Apache::loncommon::plainname($uname,$udom); |
my $fullname = &Apache::loncommon::plainname($uname,$udom); |
my ($openblock,$closeblock) = split/____/,$$setters{$_}{times}[$i]; |
my ($openblock,$closeblock) = @{$$setters{$_}{times}[$i]}; |
$openblock = &Apache::lonlocal::locallocaltime($openblock); |
$openblock = &Apache::lonlocal::locallocaltime($openblock); |
$closeblock= &Apache::lonlocal::locallocaltime($closeblock); |
$closeblock= &Apache::lonlocal::locallocaltime($closeblock); |
$r->print('<tr><td>'.$courseinfo{'description'}.'</td>'. |
$r->print('<tr><td>'.$courseinfo{'description'}.'</td>'. |
Line 1497 END
|
Line 1452 END
|
')</td></tr>'); |
')</td></tr>'); |
} |
} |
} |
} |
$r->print('</table></td></tr></table></td></tr></table>'); |
$r->print('</table>'); |
} |
} |
|
|
# ----------------------------------------------------------- Display a message |
# ----------------------------------------------------------- Display a message |