--- loncom/interface/lonmsgdisplay.pm 2007/04/22 02:25:36 1.69 +++ loncom/interface/lonmsgdisplay.pm 2008/11/25 21:59:24 1.98 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging display # -# $Id: lonmsgdisplay.pm,v 1.69 2007/04/22 02:25:36 raeburn Exp $ +# $Id: lonmsgdisplay.pm,v 1.98 2008/11/25 21:59:24 schafran Exp $ # # Copyright Michigan State University Board of Trustees # @@ -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,33 +512,55 @@ 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 .= '
'.&mt('Bcc: course members with current access').'
'; + $result .= $tmptext.'

'; + 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 .= '
'.&mt('Bcc: course members with expired access').'
'; + $result .= $tmptext.'

'; + 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 .= '
'.&mt('Bcc: course members with future access').'
'; + $result .= $tmptext.'
'; + 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 ($cdom,$cnum,$group,$access_status) = @_; my $result; # 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.'); + $result = &mt('Error: you must have a course role selected to be able to send a broadcast +e-mail to a group in the course.'); return $result; } if ($cdom eq '' || $cnum eq '') { @@ -544,6 +570,10 @@ sub disgroup { 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')); } @@ -552,7 +582,6 @@ sub disgroup { 'recipients to select.'); return $result; } else { - $result = &mt('Select message recipients from the group members listed below.
'); my %Sortby = ( active => {}, previous => {}, @@ -562,9 +591,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}; @@ -579,26 +608,34 @@ sub disgroup { } } $result .= &group_check_uncheck(); - $result .= ''. - ''; foreach my $status (@statustypes) { if (ref($numitems) eq 'HASH') { if ((defined($$numitems{$status})) && ($$numitems{$status})) { - $result.='". + 'onclick="javascript:toggleAll('."this.form,'uncheck'".')" />'. + ''; + if ($status eq 'active') { + $result .= '   '; + } + $result .= '
'.&Apache::loncommon::start_data_table(). + &Apache::loncommon::start_data_table_header_row(). + "". "". "". - &Apache::loncommon::end_data_table_header_row(); + &Apache::loncommon::end_data_table_header_row(); foreach my $key (sort(keys(%{$Sortby{$status}}))) { foreach my $user (@{$Sortby{$status}{$key}}) { $result .= @@ -612,12 +649,10 @@ sub disgroup { &Apache::loncommon::end_data_table_row(); } } - $result .= &Apache::loncommon::end_data_table(); + $result .= &Apache::loncommon::end_data_table().'
'; } } - $result .= ''; } - $result .= '
'. - '
'.$lt{$status}. - ''. + my $formname = $status.'users'; + if (ref($access_status) eq 'HASH') { + $access_status->{$status} = $$numitems{$status}; + } + $result.='
'.$lt{$status}. + '
'. + ''. ''. + 'onclick="javascript:toggleAll('."this.form,'check'".')" />'. '  '. ''. - '

'. - &Apache::loncommon::start_data_table(). - &Apache::loncommon::start_data_table_header_row(); - $result .= "
$lt{'name'}$lt{'name'}$lt{'usnm'}$lt{'doma'}  
'; } return $result; } @@ -625,24 +660,19 @@ sub disgroup { sub group_check_uncheck { my $output = qq| + +|; + } + } if ($forwarding) { %message=&Apache::lonnet::get('nohist_email'.$suffix,[$forwarding]); %content=&Apache::lonmsg::unpackagemsg($message{$forwarding},$folder); $dispcrit.=''; - $func=&mt('Forward'); + $func1='Forward'; # do not translate here! $dissub=&mt('Forwarding').': '.$content{'subject'}; $dismsg=&mt('Forwarded message from').' '. @@ -1245,7 +1383,7 @@ sub compout { %content=&Apache::lonmsg::unpackagemsg($message{$replying},$folder); $dispcrit.=''; - $func=&mt('Send Reply to'); + $func1='Send Reply to'; # do not translate here! $dissub=&mt('Reply').': '.$content{'subject'}; $dismsg='> '.$content{'message'}; @@ -1255,56 +1393,136 @@ sub compout { if ($content{'baseurl'}) { $disbase=''; if ($env{'user.adv'}) { - $disbase.='