version 1.17, 2006/04/25 23:13:25
|
version 1.28, 2006/05/23 21:42:09
|
Line 125 use Apache::lonlocal;
|
Line 125 use Apache::lonlocal;
|
use Apache::loncommunicate; |
use Apache::loncommunicate; |
use Apache::lonfeedback; |
use Apache::lonfeedback; |
use Apache::lonrss(); |
use Apache::lonrss(); |
|
use Apache::lonselstudent(); |
|
|
# Querystring component with sorting type |
# Querystring component with sorting type |
my $sqs; |
my $sqs; |
Line 259 sub movemsg {
|
Line 260 sub movemsg {
|
# ======================================================= Display a course list |
# ======================================================= Display a course list |
|
|
sub discourse { |
sub discourse { |
my $r=shift; |
my $result; |
my $classlist = &Apache::loncoursedata::get_classlist(); |
my ($course_personnel, |
my $now=time; |
$current_members, |
my %lt=&Apache::lonlocal::texthash('cfa' => 'Check All', |
$expired_members, |
'cfs' => 'Check Section/Group', |
$future_members) = |
'cfn' => 'Uncheck All'); |
&Apache::lonselstudent::get_people_in_class($env{'request.course.sec'}); |
$r->print(<<ENDDISHEADER); |
unshift @$current_members, (@$course_personnel); |
<input type="hidden" name="sendmode" value="group" /> |
my %defaultUsers; |
<script pe="text/javascript"> |
|
function checkall() { |
$result = &Apache::lonselstudent::render_student_list($current_members, |
for (i=0; i<document.forms.compemail.elements.length; i++) { |
"compemail", |
if |
"current", |
(document.forms.compemail.elements[i].name.indexOf('send_to_')==0) { |
\%defaultUsers, |
document.forms.compemail.elements[i].checked=true; |
1,"selectedusers",1); |
} |
|
} |
$result .= &Apache::lonselstudent::render_student_list($expired_members, |
} |
"compemail", |
|
"expired", |
function checksec() { |
\%defaultUsers, |
for (i=0; i<document.forms.compemail.elements.length; i++) { |
1, "selectedusers",0); |
if |
$result .= &Apache::lonselstudent::render_student_list($future_members, |
(document.forms.compemail.elements[i].name.indexOf |
"compemail", |
('send_to_&&&'+document.forms.compemail.chksec.value+'&&&')==0) { |
"future", |
document.forms.compemail.elements[i].checked=true; |
\%defaultUsers, |
} |
1, "selectedusers", 0); |
} |
return $result; |
} |
|
|
|
function uncheckall() { |
|
for (i=0; i<document.forms.compemail.elements.length; i++) { |
|
if |
|
(document.forms.compemail.elements[i].name.indexOf('send_to_')==0) { |
|
document.forms.compemail.elements[i].checked=false; |
|
} |
|
} |
|
} |
|
</script> |
|
<input type="button" onClick="checkall()" value="$lt{'cfa'}" /> |
|
<input type="button" onClick="checksec()" value="$lt{'cfs'}" /> |
|
<input type="text" size="5" name="chksec" /> |
|
<input type="button" onClick="uncheckall()" value="$lt{'cfn'}" /> |
|
<p> |
|
ENDDISHEADER |
|
my %coursepersonnel=&Apache::lonnet::get_course_adv_roles(); |
|
$r->print('<table>'); |
|
foreach my $role (sort keys %coursepersonnel) { |
|
foreach (split(/\,/,$coursepersonnel{$role})) { |
|
my ($puname,$pudom)=split(/\:/,$_); |
|
$r->print('<tr><td><label>'. |
|
'<input type="checkbox" name="send_to_&&&&&&_'. |
|
$puname.':'.$pudom.'" /> '. |
|
&Apache::loncommon::plainname($puname,$pudom). |
|
'</label></td>'. |
|
'<td>('.$_.'),</td><td><i>'.$role.'</i></td></tr>'); |
|
} |
|
} |
|
$r->print('</table><table>'); |
|
my $sort = sub { |
|
my $aname=lc($classlist->{$a}[&Apache::loncoursedata::CL_FULLNAME()]); |
|
if (!$aname) { $aname=$a; } |
|
my $bname=lc($classlist->{$b}[&Apache::loncoursedata::CL_FULLNAME()]); |
|
if (!$bname) { $bname=$b; } |
|
return $aname cmp $bname; |
|
}; |
|
foreach my $student (sort $sort (keys(%{$classlist}))) { |
|
my $info=$classlist->{$student}; |
|
my ($sname,$sdom,$status,$fullname,$section) = |
|
(@{$info}[&Apache::loncoursedata::CL_SNAME(), |
|
&Apache::loncoursedata::CL_SDOM(), |
|
&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 $key = 'send_to_&&&'.$section.'&&&_'.$student; |
|
if (! defined($fullname) || $fullname eq '') { $fullname = $sname; } |
|
$r->print('<tr><td><label>'. |
|
qq{<input type="checkbox" name="$key" />}.(' 'x2). |
|
$fullname.'</label></td><td>'.$sname.':'.$sdom.'</td><td>'.$section. |
|
'</td></tr>'); |
|
} |
|
$r->print('</table>'); |
|
} |
} |
|
|
# ==================================================== Display Critical Message |
# ==================================================== Display Critical Message |
Line 857 sub compout {
|
Line 801 sub compout {
|
} |
} |
my $citation=&displayresource(%content); |
my $citation=&displayresource(%content); |
if ($env{'form.recdom'}) { $defdom=$env{'form.recdom'}; } |
if ($env{'form.recdom'}) { $defdom=$env{'form.recdom'}; } |
$r->print( |
if ($env{'form.text'}) { $dismsg=$env{'form.text'}; } |
|
if ($env{'form.subject'}) { $dissub=$env{'form.subject'}; } |
|
$r->print( |
'<form action="/adm/email" name="compemail" method="post"'. |
'<form action="/adm/email" name="compemail" method="post"'. |
' enctype="multipart/form-data">'."\n". |
' enctype="multipart/form-data">'."\n". |
'<input type="hidden" name="sendmail" value="on" />'."\n". |
'<input type="hidden" name="sendmail" value="on" />'."\n". |
Line 932 ENDUPLOAD
|
Line 878 ENDUPLOAD
|
} |
} |
if ($broadcast eq 'group') { |
if ($broadcast eq 'group') { |
&discourse($r); |
&discourse($r); |
|
my $studentsel = &discourse(); |
|
$r->print($studentsel); |
} |
} |
$r->print('</form>'. |
$r->print('</form>'. |
&Apache::lonfeedback::generate_preview_button('compemail','message'). |
&Apache::lonfeedback::generate_preview_button('compemail','message'). |
Line 1291 sub display_blocker_status {
|
Line 1239 sub display_blocker_status {
|
'modi' => 'Modify', |
'modi' => 'Modify', |
'canc' => 'Cancel', |
'canc' => 'Cancel', |
); |
); |
|
$r->print(&Apache::loncommon::start_data_table()); |
$r->print(<<"END"); |
$r->print(<<"END"); |
<table class="LC_data_table"> |
|
<tr> |
<tr> |
<th>$$ltext{'dura'}</th> |
<th>$$ltext{'dura'}</th> |
<th>$$ltext{'setb'}</th> |
<th>$$ltext{'setb'}</th> |
Line 1300 sub display_blocker_status {
|
Line 1248 sub display_blocker_status {
|
<th>$$ltext{'actn'}?</th> |
<th>$$ltext{'actn'}?</th> |
</tr> |
</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 ($setuname,$setudom,$title) = &parse_block_record($$records{$_}); |
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> |
|
<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> |
</table> |
Line 1358 sub display_addblocker_table {
|
Line 1307 sub display_addblocker_table {
|
); |
); |
$r->print(<<"END"); |
$r->print(<<"END"); |
<h4>$lt{'addn'}</h4> |
<h4>$lt{'addn'}</h4> |
<table class="LC_data_table"> |
END |
|
$r->print(&Apache::loncommon::start_data_table()); |
|
$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{'actn'}?</th> |
</tr> |
</tr> |
<tr> |
END |
|
$r->print(&Apache::loncommon::start_data_table_row()); |
|
$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><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> |
</tr> |
|
</table> |
|
END |
END |
|
$r->print(&Apache::loncommon::end_data_table_row()); |
|
$r->print(&Apache::loncommon::end_data_table()); |
return; |
return; |
} |
} |
|
|
Line 1388 sub blockcheck {
|
Line 1341 sub blockcheck {
|
# for students. |
# for students. |
return if (!%live_courses); |
return if (!%live_courses); |
|
|
&Apache::lonnet::logthis("hmm"); |
|
&Apache::lonnet::logthis(join(" ",%live_courses)); |
|
&Apache::lonnet::logthis(join(" ",%staff_of)); |
|
|
|
foreach my $course (keys(%live_courses)) { |
foreach my $course (keys(%live_courses)) { |
my ($cdom,$cnum) = split(/_/,$course); |
my $cdom = $env{'course.'.$course.'.domain'}; |
|
my $cnum = $env{'course.'.$course.'.num'}; |
|
|
# if they are a staff member and are currently not playing student |
# if they are a staff member and are currently not playing student |
next if ( $staff_of{$course} |
next if ( $staff_of{$course} |
Line 1428 sub build_block_table {
|
Line 1378 sub build_block_table {
|
'cour' => 'Course', |
'cour' => 'Course', |
'dura' => 'Duration', |
'dura' => 'Duration', |
'blse' => 'Block set by' |
'blse' => 'Block set by' |
); |
); |
|
$r->print(<<"END"); |
|
<br /><br />$lt{'cacb'}:<br /><br /> |
|
END |
|
$r->print(&Apache::loncommon::start_data_table()); |
$r->print(<<"END"); |
$r->print(<<"END"); |
<br /<br />$lt{'cacb'}:<br /><br /> |
|
<table class="LC_data_table"> |
|
<tr> |
<tr> |
<th>$lt{'cour'}</th> |
<th>$lt{'cour'}</th> |
<th>$lt{'dura'}</th> |
<th>$lt{'dura'}</th> |
<th>$lt{'blse'}</th> |
<th>$lt{'blse'}</th> |
</tr> |
</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) = @{$$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) = @{$$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>'); |
$r->print(&Apache::loncommon::end_data_table()); |
} |
} |
|
|
# ----------------------------------------------------------- Display a message |
# ----------------------------------------------------------- Display a message |
Line 1604 sub header {
|
Line 1558 sub header {
|
$r->print(&Apache::loncommon::start_page('Communication and Messages', |
$r->print(&Apache::loncommon::start_page('Communication and Messages', |
$extra)); |
$extra)); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs |
$r->print(&Apache::lonhtmlcommon::breadcrumbs |
(undef,($title?$title:'Communication and Messages'))); |
(($title?$title:'Communication and Messages'))); |
|
|
} |
} |
|
|
Line 1681 sub sendoffmail {
|
Line 1635 sub sendoffmail {
|
&statuschange($msgid,'replied',$folder); |
&statuschange($msgid,'replied',$folder); |
} |
} |
|
|
|
my $to = $env{'form.selectedusers.forminput'}; |
|
my $mode = $env{'form.sendmode'}; |
|
|
my %toaddr; |
my %toaddr; |
if ($env{'form.sendmode'} eq 'group') { |
if ($to) { |
foreach my $address (keys(%env)) { |
foreach my $dest (@$to) { |
if ($address=~/^form\.send\_to\_\&\&\&[^\&]*\&\&\&\_(.+)$/) { |
my ($user,$domain) = split(/:/, $dest); |
$toaddr{$1}=''; |
if (($user ne '') && ($domain ne '')) { |
|
my $address = $user.":".$domain; # How the code below expects it. |
|
$toaddr{$address} = ''; |
} |
} |
} |
} |
|
} |
|
|
|
if ($env{'form.sendmode'} eq 'group') { |
|
foreach my $address (keys(%env)) { |
|
if ($address=~/^form\.send\_to\_\&\&\&[^\&]*\&\&\&\_(.+)$/) { |
|
$toaddr{$1}=''; |
|
} |
|
} |
} 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)=split(/\s*\:\s*/,$line); |
Line 1697 sub sendoffmail {
|
Line 1664 sub sendoffmail {
|
} |
} |
} |
} |
} else { |
} else { |
$toaddr{$env{'form.recuname'}.':'.$env{'form.recdomain'}}=''; |
if (($env{'form.recuname'} ne '') && ($env{'form.recdomain'} ne '')) { |
|
$toaddr{$env{'form.recuname'}.':'.$env{'form.recdomain'}}=''; |
|
} |
} |
} |
if ($env{'form.additionalrec'}) { |
if ($env{'form.additionalrec'}) { |
foreach (split(/\,/,$env{'form.additionalrec'})) { |
foreach (split(/\,/,$env{'form.additionalrec'})) { |
my ($auname,$audom)=split(/\@/,$_); |
my ($auname,$audom)=split(/\@/,$_); |
$toaddr{$auname.':'.$audom}=''; |
if (($auname ne "") && ($audom ne "")) { |
|
$toaddr{$auname.':'.$audom}=''; |
|
} |
} |
} |
} |
} |
|
|
Line 1831 sub sendoffmail {
|
Line 1802 sub sendoffmail {
|
} |
} |
} else { |
} else { |
$r->print('<p><span class="LC_error">'.&mt('Could not deliver message').'</span> '. |
$r->print('<p><span class="LC_error">'.&mt('Could not deliver message').'</span> '. |
&mt('Please use the browser "Back" button and correct the recipient addresses').'</p>'); |
&mt('Please use the browser "Back" button and correct the recipient addresses '."($sendstatus)").'</p>'); |
} |
} |
} |
} |
|
|
Line 1852 sub handler {
|
Line 1823 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','subject','text']); |
$sqs='&sortedby='.$env{'form.sortedby'}; |
$sqs='&sortedby='.$env{'form.sortedby'}; |
|
|
# ------------------------------------------------------ They checked for email |
# ------------------------------------------------------ They checked for email |