version 1.21, 2006/05/01 16:17:56
|
version 1.26, 2006/05/17 09:51:26
|
Line 28
|
Line 28
|
|
|
|
|
package Apache::lonmsgdisplay; |
package Apache::lonmsgdisplay; |
|
use Apache::lonselstudent; |
|
|
=pod |
=pod |
|
|
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 ($classgroups,$studentgroups) = |
$current_members, |
&Apache::loncoursedata::get_group_memberships($classlist); |
$expired_members, |
my %lt=&Apache::lonlocal::texthash('cfa' => 'Check All', |
$future_members) = &Apache::lonselstudent::get_people_in_class(); |
'cfs' => 'Check Section/Group', |
unshift @$current_members, (@$course_personnel); |
'cfn' => 'Uncheck All'); |
my %defaultUsers; |
if (defined($env{'form.group'})) { |
|
$r->print('<input type="hidden" name="group" value="'. |
$result = &Apache::lonselstudent::render_student_list($current_members, |
$env{'form.group'}.'" />'."\n"); |
"compemail", |
} |
"current", |
$r->print(<<ENDDISHEADER); |
\%defaultUsers, |
<input type="hidden" name="sendmode" value="group" /> |
1,"selectedusers",1); |
<script pe="text/javascript"> |
|
function checkall() { |
|
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=true; |
|
} |
|
} |
|
} |
|
|
|
function checksec() { |
return $result; |
for (i=0; i<document.forms.compemail.elements.length; i++) { |
|
if |
|
(document.forms.compemail.elements[i].name.indexOf |
|
('send_to_&&&'+document.forms.compemail.chksec.value+'&&&')==0) { |
|
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; |
|
} |
|
} |
|
} |
|
|
|
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="15" name="chksec" value="$env{'form.group'}" /> |
|
<input type="button" onClick="uncheckall()" value="$lt{'cfn'}" /> |
|
<p> |
|
ENDDISHEADER |
|
my %coursepersonnel=&Apache::lonnet::get_course_adv_roles(); |
|
$r->print(&Apache::loncommon::start_data_table()); |
|
if (keys(%coursepersonnel) > 0) { |
|
$r->print('<h3>Non-students</h3>'); |
|
$r->print(&Apache::loncommon::start_data_table()); |
|
$r->print('<tr><th>Name</th><th>Username:Domain</th><th>Role</th></tr>'); |
|
foreach my $role (sort(keys(%coursepersonnel))) { |
|
foreach my $user (split(/\,/,$coursepersonnel{$role})) { |
|
my ($puname,$pudom)=split(/\:/,$user); |
|
$r->print(&Apache::loncommon::start_data_table_row()); |
|
$r->print('<td><label>'. |
|
'<input type="checkbox" name="send_to_&&&&&&_'. |
|
$puname.':'.$pudom.'" /> '. |
|
&Apache::loncommon::plainname($puname,$pudom). |
|
'</label></td>'. |
|
'<td>('.$user.'),</td><td><i>'.$role.'</i></td>'); |
|
$r->print(&Apache::loncommon::end_data_table_row()); |
|
} |
|
} |
|
$r->print(&Apache::loncommon::end_data_table()); |
|
} |
|
if (keys(%{$classlist}) > 0) { |
|
$r->print('<h3>Students</h3>'); |
|
$r->print(&Apache::loncommon::start_data_table()); |
|
$r->print('<tr><th>Name</th><th>Username:Domain</th><th>Section</th><th>Groups</th></tr>'); |
|
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 @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()); |
|
} |
|
} |
} |
|
|
# ==================================================== Display Critical Message |
# ==================================================== Display Critical Message |
Line 901 sub compout {
|
Line 790 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 976 ENDUPLOAD
|
Line 867 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 1654 sub header {
|
Line 1547 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 1731 sub sendoffmail {
|
Line 1624 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 1747 sub sendoffmail {
|
Line 1653 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 1881 sub sendoffmail {
|
Line 1791 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 1902 sub handler {
|
Line 1812 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','group']); |
'showcommentbaseurl','dismode','group','subject','text']); |
$sqs='&sortedby='.$env{'form.sortedby'}; |
$sqs='&sortedby='.$env{'form.sortedby'}; |
|
|
# ------------------------------------------------------ They checked for email |
# ------------------------------------------------------ They checked for email |