--- loncom/interface/loncoursegroups.pm 2009/11/16 14:07:57 1.105
+++ loncom/interface/loncoursegroups.pm 2010/02/23 14:18:12 1.110
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: loncoursegroups.pm,v 1.105 2009/11/16 14:07:57 bisitz Exp $
+# $Id: loncoursegroups.pm,v 1.110 2010/02/23 14:18:12 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -170,7 +170,7 @@ sub display_groups {
my %actionlinks = (
modify => ' ' ''.
+ &mt('An error occurred retrieving information about resources in the course.').'
'.
+ &mt('It is recommended that you [_1]re-initialize the course[_2] and then return to this page.','','').
+ '');
+ return;
+ }
if ($manage_permission) {
if ($action ne 'reenable') {
$r->print('
'.$lt{'crng'}.'');
@@ -324,7 +332,8 @@ END
$action eq 'reenable') {
$link .= $group;
} else {
- $link .= $group.'/smppg?ref=grouplist';
+ $link .=
+ &Apache::longroup::get_group_link($cdom,$cnum,$group,$navmap).'&ref=grouplist';
if (exists($env{'form.refpage'})) {
$link .= '&refpage='.$env{'form.refpage'};
}
@@ -386,12 +395,23 @@ END
$r->print('
');
my %curr_groups = &Apache::longroup::coursegroups($cdom,$cnum);
if (%curr_groups) {
+ my $navmap=Apache::lonnavmaps::navmap->new();
+ if (!defined($navmap)) {
+ $r->print('
'.
+ &mt('An error occurred retrieving information about resources in the course.').'
'.
+ &mt('It is recommended that you [_1]re-initialize the course[_2] and then return to this page.','
','').
+ '
');
+ return;
+ }
foreach my $group (@coursegroups) {
my %group_info = &Apache::longroup::get_group_settings(
$curr_groups{$group});
my $description = &unescape(
$group_info{description});
- $r->print(''.$group,'
'.$description.'
');
+ my $link =
+ &Apache::longroup::get_group_link($cdom,$cnum,$group,$navmap).
+ '&ref=grouplist';
+ $r->print(''.$group,'
'.$description.'
');
}
}
} else {
@@ -1210,9 +1230,9 @@ sub delete_group {
if ($result eq 'ok') {
my $outcome = &modify_folders($cdom,$cnum,$groupname,$crstype);
if ($outcome eq '') {
- $r->print(''
- .&mt('Group successfully deleted.')
- .'
');
+ my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Group successfully deleted.'));
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
} else {
$r->print('');
if ($crstype eq 'Community') {
@@ -1223,9 +1243,9 @@ sub delete_group {
$r->print('
');
}
} else {
- $r->print(''
- .&mt('Group deletion failed.')
- .'
');
+ my $msg = &Apache::lonhtmlcommon::confirm_success(&mt('Group deletion failed.'),1);
+ $msg = &Apache::loncommon::confirmwrapper($msg);
+ $r->print($msg);
}
}
return;
@@ -1437,9 +1457,9 @@ $context) eq 'ok') {
}
my $outcome = &reenable_folder($cdom,$cnum,$groupname,$description,$crstype);
if ($outcome eq '') {
- $r->print(''
- .&mt('Group successfully re-enabled.')
- .'
');
+ my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Group successfully re-enabled.'));
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
} else {
$r->print('');
if ($crstype eq 'Community') {
@@ -1450,9 +1470,9 @@ $context) eq 'ok') {
$r->print('
');
}
} else {
- $r->print(''
- .&mt('Re-enabling group failed.')
- .'
');
+ my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Re-enabling group failed.'),1);
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
}
return;
}
@@ -1774,7 +1794,6 @@ sub membership_options {
'picr' => 'Pick the criteria to use to build a list of course users from which you will select members of the new group.',
'pica' => 'Pick the criteria to use to build a list of course users from which you will select additional members of the group.',
'ifno' => 'If you do not wish to add members when you first create the group, there is no need to pick any criteria.',
- 'asub' => 'A subsequent step will also allow you to specify automatic adding/dropping of group members triggered by specified user role and section changes in the course.',
'acty' => 'Access types',
'coro' => 'Course roles',
'cose' => 'Course sections',
@@ -2337,9 +2356,9 @@ sub default_privileges {
&Apache::lonhtmlcommon::row_title($lt{'func'},undef,
'LC_groups_functionality'));
my @tableHeader;
- foreach my $key (sort(keys(%{$functions}))){
- push (@tableHeader,&mt($functions->{$key}));
- }
+ if ((ref($functions) eq 'HASH') && (ref($tools) eq 'ARRAY')) {
+ @tableHeader = map { $functions->{$_}; } @{$tools};
+ }
$r->print(join('', @tableHeader));
$r->print(&Apache::lonhtmlcommon::row_closure(1));
my $fixed = '';
@@ -3244,15 +3263,15 @@ sub write_group_data {
$description,$tools,\%groupinfo,
$gpterm,$ucgpterm,$crstype);
if ($result eq 'ok') {
- $r->print(' '
- .&mt($ucgpterm.' [_1] was created.',''.$groupname.'')
- .' ');
+ my $msg = &Apache::lonhtmlcommon::confirm_success(&mt($ucgpterm.' [_1] was created.',''.$groupname.''));
+ $msg = &Apache::loncommon::confirmwrapper($msg);
+ $r->print($msg);
} else {
- $r->print(''
- .&mt('A problem occurred when creating folders for the new '.$gpterm.' [_1]:'
- ,''.$groupname.'')
- .' '.$result
- .' ');
+ my $msg = &Apache::lonhtmlcommon::confirm_success(&mt('A problem occurred when creating folders for the new '.$gpterm.' [_1]:'
+ ,''.$groupname.'')
+ .' '.$result,1);
+ $msg = &Apache::loncommon::confirmwrapper($msg);
+ $r->print($msg);
}
} elsif ($action eq 'modify') {
my (@oldtools,@newtools);
@@ -3323,9 +3342,9 @@ sub write_group_data {
$r->print(''.$error.' ');
}
}
- $r->print(''
- .&mt($ucgpterm.' [_1] was updated.',''.$groupname.'')
- .' ');
+ my $message = &Apache::lonhtmlcommon::confirm_success(&mt($ucgpterm.' [_1] was updated.',''.$groupname.''));
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
}
} else {
my %actiontype = (
@@ -3503,12 +3522,13 @@ sub process_membership {
my $roster_result = &Apache::lonnet::modify_coursegroup_membership($cdom,
$cnum,\%usersettings);
if ($num_ok) {
- foreach my $type (sort(keys(%added))) {
- $r->print(&mt('The following users were successfully [_1]',$type));
+ my $msgall ='';
+ foreach my $type (sort(keys(%added))) {
+ my $message = &mt('The following users were successfully [_1]',$type);
if (!($type eq 'deleted' || $type eq 'expired')) {
- $r->print(&mt(' with the following privileges'));
+ $message .= &mt(' with the following privileges');
}
- $r->print(': ');
+ $message .= ': ';
foreach my $user (@{$added{$type}}) {
my $privlist = '';
if (!($type eq 'deleted' || $type eq 'expired')) {
@@ -3524,10 +3544,14 @@ sub process_membership {
}
$privlist =~ s/, $//;
}
- $r->print($$userdata{$user}[$$idx{fullname}].' - '.$user.$privlist.' ');
+ $message .= $$userdata{$user}[$$idx{fullname}].' - '.$user.$privlist.' ';
}
- $r->print(' ');
+ $message .= ' ';
+ $message = &Apache::lonhtmlcommon::confirm_success($message);
+ $msgall .= $message;
}
+ $msgall = &Apache::loncommon::confirmwrapper($msgall);
+ $r->print($msgall);
}
if ($num_fail) {
foreach my $type (sort(keys(%failed))) {
@@ -3540,13 +3564,15 @@ sub process_membership {
}
$r->print(' ');
}
- if (@unchanged > 0) {
- $r->print(&mt('No change occurred for the following users:').' ');
- foreach my $user (sort(@unchanged)) {
- $r->print($$userdata{$user}[$$idx{fullname}].' - '.$user.' ');
- }
- $r->print(' ');
- }
+# Is that really needed?
+#
+# if (@unchanged > 0) {
+# $r->print(&mt('No change occurred for the following users:').' ');
+# foreach my $user (sort(@unchanged)) {
+# $r->print($$userdata{$user}[$$idx{fullname}].' - '.$user.' ');
+# }
+# $r->print(' ');
+# }
if ($roster_result eq 'ok') {
$r->print(''
.&mt($ucgpterm.' membership list updated.')
@@ -3710,36 +3736,32 @@ sub standard_roles {
sub modify_menu {
my ($r,$groupname,$page,$gpterm) = @_;
my @menu =
- (
- { text => "Modify default $gpterm settings",
- help => 'Course_Modify_Group',
- state => 'change_settings',
- branch => 'settings',
+ ( { categorytitle =>'Group Actions',
+ items => [
+
+ { linktext => "Modify default $gpterm settings",
+ url => '/adm/coursegroups?action=modify&refpage='.$env{'form.refpage'}.'&groupname='.$groupname.'&state=change_settings&branch=settings',
+ icon => 'grp_settings.png',
+ alttext => "Modify default $gpterm settings",
+ permission => '1',
+ help => 'Course_Modify_Group',
},
- { text => 'Modify access, tools and/or privileges for previous, '.
- 'future, or current members',
+ { linktext => 'Modify access, tools and privileges for members',
+ url => '/adm/coursegroups?action=modify&refpage='.$env{'form.refpage'}.'&groupname='.$groupname.'&state=change_members&branch=members',
+ icon => 'grp_tools.png',
+ alttext => 'Modify access, tools and privileges for members',
+ permission => '1',
help => 'Course_Modify_Group_Membership',
- state => 'change_members',
- branch => 'members',
},
- { text => "Add member(s) to the $gpterm",
+ { linktext => "Add member(s) to the $gpterm",
+ url => '/adm/coursegroups?action=modify&refpage='.$env{'form.refpage'}.'&groupname='.$groupname.'&state=add_members&branch=adds',
+ icon => 'grp_add.png',
+ alttext => "Add member(s) to the $gpterm",
+ permission => '1',
help => 'Course_Group_Add_Members',
- state => 'add_members',
- branch => 'adds',
- },
- );
- my $menu_html = '';
- foreach my $menu_item (@menu) {
- $menu_html .=
- ' ';
- $menu_html.= &mt($menu_item->{'text'}).'';
- if (exists($menu_item->{'help'})) {
- $menu_html.=
- &Apache::loncommon::help_open_topic($menu_item->{'help'});
- }
- $menu_html.=' '.$/;
- }
- $r->print($menu_html);
+ }]}
+ );
+ $r->print(&Apache::lonhtmlcommon::generate_menu(@menu));
return;
}
@@ -4232,3 +4254,4 @@ sub check_changes {
}
1;
+
|