version 1.13, 2006/04/25 19:50:09
|
version 1.21, 2006/05/01 16:17:56
|
Line 261 sub movemsg {
|
Line 261 sub movemsg {
|
sub discourse { |
sub discourse { |
my $r=shift; |
my $r=shift; |
my $classlist = &Apache::loncoursedata::get_classlist(); |
my $classlist = &Apache::loncoursedata::get_classlist(); |
my $now=time; |
my ($classgroups,$studentgroups) = |
|
&Apache::loncoursedata::get_group_memberships($classlist); |
my %lt=&Apache::lonlocal::texthash('cfa' => 'Check All', |
my %lt=&Apache::lonlocal::texthash('cfa' => 'Check All', |
'cfs' => 'Check Section/Group', |
'cfs' => 'Check Section/Group', |
'cfn' => 'Uncheck All'); |
'cfn' => 'Uncheck All'); |
|
if (defined($env{'form.group'})) { |
|
$r->print('<input type="hidden" name="group" value="'. |
|
$env{'form.group'}.'" />'."\n"); |
|
} |
$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 284 sub discourse {
|
Line 289 sub discourse {
|
('send_to_&&&'+document.forms.compemail.chksec.value+'&&&')==0) { |
('send_to_&&&'+document.forms.compemail.chksec.value+'&&&')==0) { |
document.forms.compemail.elements[i].checked=true; |
document.forms.compemail.elements[i].checked=true; |
} |
} |
|
if |
|
(document.forms.compemail.elements[i].name.indexOf |
|
('group_&&&'+document.forms.compemail.chksec.value+'&&&_')==0) { |
|
var count = i - document.forms.compemail.elements[i].value; |
|
document.forms.compemail.elements[count].checked=true; |
|
} |
} |
} |
} |
} |
|
|
Line 298 sub discourse {
|
Line 309 sub discourse {
|
</script> |
</script> |
<input type="button" onClick="checkall()" value="$lt{'cfa'}" /> |
<input type="button" onClick="checkall()" value="$lt{'cfa'}" /> |
<input type="button" onClick="checksec()" value="$lt{'cfs'}" /> |
<input type="button" onClick="checksec()" value="$lt{'cfs'}" /> |
<input type="text" size="5" name="chksec" /> |
<input type="text" size="15" name="chksec" value="$env{'form.group'}" /> |
<input type="button" onClick="uncheckall()" value="$lt{'cfn'}" /> |
<input type="button" onClick="uncheckall()" value="$lt{'cfn'}" /> |
<p> |
<p> |
ENDDISHEADER |
ENDDISHEADER |
my %coursepersonnel=&Apache::lonnet::get_course_adv_roles(); |
my %coursepersonnel=&Apache::lonnet::get_course_adv_roles(); |
$r->print('<table>'); |
$r->print(&Apache::loncommon::start_data_table()); |
foreach my $role (sort keys %coursepersonnel) { |
if (keys(%coursepersonnel) > 0) { |
foreach (split(/\,/,$coursepersonnel{$role})) { |
$r->print('<h3>Non-students</h3>'); |
my ($puname,$pudom)=split(/\:/,$_); |
$r->print(&Apache::loncommon::start_data_table()); |
$r->print('<tr><td><label>'. |
$r->print('<tr><th>Name</th><th>Username:Domain</th><th>Role</th></tr>'); |
'<input type="checkbox" name="send_to_&&&&&&_'. |
foreach my $role (sort(keys(%coursepersonnel))) { |
$puname.':'.$pudom.'" /> '. |
foreach my $user (split(/\,/,$coursepersonnel{$role})) { |
&Apache::loncommon::plainname($puname,$pudom). |
my ($puname,$pudom)=split(/\:/,$user); |
'</label></td>'. |
$r->print(&Apache::loncommon::start_data_table_row()); |
'<td>('.$_.'),</td><td><i>'.$role.'</i></td></tr>'); |
$r->print('<td><label>'. |
} |
'<input type="checkbox" name="send_to_&&&&&&_'. |
} |
$puname.':'.$pudom.'" /> '. |
$r->print('</table><table>'); |
&Apache::loncommon::plainname($puname,$pudom). |
my $sort = sub { |
'</label></td>'. |
my $aname=lc($classlist->{$a}[&Apache::loncoursedata::CL_FULLNAME()]); |
'<td>('.$user.'),</td><td><i>'.$role.'</i></td>'); |
if (!$aname) { $aname=$a; } |
$r->print(&Apache::loncommon::end_data_table_row()); |
my $bname=lc($classlist->{$b}[&Apache::loncoursedata::CL_FULLNAME()]); |
} |
if (!$bname) { $bname=$b; } |
} |
return $aname cmp $bname; |
$r->print(&Apache::loncommon::end_data_table()); |
}; |
} |
foreach my $student (sort $sort (keys(%{$classlist}))) { |
if (keys(%{$classlist}) > 0) { |
my $info=$classlist->{$student}; |
$r->print('<h3>Students</h3>'); |
my ($sname,$sdom,$status,$fullname,$section) = |
$r->print(&Apache::loncommon::start_data_table()); |
(@{$info}[&Apache::loncoursedata::CL_SNAME(), |
$r->print('<tr><th>Name</th><th>Username:Domain</th><th>Section</th><th>Groups</th></tr>'); |
&Apache::loncoursedata::CL_SDOM(), |
my $sort = sub { |
&Apache::loncoursedata::CL_STATUS(), |
my $aname=lc($classlist->{$a}[&Apache::loncoursedata::CL_FULLNAME()]); |
&Apache::loncoursedata::CL_FULLNAME(), |
if (!$aname) { $aname=$a; } |
&Apache::loncoursedata::CL_SECTION()]); |
my $bname=lc($classlist->{$b}[&Apache::loncoursedata::CL_FULLNAME()]); |
next if ($status ne 'Active'); |
if (!$bname) { $bname=$b; } |
next if ($env{'request.course.sec'} && |
return $aname cmp $bname; |
$section ne $env{'request.course.sec'}); |
}; |
my $key = 'send_to_&&&'.$section.'&&&_'.$student; |
foreach my $student (sort $sort (keys(%{$classlist}))) { |
if (! defined($fullname) || $fullname eq '') { $fullname = $sname; } |
my $info=$classlist->{$student}; |
$r->print('<tr><td><label>'. |
my ($sname,$sdom,$status,$fullname,$section) = |
qq{<input type="checkbox" name="$key" />}.(' 'x2). |
(@{$info}[&Apache::loncoursedata::CL_SNAME(), |
$fullname.'</label></td><td>'.$sname.'@'.$sdom.'</td><td>'.$section. |
&Apache::loncoursedata::CL_SDOM(), |
'</td></tr>'); |
&Apache::loncoursedata::CL_STATUS(), |
|
&Apache::loncoursedata::CL_FULLNAME(), |
|
&Apache::loncoursedata::CL_SECTION()]); |
|
next if ($status ne 'Active'); |
|
next if ($env{'request.course.sec'} && |
|
$section ne $env{'request.course.sec'}); |
|
my @studentsgroups = |
|
&Apache::loncoursedata::get_students_groups($student,$status, |
|
$classgroups); |
|
my $grouplist = join(', ',@studentsgroups); |
|
my $key = 'send_to_&&&'.$section.'&&&_'.$student; |
|
if (! defined($fullname) || $fullname eq '') {$fullname = $sname;} |
|
my $checked = ''; |
|
my $groupcount = 0; |
|
my $groupitems; |
|
$r->print(&Apache::loncommon::start_data_table_row()); |
|
$r->print('<td><label>'); |
|
foreach my $group (@studentsgroups) { |
|
$groupcount ++; |
|
$groupitems .= ('<input type="hidden" name="group_&&&'. |
|
$group.'&&&_'.$student.'" value="'. |
|
$groupcount.'" />'); |
|
if (defined($env{'form.group'})) { |
|
if ($env{'form.group'} eq $group) { |
|
$checked = 'checked="checked"'; |
|
} |
|
} |
|
} |
|
$r->print(qq{<input type="checkbox" name="$key" $checked />}. |
|
(' 'x2).$fullname.'</label>'.$groupitems. |
|
'</td><td>'.$sname.':'.$sdom.'</td><td>'.$section. |
|
'</td><td>'.$grouplist.'</td>'); |
|
$r->print(&Apache::loncommon::end_data_table_row()); |
|
} |
|
$r->print(&Apache::loncommon::end_data_table()); |
} |
} |
$r->print('</table>'); |
|
} |
} |
|
|
# ==================================================== Display Critical Message |
# ==================================================== Display Critical Message |
Line 359 sub discrit {
|
Line 403 sub discrit {
|
$result.='<hr />'.&mt('From').': <b>'. |
$result.='<hr />'.&mt('From').': <b>'. |
&Apache::loncommon::aboutmewrapper( |
&Apache::loncommon::aboutmewrapper( |
&Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).'</b> ('. |
&Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).'</b> ('. |
$content{'sendername'}.'@'. |
$content{'sendername'}.':'. |
$content{'senderdomain'}.') '.$content{'time'}. |
$content{'senderdomain'}.') '.$content{'time'}. |
'<br />'.&mt('Subject').': '.$content{'subject'}. |
'<br />'.&mt('Subject').': '.$content{'subject'}. |
'<br /><pre>'. |
'<br /><pre>'. |
Line 612 sub disfolder {
|
Line 656 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 867 sub compout {
|
Line 911 sub compout {
|
$r->print('<tr><td colspan="2">'.&mt('Replying to').' '. |
$r->print('<tr><td colspan="2">'.&mt('Replying to').' '. |
&Apache::loncommon::aboutmewrapper( |
&Apache::loncommon::aboutmewrapper( |
&Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).' ('. |
&Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).' ('. |
$content{'sendername'}.'@'. |
$content{'sendername'}.':'. |
$content{'senderdomain'}.')'. |
$content{'senderdomain'}.')'. |
'<input type="hidden" name="recuname" value="'.$content{'sendername'}.'" />'. |
'<input type="hidden" name="recuname" value="'.$content{'sendername'}.'" />'. |
'<input type="hidden" name="recdomain" value="'.$content{'senderdomain'}.'" />'. |
'<input type="hidden" name="recdomain" value="'.$content{'senderdomain'}.'" />'. |
Line 960 sub retrieve_instructor_comments {
|
Line 1004 sub retrieve_instructor_comments {
|
next if ($content{'subject'} !~ /^Record/); |
next if ($content{'subject'} !~ /^Record/); |
# &Apache::lonfeedback::newline_to_br(\$content{'message'}); |
# &Apache::lonfeedback::newline_to_br(\$content{'message'}); |
$result.='Recorded by '. |
$result.='Recorded by '. |
$content{'sendername'}.'@'.$content{'senderdomain'}."\n"; |
$content{'sendername'}.':'.$content{'senderdomain'}."\n"; |
$result.= |
$result.= |
&Apache::lontexconvert::msgtexconverted($content{'message'})."\n"; |
&Apache::lontexconvert::msgtexconverted($content{'message'})."\n"; |
} |
} |
Line 1018 sub disfacetoface {
|
Line 1062 sub disfacetoface {
|
$result.=&mt('By').': <b>'. |
$result.=&mt('By').': <b>'. |
&Apache::loncommon::aboutmewrapper( |
&Apache::loncommon::aboutmewrapper( |
&Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).'</b> ('. |
&Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),$content{'sendername'},$content{'senderdomain'}).'</b> ('. |
$content{'sendername'}.'@'. |
$content{'sendername'}.':'. |
$content{'senderdomain'}.') '.$content{'time'}. |
$content{'senderdomain'}.') '.$content{'time'}. |
'<br /><pre>'. |
'<br /><pre>'. |
&Apache::lontexconvert::msgtexconverted($content{'message'}). |
&Apache::lontexconvert::msgtexconverted($content{'message'}). |
Line 1232 sub blockstore {
|
Line 1276 sub blockstore {
|
unless ( defined($cancels{$_}) ) { |
unless ( defined($cancels{$_}) ) { |
my ($newstart,$newend) = &get_dates_from_form($_); |
my ($newstart,$newend) = &get_dates_from_form($_); |
my $newkey = $newstart.'____'.$newend; |
my $newkey = $newstart.'____'.$newend; |
$blocking{$newkey} = $env{'user.name'}.'@'.$env{'user.domain'}.':'.$env{'form.title_'.$_}; |
$blocking{$newkey} = $env{'user.name'}.':'.$env{'user.domain'}.':'.$env{'form.title_'.$_}; |
} |
} |
} |
} |
if ($addtotal + $modtotal > 0) { |
if ($addtotal + $modtotal > 0) { |
Line 1275 sub get_blockdates {
|
Line 1319 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(&Apache::loncommon::start_data_table()); |
$r->print(<<"END"); |
$r->print(<<"END"); |
<table border="0" cellpadding="0" cellspacing="0"> |
<tr> |
<tr> |
<th>$$ltext{'dura'}</th> |
<td width="100%" bgcolor="#000000"> |
<th>$$ltext{'setb'}</th> |
<table width="100%" border="0" cellpadding="1" cellspacing="0"> |
<th>$$ltext{'even'}</th> |
<tr> |
<th>$$ltext{'actn'}?</th> |
<td width="100%" bgcolor="#000000"> |
</tr> |
<table border="0" cellpadding="3" cellspacing="3" bgcolor="#FFFFFF"> |
|
<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 my $record (sort(keys(%{$records}))) { |
my $iter = $parmcount%2; |
|
my $onchange = 'onFocus="javascript:window.document.forms['. |
my $onchange = 'onFocus="javascript:window.document.forms['. |
"'blockform'].elements['modify_".$parmcount."'].". |
"'blockform'].elements['modify_".$parmcount."'].". |
'checked=true;"'; |
'checked=true;"'; |
my ($start,$end) = split/____/,$_; |
my ($start,$end) = split(/____/,$record); |
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 ($setter,$title) = split/:/,$$records{$_}; |
|
my ($setuname,$setudom) = split/@/,$setter; |
my ($setuname,$setudom,$title) = |
|
&parse_block_record($$records{$record}); |
|
$title = &HTML::Entities::encode($title,'"<>&'); |
my $settername = &Apache::loncommon::plainname($setuname,$setudom); |
my $settername = &Apache::loncommon::plainname($setuname,$setudom); |
|
$r->print(&Apache::loncommon::start_data_table_row()); |
$r->print(<<"END"); |
$r->print(<<"END"); |
<tr bgcolor="$bgcols[$iter]"> |
|
<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="$record" /></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> |
</tr> |
|
END |
END |
$parmcount ++; |
$r->print(&Apache::loncommon::end_data_table_row()); |
|
$parmcount++; |
} |
} |
$r->print(<<"END"); |
$r->print(<<"END"); |
</table> |
|
</td> |
|
</tr> |
|
</table> |
|
</td> |
|
</tr> |
|
</table> |
</table> |
<br /> |
<br /> |
<br /> |
<br /> |
Line 1346 END
|
Line 1374 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 1355 sub display_addblocker_table {
|
Line 1396 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 1365 sub display_addblocker_table {
|
Line 1403 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"> |
|
<tr> |
|
<td width="100%" bgcolor="#000000"> |
|
<table width="100%" border="0" cellpadding="1" cellspacing="0"> |
|
<tr> |
|
<td width="100%" bgcolor="#000000"> |
|
<table border="0" cellpadding="3" cellspacing="3" bgcolor="#FFFFFF"> |
|
<tr bgcolor="#CCCCFF"> |
|
<td><b>$$ltext{'dura'}</b></td> |
|
<td><b>$$ltext{'even'} $lt{'exam'}</b></td> |
|
<td><b>$$ltext{'actn'}?</b></td> |
|
</tr> |
|
<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 |
|
$r->print(&Apache::loncommon::start_data_table()); |
|
$r->print(<<"END"); |
|
<tr> |
|
<th>$$ltext{'dura'}</th> |
|
<th>$$ltext{'even'} $lt{'exam'}</th> |
|
<th>$$ltext{'actn'}?</th> |
|
</tr> |
|
END |
|
$r->print(&Apache::loncommon::start_data_table_row()); |
|
$r->print(<<"END"); |
|
<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> |
|
END |
|
$r->print(&Apache::loncommon::end_data_table_row()); |
|
$r->print(&Apache::loncommon::end_data_table()); |
return; |
return; |
} |
} |
|
|
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') { |
foreach my $course (keys(%live_courses)) { |
push @livecses, $cse; |
my $cdom = $env{'course.'.$course.'.domain'}; |
} else { |
my $cnum = $env{'course.'.$course.'.num'}; |
unless (grep/^$cse$/,@staffcses) { |
|
push @staffcses, $cse; |
# 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} = {}; |
} elsif ($_ =~ m-user\.role\.cr/(\w+)/(\w+)/([^/]+)\./(.+)$- ) { |
$setters->{$course}{'staff'} = []; |
my $rolepriv = $env{'user.role..rolesdef_'.$3}; |
$setters->{$course}{'times'} = []; |
} |
my %records = &Apache::lonnet::dump('comm_block',$cdom,$cnum); |
} |
foreach my $record (keys %records) { |
# Retrieve blocking times and identity of blocker for active courses for students. |
my ($start,$end) = ($record =~ m/^(\d+)____(\d+)$/); |
if (@livecses > 0) { |
if ($start <= time && $end >= time) { |
foreach my $cse (@livecses) { |
my ($staff_name,$staff_dom,$title) = |
my ($cdom,$crs) = split/_/,$cse; |
&parse_block_record($records{$record}); |
if ( (grep/^$cse$/,@staffcses) && ($env{'request.role'} !~ m-^st\./$cdom/$crs$-) ) { |
push(@{$$setters{$course}{'staff'}}, [$staff_name,$staff_dom]); |
next; |
push(@{$$setters{$course}{'times'}}, [$start,$end]); |
} else { |
if ( ($$startblock == 0) || ($$startblock > $1) ) { |
%{$$setters{$cse}} = (); |
$$startblock = $1; |
@{$$setters{$cse}{'staff'}} = (); |
} |
@{$$setters{$cse}{'times'}} = (); |
if ( ($$endblock == 0) || ($$endblock < $2) ) { |
my %records = &Apache::lonnet::dump('comm_block',$cdom,$crs); |
$$endblock = $2; |
foreach (keys %records) { |
} |
if ($_ =~ m/^(\d+)____(\d+)$/) { |
} |
if ($1 <= time && $2 >= time) { |
} |
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', |
'dura' => 'Duration', |
'dura' => 'Duration', |
'blse' => 'Block set by' |
'blse' => 'Block set by' |
); |
); |
$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"> |
END |
<tr> |
$r->print(&Apache::loncommon::start_data_table()); |
<td width="100%" bgcolor="#000000"> |
$r->print(<<"END"); |
<table width="100%" border="0" cellpadding="1" cellspacing="0"> |
<tr> |
<tr> |
<th>$lt{'cour'}</th> |
<td width="100%" bgcolor="#000000"> |
<th>$lt{'dura'}</th> |
<table border="0" cellpadding="3" cellspacing="3" bgcolor="#FFFFFF"> |
<th>$lt{'blse'}</th> |
<tr bgcolor="$color"> |
</tr> |
<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 my $course (keys(%{$setters})) { |
my %courseinfo=&Apache::lonnet::coursedescription($_); |
my %courseinfo=&Apache::lonnet::coursedescription($course); |
for (my $i=0; $i<@{$$setters{$_}{staff}}; $i++) { |
for (my $i=0; $i<@{$$setters{$course}{staff}}; $i++) { |
my ($uname,$udom) = split/\@/,$$setters{$_}{staff}[$i]; |
my ($uname,$udom) = @{$$setters{$course}{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{$course}{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(&Apache::loncommon::start_data_table_row(). |
|
'<td>'.$courseinfo{'description'}.'</td>'. |
'<td>'.$openblock.' to '.$closeblock.'</td>'. |
'<td>'.$openblock.' to '.$closeblock.'</td>'. |
'<td>'.$fullname.' ('.$uname.'@'.$udom. |
'<td>'.$fullname.' ('.$uname.':'.$udom. |
')</td></tr>'); |
')</td>'. |
|
&Apache::loncommon::end_data_table_row()); |
} |
} |
} |
} |
$r->print('</table></td></tr></table></td></tr></table>'); |
$r->print(&Apache::loncommon::end_data_table()); |
} |
} |
|
|
# ----------------------------------------------------------- Display a message |
# ----------------------------------------------------------- Display a message |
Line 1722 sub sendoffmail {
|
Line 1733 sub sendoffmail {
|
|
|
my %toaddr; |
my %toaddr; |
if ($env{'form.sendmode'} eq 'group') { |
if ($env{'form.sendmode'} eq 'group') { |
foreach $address (keys(%env)) { |
foreach my $address (keys(%env)) { |
if ($address=~/^form\.send\_to\_\&\&\&[^\&]*\&\&\&\_(.+)$/) { |
if ($address=~/^form\.send\_to\_\&\&\&[^\&]*\&\&\&\_(.+)$/) { |
$toaddr{$1}=''; |
$toaddr{$1}=''; |
} |
} |
Line 1778 sub sendoffmail {
|
Line 1789 sub sendoffmail {
|
$env{'form.permanent'}, |
$env{'form.permanent'}, |
\$sentmessage{$address}); |
\$sentmessage{$address}); |
} else { |
} else { |
$r->print(&mt('Sending').' '.$recuname.'@'.$recdomain.': '); |
$r->print(&mt('Sending').' '.$recuname.':'.$recdomain.': '); |
@thismsg= |
@thismsg= |
&Apache::lonmsg::user_normal_msg($recuname,$recdomain, |
&Apache::lonmsg::user_normal_msg($recuname,$recdomain, |
$msgsubj,$msgtxt, |
$msgsubj,$msgtxt, |
Line 1891 sub handler {
|
Line 1902 sub handler {
|
['display','replyto','forward','markread','markdel','markunread', |
['display','replyto','forward','markread','markdel','markunread', |
'sendreply','compose','sendmail','critical','recname','recdom', |
'sendreply','compose','sendmail','critical','recname','recdom', |
'recordftf','sortedby','block','folder','startdis','interdis', |
'recordftf','sortedby','block','folder','startdis','interdis', |
'showcommentbaseurl','dismode']); |
'showcommentbaseurl','dismode','group']); |
$sqs='&sortedby='.$env{'form.sortedby'}; |
$sqs='&sortedby='.$env{'form.sortedby'}; |
|
|
# ------------------------------------------------------ They checked for email |
# ------------------------------------------------------ They checked for email |