version 1.104, 2009/11/06 19:49:26
|
version 1.111, 2010/08/29 22:59:49
|
Line 170 sub display_groups {
|
Line 170 sub display_groups {
|
my %actionlinks = ( |
my %actionlinks = ( |
modify => '<a href="/adm/coursegroups?action=modify&refpage='. |
modify => '<a href="/adm/coursegroups?action=modify&refpage='. |
$env{'form.refpage'}.'&state=pick_task&groupname=', |
$env{'form.refpage'}.'&state=pick_task&groupname=', |
view => '<a href="/adm/'.$cdom.'/'.$cnum.'/', |
view => '<a href="', |
delete => '<a href="/adm/coursegroups?action=delete&refpage='. |
delete => '<a href="/adm/coursegroups?action=delete&refpage='. |
$env{'form.refpage'}.'&state=verify&groupname=', |
$env{'form.refpage'}.'&state=verify&groupname=', |
reenable => '<a href="/adm/coursegroups?action=reenable&refpage='. |
reenable => '<a href="/adm/coursegroups?action=reenable&refpage='. |
Line 221 sub display_groups {
|
Line 221 sub display_groups {
|
$status); |
$status); |
|
|
if (%curr_groups) { |
if (%curr_groups) { |
|
my $navmap=Apache::lonnavmaps::navmap->new(); |
|
if (!defined($navmap)) { |
|
$r->print('<div class="LC_error">'. |
|
&mt('An error occurred retrieving information about resources in the course.').'<br />'. |
|
&mt('It is recommended that you [_1]re-initialize the course[_2] and then return to this page.','<a href="/adm/roles?selectrole=1&newrole='.$env{'request.role'}.'&orgurl=%2fadm%2fcoursegroups">','</a>'). |
|
'</div>'); |
|
return; |
|
} |
if ($manage_permission) { |
if ($manage_permission) { |
if ($action ne 'reenable') { |
if ($action ne 'reenable') { |
$r->print('<br /><a href="/adm/coursegroups?action=create&refpage='.$env{'form.refpage'}.'">'.$lt{'crng'}.'</a>'); |
$r->print('<br /><a href="/adm/coursegroups?action=create&refpage='.$env{'form.refpage'}.'">'.$lt{'crng'}.'</a>'); |
Line 324 END
|
Line 332 END
|
$action eq 'reenable') { |
$action eq 'reenable') { |
$link .= $group; |
$link .= $group; |
} else { |
} else { |
$link .= $group.'/smppg?ref=grouplist'; |
$link .= |
|
&Apache::longroup::get_group_link($cdom,$cnum,$group,$navmap); |
|
$link .= (($link=~/\?/)?'&':'?').'ref=grouplist'; |
if (exists($env{'form.refpage'})) { |
if (exists($env{'form.refpage'})) { |
$link .= '&refpage='.$env{'form.refpage'}; |
$link .= '&refpage='.$env{'form.refpage'}; |
} |
} |
Line 386 END
|
Line 396 END
|
$r->print('<br /><br />'); |
$r->print('<br /><br />'); |
my %curr_groups = &Apache::longroup::coursegroups($cdom,$cnum); |
my %curr_groups = &Apache::longroup::coursegroups($cdom,$cnum); |
if (%curr_groups) { |
if (%curr_groups) { |
|
my $navmap=Apache::lonnavmaps::navmap->new(); |
|
if (!defined($navmap)) { |
|
$r->print('<div class="LC_error">'. |
|
&mt('An error occurred retrieving information about resources in the course.').'<br />'. |
|
&mt('It is recommended that you [_1]re-initialize the course[_2] and then return to this page.','<a href="/adm/roles?selectrole=1&newrole='.$env{'request.role'}.'&orgurl=%2fadm%2fcoursegroups">','</a>'). |
|
'</div>'); |
|
return; |
|
} |
foreach my $group (@coursegroups) { |
foreach my $group (@coursegroups) { |
my %group_info = &Apache::longroup::get_group_settings( |
my %group_info = &Apache::longroup::get_group_settings( |
$curr_groups{$group}); |
$curr_groups{$group}); |
my $description = &unescape( |
my $description = &unescape( |
$group_info{description}); |
$group_info{description}); |
$r->print('<font size="+1"><a href="/adm/'.$cdom.'/'.$cnum.'/'.$group.'/smppg?ref=grouplist">'.$group,'</a><font><br /><small>'.$description.'</small><br /><br />'); |
my $link = |
|
&Apache::longroup::get_group_link($cdom,$cnum,$group,$navmap). |
|
'&ref=grouplist'; |
|
$r->print('<span style="font-size: larger"><a href="'.$link.'">'.$group,'</a></span><br /><small>'.$description.'</small><br /><br />'); |
} |
} |
} |
} |
} else { |
} else { |
Line 1210 sub delete_group {
|
Line 1231 sub delete_group {
|
if ($result eq 'ok') { |
if ($result eq 'ok') { |
my $outcome = &modify_folders($cdom,$cnum,$groupname,$crstype); |
my $outcome = &modify_folders($cdom,$cnum,$groupname,$crstype); |
if ($outcome eq '') { |
if ($outcome eq '') { |
$r->print('<div class="LC_success">' |
my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Group successfully deleted.')); |
.&mt('Group successfully deleted.') |
$message = &Apache::loncommon::confirmwrapper($message); |
.'</div>'); |
$r->print($message); |
} else { |
} else { |
$r->print('<div class="LC_error">'); |
$r->print('<div class="LC_error">'); |
if ($crstype eq 'Comunity') { |
if ($crstype eq 'Community') { |
$r->print(&mt("Although the group was deleted, an error occurred when removing the group's folder from the 'Community Groups' folder: [_1]",$outcome)); |
$r->print(&mt("Although the group was deleted, an error occurred when removing the group's folder from the 'Community Groups' folder: [_1]",$outcome)); |
} else { |
} else { |
$r->print(&mt("Although the group was deleted, an error occurred when removing the group's folder from the 'Course Groups' folder: [_1]",$outcome)); |
$r->print(&mt("Although the group was deleted, an error occurred when removing the group's folder from the 'Course Groups' folder: [_1]",$outcome)); |
Line 1223 sub delete_group {
|
Line 1244 sub delete_group {
|
$r->print('</div>'); |
$r->print('</div>'); |
} |
} |
} else { |
} else { |
$r->print('<div class="LC_error">' |
my $msg = &Apache::lonhtmlcommon::confirm_success(&mt('Group deletion failed.'),1); |
.&mt('Group deletion failed.') |
$msg = &Apache::loncommon::confirmwrapper($msg); |
.'</div>'); |
$r->print($msg); |
} |
} |
} |
} |
return; |
return; |
Line 1437 $context) eq 'ok') {
|
Line 1458 $context) eq 'ok') {
|
} |
} |
my $outcome = &reenable_folder($cdom,$cnum,$groupname,$description,$crstype); |
my $outcome = &reenable_folder($cdom,$cnum,$groupname,$description,$crstype); |
if ($outcome eq '') { |
if ($outcome eq '') { |
$r->print('<div class="LC_success">' |
my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Group successfully re-enabled.')); |
.&mt('Group successfully re-enabled.') |
$message = &Apache::loncommon::confirmwrapper($message); |
.'</div>'); |
$r->print($message); |
} else { |
} else { |
$r->print('<div class="LC_error">'); |
$r->print('<div class="LC_error">'); |
if ($crstype eq 'Comunity') { |
if ($crstype eq 'Community') { |
$r->print(&mt("Although the group was re-enabled, an error occurred when adding the group's folder to the 'Community Groups' folder: [_1]",$outcome)); |
$r->print(&mt("Although the group was re-enabled, an error occurred when adding the group's folder to the 'Community Groups' folder: [_1]",$outcome)); |
} else { |
} else { |
$r->print(&mt("Although the group was re-enabled, an error occurred when adding the group's folder to the 'Course Groups' folder: [_1]",$outcome)); |
$r->print(&mt("Although the group was re-enabled, an error occurred when adding the group's folder to the 'Course Groups' folder: [_1]",$outcome)); |
Line 1450 $context) eq 'ok') {
|
Line 1471 $context) eq 'ok') {
|
$r->print('</div>'); |
$r->print('</div>'); |
} |
} |
} else { |
} else { |
$r->print('<div class="LC_error">' |
my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Re-enabling group failed.'),1); |
.&mt('Re-enabling group failed.') |
$message = &Apache::loncommon::confirmwrapper($message); |
.'</div>'); |
$r->print($message); |
} |
} |
return; |
return; |
} |
} |
Line 1774 sub membership_options {
|
Line 1795 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.', |
'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.', |
'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.', |
'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 <i>changes</i> in the course.', |
|
'acty' => 'Access types', |
'acty' => 'Access types', |
'coro' => 'Course roles', |
'coro' => 'Course roles', |
'cose' => 'Course sections', |
'cose' => 'Course sections', |
Line 2337 sub default_privileges {
|
Line 2357 sub default_privileges {
|
&Apache::lonhtmlcommon::row_title($lt{'func'},undef, |
&Apache::lonhtmlcommon::row_title($lt{'func'},undef, |
'LC_groups_functionality')); |
'LC_groups_functionality')); |
my @tableHeader; |
my @tableHeader; |
foreach my $key (sort(keys(%{$functions}))){ |
if ((ref($functions) eq 'HASH') && (ref($tools) eq 'ARRAY')) { |
push (@tableHeader,&mt($functions->{$key})); |
@tableHeader = map { $functions->{$_}; } @{$tools}; |
} |
} |
$r->print(join('</td><td class="LC_groups_functionality">', @tableHeader)); |
$r->print(join('</td><td class="LC_groups_functionality">', @tableHeader)); |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
my $fixed = ''; |
my $fixed = ''; |
Line 3244 sub write_group_data {
|
Line 3264 sub write_group_data {
|
$description,$tools,\%groupinfo, |
$description,$tools,\%groupinfo, |
$gpterm,$ucgpterm,$crstype); |
$gpterm,$ucgpterm,$crstype); |
if ($result eq 'ok') { |
if ($result eq 'ok') { |
$r->print('<div class="LC_success">' |
my $msg = &Apache::lonhtmlcommon::confirm_success(&mt($ucgpterm.' [_1] was created.','<i>'.$groupname.'</i>')); |
.&mt($ucgpterm.' [_1] was created.','<i>'.$groupname.'</i>') |
$msg = &Apache::loncommon::confirmwrapper($msg); |
.'</div>'); |
$r->print($msg); |
} else { |
} else { |
$r->print('<div class="LC_error">' |
my $msg = &Apache::lonhtmlcommon::confirm_success(&mt('A problem occurred when creating folders for the new '.$gpterm.' [_1]:' |
.&mt('A problem occurred when creating folders for the new '.$gpterm.' [_1]:' |
,'<i>'.$groupname.'</i>') |
,'<i>'.$groupname.'</i>') |
.'<br />'.$result,1); |
.'<br />'.$result |
$msg = &Apache::loncommon::confirmwrapper($msg); |
.'</div>'); |
$r->print($msg); |
} |
} |
} elsif ($action eq 'modify') { |
} elsif ($action eq 'modify') { |
my (@oldtools,@newtools); |
my (@oldtools,@newtools); |
Line 3323 sub write_group_data {
|
Line 3343 sub write_group_data {
|
$r->print('<div class="LC_error">'.$error.'</div>'); |
$r->print('<div class="LC_error">'.$error.'</div>'); |
} |
} |
} |
} |
$r->print('<div class="LC_success">' |
my $message = &Apache::lonhtmlcommon::confirm_success(&mt($ucgpterm.' [_1] was updated.','<i>'.$groupname.'</i>')); |
.&mt($ucgpterm.' [_1] was updated.','<i>'.$groupname.'</i>') |
$message = &Apache::loncommon::confirmwrapper($message); |
.'</div>'); |
$r->print($message); |
} |
} |
} else { |
} else { |
my %actiontype = ( |
my %actiontype = ( |
Line 3503 sub process_membership {
|
Line 3523 sub process_membership {
|
my $roster_result = &Apache::lonnet::modify_coursegroup_membership($cdom, |
my $roster_result = &Apache::lonnet::modify_coursegroup_membership($cdom, |
$cnum,\%usersettings); |
$cnum,\%usersettings); |
if ($num_ok) { |
if ($num_ok) { |
foreach my $type (sort(keys(%added))) { |
my $msgall =''; |
$r->print(&mt('The following users were successfully [_1]',$type)); |
foreach my $type (sort(keys(%added))) { |
|
my $message = &mt('The following users were successfully [_1]',$type); |
if (!($type eq 'deleted' || $type eq 'expired')) { |
if (!($type eq 'deleted' || $type eq 'expired')) { |
$r->print(&mt(' with the following privileges')); |
$message .= &mt(' with the following privileges'); |
} |
} |
$r->print(':<br />'); |
$message .= ':<br/>'; |
foreach my $user (@{$added{$type}}) { |
foreach my $user (@{$added{$type}}) { |
my $privlist = ''; |
my $privlist = ''; |
if (!($type eq 'deleted' || $type eq 'expired')) { |
if (!($type eq 'deleted' || $type eq 'expired')) { |
Line 3524 sub process_membership {
|
Line 3545 sub process_membership {
|
} |
} |
$privlist =~ s/, $//; |
$privlist =~ s/, $//; |
} |
} |
$r->print($$userdata{$user}[$$idx{fullname}].' - '.$user.$privlist.'<br />'); |
$message .= $$userdata{$user}[$$idx{fullname}].' - '.$user.$privlist.'<br />'; |
} |
} |
$r->print('<br />'); |
$message .= '<br/>'; |
|
$message = &Apache::lonhtmlcommon::confirm_success($message); |
|
$msgall .= $message; |
} |
} |
|
$msgall = &Apache::loncommon::confirmwrapper($msgall); |
|
$r->print($msgall); |
} |
} |
if ($num_fail) { |
if ($num_fail) { |
foreach my $type (sort(keys(%failed))) { |
foreach my $type (sort(keys(%failed))) { |
Line 3540 sub process_membership {
|
Line 3565 sub process_membership {
|
} |
} |
$r->print('<br />'); |
$r->print('<br />'); |
} |
} |
if (@unchanged > 0) { |
# Is that really needed? |
$r->print(&mt('No change occurred for the following users:').'<br />'); |
# |
foreach my $user (sort(@unchanged)) { |
# if (@unchanged > 0) { |
$r->print($$userdata{$user}[$$idx{fullname}].' - '.$user.'<br />'); |
# $r->print(&mt('No change occurred for the following users:').'<br />'); |
} |
# foreach my $user (sort(@unchanged)) { |
$r->print('<br />'); |
# $r->print($$userdata{$user}[$$idx{fullname}].' - '.$user.'<br />'); |
} |
# } |
|
# $r->print('<br />'); |
|
# } |
if ($roster_result eq 'ok') { |
if ($roster_result eq 'ok') { |
$r->print('<div class="LC_success">' |
$r->print('<div class="LC_success">' |
.&mt($ucgpterm.' membership list updated.') |
.&mt($ucgpterm.' membership list updated.') |
Line 3710 sub standard_roles {
|
Line 3737 sub standard_roles {
|
sub modify_menu { |
sub modify_menu { |
my ($r,$groupname,$page,$gpterm) = @_; |
my ($r,$groupname,$page,$gpterm) = @_; |
my @menu = |
my @menu = |
( |
( { categorytitle =>'Group Actions', |
{ text => "Modify default $gpterm settings", |
items => [ |
help => 'Course_Modify_Group', |
|
state => 'change_settings', |
{ linktext => "Modify default $gpterm settings", |
branch => '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, '. |
{ linktext => 'Modify access, tools and privileges for members', |
'future, or current 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', |
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', |
help => 'Course_Group_Add_Members', |
state => 'add_members', |
}]} |
branch => 'adds', |
); |
}, |
$r->print(&Apache::lonhtmlcommon::generate_menu(@menu)); |
); |
|
my $menu_html = ''; |
|
foreach my $menu_item (@menu) { |
|
$menu_html .= |
|
'<p><font size="+1"><a href="/adm/coursegroups?action=modify&refpage='.$env{'form.refpage'}.'&groupname='.$groupname.'&state='.$menu_item->{'state'}.'&branch='.$menu_item->{'branch'}.'">'; |
|
$menu_html.= &mt($menu_item->{'text'}).'</a></font>'; |
|
if (exists($menu_item->{'help'})) { |
|
$menu_html.= |
|
&Apache::loncommon::help_open_topic($menu_item->{'help'}); |
|
} |
|
$menu_html.='</p>'.$/; |
|
} |
|
$r->print($menu_html); |
|
return; |
return; |
} |
} |
|
|
Line 4232 sub check_changes {
|
Line 4255 sub check_changes {
|
} |
} |
|
|
1; |
1; |
|
|