--- loncom/interface/lonmsgdisplay.pm 2007/05/02 01:33:49 1.72
+++ loncom/interface/lonmsgdisplay.pm 2009/01/06 21:38:43 1.108
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging display
#
-# $Id: lonmsgdisplay.pm,v 1.72 2007/05/02 01:33:49 albertel Exp $
+# $Id: lonmsgdisplay.pm,v 1.108 2009/01/06 21:38:43 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -243,9 +243,9 @@ function folder_choice(targetform,caller
-
'.
- '
'.&mt('New Folder').' '.
+ '
'.&mt('Name').' '.
'
@@ -353,7 +353,7 @@ sub makefolder {
}
} else {
$outcome =
- &mt('Error - could not obtain lock on email folders record.');
+ &mt('Error - could not obtain lock on message folders record.');
}
return ($outcome,$warning);
}
@@ -390,6 +390,9 @@ sub renamefolder {
if ($env{'form.renamed'} eq '') {
return &mt('The folder "[_1]" may not be renamed to "[_2]" as the new name you requested is an invalid name.',$folder,$newname);
}
+ if (defined($permfolders{$folder})) {
+ return &mt('The folder "[_1]" may not be renamed as it is a folder provided by the system.',$folder);
+ }
if (defined($permfolders{$newname})) {
return &mt('The folder "[_1]" may not be renamed to "[_2]" as the new name you requested is reserved for folders provided automatically by the system.',$folder,$newname);
}
@@ -499,7 +502,8 @@ sub movemsg {
# ======================================================= Display a course list
sub discourse {
- my $result;
+ my ($statushash) = @_;
+ my ($result,$active,$previous,$future);
my ($course_personnel,
$current_members,
$expired_members,
@@ -508,51 +512,78 @@ sub discourse {
unshift @$current_members, (@$course_personnel);
my %defaultUsers;
- $result .= ''."\n";
+ my $tmptext;
+ if ($tmptext = &Apache::lonselstudent::render_student_list($current_members,
+ "activeusers",
+ "current",
+ \%defaultUsers,
+ 1,"selectedusers",1,'email')
+ ) {
+ $result .= ' ';
+ if (ref($statushash) eq 'HASH') {
+ $statushash->{'active'} = 1;
+ }
+ }
+ if ($tmptext = &Apache::lonselstudent::render_student_list($expired_members,
+ "previoususers",
+ "expired",
+ \%defaultUsers,
+ 1, "selectedusers",0,'email')
+ ) {
+ $result .= ' ';
+ if (ref($statushash) eq 'HASH') {
+ $statushash->{'previous'} = 1;
+ }
+
+ }
+ if ($tmptext = &Apache::lonselstudent::render_student_list($future_members,
+ "futureusers",
+ "future",
+ \%defaultUsers,
+ 1, "selectedusers",0,'email')
+ ) {
+ $result .= '';
+ if (ref($statushash) eq 'HASH') {
+ $statushash->{'future'} = 1;
+ }
- $result .= &Apache::lonselstudent::render_student_list($current_members,
- "compemail",
- "current",
- \%defaultUsers,
- 1,"selectedusers",1);
-
- $result .= &Apache::lonselstudent::render_student_list($expired_members,
- "compemail",
- "expired",
- \%defaultUsers,
- 1, "selectedusers",0);
- $result .= &Apache::lonselstudent::render_student_list($future_members,
- "compemail",
- "future",
- \%defaultUsers,
- 1, "selectedusers", 0);
+ }
return $result;
}
sub disgroup {
- my ($cdom,$cnum,$group,$viewgrps,$editgrps) = @_;
- my $result;
+ my ($r,$cdom,$cnum,$group,$access_status) = @_;
+ my $hasfloat;
# Needs to be in a course
if (!($env{'request.course.fn'})) {
- $result = &mt('Error: you must have a course role selected to be able to send a broadcast message to a group in the course.');
- return $result;
+ $r->print(''.&mt('Error: you must have a course role selected to be able to send a broadcast message to a group in the course.').'');
+ return;
}
if ($cdom eq '' || $cnum eq '') {
- $result = &mt('Error: could not determine domain or number of course');
- return $result;
+ $r->print(''.&mt('Error: could not determine domain or number of course').'');
+ return;
}
my ($memberinfo,$numitems) =
&Apache::longroup::group_memberlist($cdom,$cnum,$group,{},[]);
my @statustypes = ('active');
+ my $viewgrps = &Apache::lonnet::allowed('vcg',$env{'request.course.id'}.
+ ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
+ my $editgrps = &Apache::lonnet::allowed('mdg',$env{'request.course.id'}.
+ ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
if ($viewgrps || $editgrps) {
push(@statustypes,('future','previous'));
}
if (keys(%{$memberinfo}) == 0) {
- $result = &mt('As this group has no members, there are no '.
- 'recipients to select.');
- return $result;
+ $r->print(''.
+ &mt('As this group has no members, there are no recipients to select').
+ '');
+ return;
} else {
- $result = &mt('Select message recipients from the group members listed below. ');
+ $hasfloat = 1;
+ $r->print('
');
my %Sortby = (
active => {},
previous => {},
@@ -562,9 +593,9 @@ sub disgroup {
'name' => 'Name',
'usnm' => 'Username',
'doma' => 'Domain',
- 'active' => 'Active Members',
- 'previous' => 'Former Members',
- 'future' => 'Future Members',
+ 'active' => 'Broadcast to Active Members',
+ 'previous' => 'Broadcast (Bcc) to Former Members',
+ 'future' => 'Broadcast (Bcc) to Future Members',
);
foreach my $user (sort(keys(%{$memberinfo}))) {
my $status = $$memberinfo{$user}{status};
@@ -578,71 +609,72 @@ sub disgroup {
push(@{$Sortby{$status}{$$memberinfo{$user}{fullname}}},$user);
}
}
- $result .= &group_check_uncheck();
- $result .= '
'.
- '
';
+ $r->print(&group_check_uncheck());
foreach my $status (@statustypes) {
if (ref($numitems) eq 'HASH') {
if ((defined($$numitems{$status})) && ($$numitems{$status})) {
- $result.='
ENDADD
return $output;
}
sub submit_button_row {
- my ($folder,$dismode,$sendtext,$lt) = @_;
- my $output = qq|
+ my ($folder,$dismode,$sendtext,$lt,$is_crsform,$group) = @_;
+ my $pre=&mt("Show Preview and Check Spelling");
+ my $value=&mt('Send');
+ my $prevbutton = '';
+ my $output = qq|
-
-
-
+|;
+ if ($is_crsform) {
+ $output .= ''."\n";
+ if ($group ne '') {
+ $output .= ''."\n";
+ }
+ }
+ $output .= qq|
+
+
+
+
$prevbutton
|;
return $output;
}
sub msg_subject_row {
my ($dissub,$lt,$subj_size,$extra) = @_;
- my $output = '
'.$lt->{'sb'}.':
'.$lt->{'sb'}.': '.$extra.
'
';
return $output;
}
+sub generate_preview_form {
+ my $prevbutton = (<
+
+
+
+ENDPREVIEW
+}
+
+# ---------------------------------------------------- Display all face to face
+
sub retrieve_instructor_comments {
my ($user,$domain)=@_;
my $target=$env{'form.grade_target'};
@@ -1563,7 +1813,7 @@ $content{'sendername'}.':'.
}
# Check to see if there were any messages.
if ($result eq '') {
- my $lctype = lc(&Apache::loncommon::course_type());
+ my $lctype = &mt(lc(&Apache::loncommon::course_type()));
if ($target ne 'tex') {
$r->print("
".&mt('No notes, face-to-face discussion records, critical messages, or broadcast messages in this [_1].',$lctype)."
");
} else {
@@ -1984,9 +2234,7 @@ sub displaymessage {
}
my %message=&Apache::lonnet::get('nohist_email'.$suffix,[$msgid]);
my %content=&Apache::lonmsg::unpackagemsg($message{$msgid});
-
my $counter=0;
- $r->print('
');
my $escmsgid=&escape($msgid);
foreach (@messages) {
if ($_->[5] eq $escmsgid){
@@ -1994,32 +2242,86 @@ sub displaymessage {
}
$counter++;
}
- $r->print('
');
+
+ my $see_anonymous;
+ my $from_student = 0;
+ if ($env{'request.course.id'} eq $content{'courseid'}) {
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ my $username = $content{'sendername'}.':'.$content{'senderdomain'};
+ my %classlist_entry =
+ &Apache::lonnet::get('classlist',[$username],$cdom,$cnum);
+ if (exists($classlist_entry{$username})) {
+ $from_student = 1;
+ $see_anonymous = &Apache::lonnet::allowed('rin',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
+ }
+ }
+
+
my $number_of_messages = scalar(@messages); #subtract 1 for last index
# start output
&printheader($r,'/adm/email?display='.&escape($msgid),'Display a Message','',$content{'baseurl'});
my %courseinfo=&Apache::lonnet::coursedescription($content{'courseid'});
-# Functions
- $r->print('