-
-
+
- '.$lt{'fold'}.' '."\n".
- &Apache::loncommon::select_form($folder,'folder',%formhash).'
+ | '.$lt{'fold'}.' '."\n".
+ &Apache::loncommon::select_form($folder,'folder',\%formhash).'
|
- '.$lt{'show'}.' '."\n".
+ | '.$lt{'show'}.' '."\n".
&Apache::loncommon::select_form($env{'form.interdis'},'interdis',
- %show).'
+ \%show).'
+ |
+ '.$lt{'status'}.' '."\n".
+ &Apache::loncommon::select_form($msgstatus,'msgstatus',\%statushash).'
|
- '.$lt{'status'}.' '."\n".
- &Apache::loncommon::select_form($msgstatus,'msgstatus',%statushash).'
+ | '.$lt{'actn'}.' '."\n".'
+ '.
+ &Apache::loncommon::select_form('view','folderaction',\%actions).
+ '
+
|
- '.$lt{'actn'}.' '.
- &Apache::loncommon::select_form('view','folderaction',%actions).'
- | '.
- '
+ | '.&mt('New Folder').' '."\n".'
+
+
+
+
|
- | | | |
-
-
- |
-
- '."\n".
+'."\n".
''.
''.
($folder=~/^critical/?'':'');
@@ -268,12 +268,13 @@ sub get_permanent_folders {
}
sub get_msgstatus_types {
- my %statushash = &Apache::lonlocal::texthash(
- '' => 'Any',
- new => 'Unread',
- read => 'Read',
- replied => 'Replied to',
- forwarded => 'Forwarded',
+ # Don't translate here!
+ my %statushash = (
+ '' => 'Any',
+ 'new' => 'Unread',
+ 'read' => 'Read',
+ 'replied' => 'Replied to',
+ 'forwarded' => 'Forwarded',
);
return %statushash;
}
@@ -286,18 +287,31 @@ sub scrollbuttons {
my %statushash = &get_msgstatus_types();
my $status;
if ($msgstatus eq '') {
- $status = &mt('All');
+ $status = 'All'; # Don't translate here!
} else {
$status = $statushash{$msgstatus};
}
- return
- ''.&mt('Page').': '.
- ''.
- ''.
- ' of '.$maxdis.
- ''.
- ' '.
- &mt('[_1] messages: showing messages [_2] through [_3] of [_4].',$status,$first,$finish,$total).'';
+ my $output = ''.&mt('Page:').' ';
+ if ($maxdis == 1) {
+ # No buttons if only one page is displayed
+ $output .= '1/1';
+ } else {
+ $output .=
+ ''.
+ ''.
+ ' / '.$maxdis.' '.
+ ''.
+ '';
+ }
+ $output .=
+ ''
+ .''.&mt($status.' messages:').' '
+ .&mt('showing messages [_1] through [_2] of [_3].',
+ $first,$finish,$total)
+ .' '
+ .'';
+
+ return $output;
}
# =============================================================== Status Change
@@ -353,7 +367,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);
}
@@ -364,7 +378,7 @@ sub deletefolder {
my ($folder)=@_;
my %permfolders = &get_permanent_folders();
if (defined($permfolders{$folder})) {
- return &mt('The folder "[_1]" may not be deleted',$folder);
+ return &mt('The folder "[_1]" may not be deleted.',$folder);
}
my %userfolders = &Apache::lonmsg::get_user_folders();
if (!defined($userfolders{$folder})) {
@@ -502,7 +516,9 @@ sub movemsg {
# ======================================================= Display a course list
sub discourse {
- my $result;
+ my ($statushash) = @_;
+ my ($result,$active,$previous,$future);
+ my $crstype = &Apache::loncommon::course_type();
my ($course_personnel,
$current_members,
$expired_members,
@@ -511,51 +527,106 @@ 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')
+ ) {
+ my $bcc_curr_hdr;
+ if ($crstype eq 'Community') {
+ $bcc_curr_hdr = &mt('Bcc: community participants with current access');
+ } else {
+ $bcc_curr_hdr = &mt('Bcc: course members with current access');
+ }
+ $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')
+ ) {
+ my $bcc_prev_hdr;
+ if ($crstype eq 'Community') {
+ $bcc_prev_hdr = &mt('Bcc: community participants with expired access');
+ } else {
+ $bcc_prev_hdr = &mt('Bcc: course members with expired access');
+ }
+ $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')
+ ) {
+ my $bcc_future_hdr;
+ if ($crstype eq 'Community') {
+ $bcc_future_hdr = &mt('Bcc: community participants with future access');
+ } else {
+ $bcc_future_hdr = &mt('Bcc: course members with future access');
+ }
+
+ $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 => {},
@@ -565,9 +636,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};
@@ -581,75 +652,80 @@ sub disgroup {
push(@{$Sortby{$status}{$$memberinfo{$user}{fullname}}},$user);
}
}
- $result .= &group_check_uncheck();
- $result .= ' ';
+ $r->print(' ');
}
- return $result;
+ return $hasfloat;
}
sub group_check_uncheck {
my $output = qq|
|;
}
@@ -679,10 +755,16 @@ sub groupmail_header {
}
&Apache::lonhtmlcommon::clear_breadcrumbs();
if ($refarg) {
+ my $brtitle;
+ if (&Apache::loncommon::course_type() eq 'Community') {
+ $brtitle = 'View community groups';
+ } else {
+ $brtitle = 'View course groups';
+ }
&Apache::lonhtmlcommon::add_breadcrumb
({href=>"/adm/coursegroups",
text=>"Groups",
- title=>"View course groups"});
+ title=>$brtitle});
}
&Apache::lonhtmlcommon::add_breadcrumb
({href=>"/adm/$cdom/$cnum/$group/smppg?$refarg",
@@ -691,13 +773,13 @@ sub groupmail_header {
{href=>"/adm/email?compose=group&group=".
"$env{'form.group'}&$refarg",
text=>"Send a Message in a Group",
- title=>"Compose Group Email Message"},);
+ title=>"Compose Group Message"},);
if ($action eq 'sending') {
&Apache::lonhtmlcommon::add_breadcrumb
({text=>"Messages being sent.",
- title=>"Messages sent"},);
+ title=>"E-mails sent"},);
}
- my $groupheader = &Apache::loncommon::start_page('Group Email');
+ my $groupheader = &Apache::loncommon::start_page('Group Message');
$groupheader .= &Apache::lonhtmlcommon::breadcrumbs
('Group - '.$env{'form.group'}.' Email');
return $groupheader;
@@ -711,7 +793,7 @@ sub groupmail_sent {
}
my $output .= '
'.
- &mt('Send another group email').''.' '.
+ &mt('Send another group message').''.' '.
''. &mt('Return to group page').'';
return $output;
@@ -721,23 +803,34 @@ sub groupmail_sent {
sub discrit {
my $r=shift;
- my $header = ''.&mt('Critical Messages').''.
- '');
+ if ($hasfloat) {
+ $r->print('');
+ }
+ $r->print(&generate_preview_form);
+}
+
+sub check_group_priv {
+ my ($group) = @_;
+ my $cid = $env{'request.course.id'};
+ my $sec = $env{'request.course.sec'};
+ return if !$cid;
+ my $can_broadcast = &Apache::lonnet::allowed('sgb',$cid.'/'.$group);
+ my $viewgrps = &Apache::lonnet::allowed('vcg',$cid.($sec?'/'.$sec:''));
+ my $editgrps = &Apache::lonnet::allowed('mdg',$cid.($sec?'/'.$sec:''));
+ if ($viewgrps || $editgrps || $can_broadcast) {
+ return 1;
+ }
+ return;
}
-# ---------------------------------------------------- Display all face to face
-
sub recipient_input_row {
my ($dom,%lt) = @_;
my $domform = &Apache::loncommon::select_dom_form($dom,'recdomain');
@@ -1496,7 +1751,7 @@ sub recipient_input_row {
&Apache::loncommon::selectstudent_link('compemail','recuname',
'recdomain');
my $output = <<"ENDREC";
- |