version 1.107, 2009/11/25 06:20:20
|
version 1.119, 2013/08/29 22:24:32
|
Line 135 function changeSort(caller) {
|
Line 135 function changeSort(caller) {
|
function openGroupRoster(group,status) { |
function openGroupRoster(group,status) { |
var url = '/adm/grouproster?'; |
var url = '/adm/grouproster?'; |
url += 'group='+group+'&status='+status+'&ref=popup'; |
url += 'group='+group+'&status='+status+'&ref=popup'; |
var title = 'Group Membership'; |
var title = 'Group_Membership'; |
var options = 'scrollbars=1,resizable=1,menubar=0'; |
var options = 'scrollbars=1,resizable=1,menubar=0'; |
options += ',width=700,height=600'; |
options += ',width=700,height=600'; |
rosterbrowser = open(url,title,options,'1'); |
rosterbrowser = open(url,title,options,'1'); |
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 { |
$r->print(&mt('You are not currently a member of any active '.$gpterm.'s in this '.lc($crstype).'.')); |
$r->print( |
|
'<p class="LC_info">' |
|
.&mt('You are not currently a member of any active '.$gpterm.'s' |
|
.' in this '.lc($crstype).'.') |
|
.'</p>' |
|
); |
} |
} |
} |
} |
return; |
return; |
Line 1210 sub delete_group {
|
Line 1236 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 'Community') { |
if ($crstype eq 'Community') { |
Line 1223 sub delete_group {
|
Line 1249 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 1255 sub reenable_folder {
|
Line 1281 sub reenable_folder {
|
$LONCAPA::map::resources[$idx] = $foldertitle.':'.$mapurl. |
$LONCAPA::map::resources[$idx] = $foldertitle.':'.$mapurl. |
':false:normal:res'; |
':false:normal:res'; |
$LONCAPA::map::order[1+$#LONCAPA::map::order]=$idx; |
$LONCAPA::map::order[1+$#LONCAPA::map::order]=$idx; |
my ($outtext,$errtext) = &LONCAPA::map::storemap($allgrpsmap,1); |
my ($outtext,$errtext) = &LONCAPA::map::storemap($allgrpsmap,1,1); |
if ($errtext) { |
if ($errtext) { |
$outcome='<div class="LC_error">' |
$outcome='<div class="LC_error">' |
.&mt('An error occurred when saving updated parent folder to group:' |
.&mt('An error occurred when saving updated parent folder to group:' |
Line 1320 sub modify_folders {
|
Line 1346 sub modify_folders {
|
$LONCAPA::map::order[$i] = $LONCAPA::map::order[$i+1]; |
$LONCAPA::map::order[$i] = $LONCAPA::map::order[$i+1]; |
} |
} |
$#LONCAPA::map::order--; |
$#LONCAPA::map::order--; |
my ($outtext,$errtext) = &LONCAPA::map::storemap($map,1); |
my ($outtext,$errtext) = &LONCAPA::map::storemap($map,1,1); |
if ($errtext) { |
if ($errtext) { |
$outcome='<div class="LC_error">' |
$outcome='<div class="LC_error">' |
.&mt('An error occurred when saving updated parent folder to group:') |
.&mt('An error occurred when saving updated parent folder to group:') |
Line 1437 $context) eq 'ok') {
|
Line 1463 $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 'Community') { |
if ($crstype eq 'Community') { |
Line 1450 $context) eq 'ok') {
|
Line 1476 $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 1466 sub header {
|
Line 1492 sub header {
|
{'add_entries' => $loaditems,}); |
{'add_entries' => $loaditems,}); |
my $output = <<"END"; |
my $output = <<"END"; |
$start_page |
$start_page |
<form method="post" name="$state"> |
<form method="post" name="$state" action=""> |
|
|
END |
END |
if ($action eq 'create' || $action eq 'modify') { |
if ($action eq 'create' || $action eq 'modify') { |
Line 1526 sub build_members_list {
|
Line 1552 sub build_members_list {
|
sub group_files { |
sub group_files { |
my ($group,$portpath,$numfiles,$numdirs) = @_; |
my ($group,$portpath,$numfiles,$numdirs) = @_; |
my $dirptr=16384; |
my $dirptr=16384; |
my @dir_list=&Apache::portfolio::get_dir_list($portpath,undef,$group); |
my ($dirlistref,$listerror) = |
foreach my $line (@dir_list) { |
&Apache::portfolio::get_dir_list($portpath,undef,$group); |
my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$line,16); |
if (ref($dirlistref) eq 'ARRAY') { |
if (($filename !~ /^\.\.?$/) && ($filename !~ /\.meta$/ ) && ($filename !~ /(.*)\.(\d+)\.([^\.]*)$/) && ($filename ne 'no_such_dir')) { |
foreach my $line (@{$dirlistref}) { |
if ($dirptr&$testdir) { |
my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$line,16); |
$portpath .= '/'.$filename; |
if (($filename !~ /^\.\.?$/) && ($filename !~ /\.meta$/ ) && ($filename !~ /(.*)\.(\d+)\.([^\.]*)$/) && ($filename ne 'no_such_dir')) { |
$$numdirs ++; |
if ($dirptr&$testdir) { |
&group_files($group,$portpath,$numfiles,$numdirs) |
$portpath .= '/'.$filename; |
} else { |
$$numdirs ++; |
$$numfiles ++; |
&group_files($group,$portpath,$numfiles,$numdirs) |
|
} else { |
|
$$numfiles ++; |
|
} |
} |
} |
} |
} |
} |
} |
Line 1774 sub membership_options {
|
Line 1803 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 1988 sub print_current_settings {
|
Line 2016 sub print_current_settings {
|
dfac => 'Default access dates', |
dfac => 'Default access dates', |
ygrs => "Your group selections - ", |
ygrs => "Your group selections - ", |
tfwa => "The following settings will apply to the group:", |
tfwa => "The following settings will apply to the group:", |
difn => 'Different collaborative tools<br />for different members:', |
|
stda => 'Start date:', |
stda => 'Start date:', |
enda => 'End date:', |
enda => 'End date:', |
); |
); |
|
$lt{'difn'} = &mt('Different collaborative tools[_1]for different members:','<br />'); |
my $showstart = &Apache::lonlocal::locallocaltime($startdate); |
my $showstart = &Apache::lonlocal::locallocaltime($startdate); |
my $showend; |
my $showend; |
if ($enddate == 0) { |
if ($enddate == 0) { |
Line 2231 sub privilege_specificity {
|
Line 2259 sub privilege_specificity {
|
"for users who receive specific sections/roles in the course ", |
"for users who receive specific sections/roles in the course ", |
'asyo' => "As you have chosen not to include any collaborative tools ". |
'asyo' => "As you have chosen not to include any collaborative tools ". |
"in the group, no default optional privileges need to be set.", |
"in the group, no default optional privileges need to be set.", |
'plin' => 'Indicate which <b>optional</b> privileges members '. |
|
'will receive by default for a specific tool.', |
'will receive by default for a specific tool.', |
'oppr' => 'Optional privileges', |
'oppr' => 'Optional privileges', |
'defp' => 'The default privileges new members will receive are:', |
'defp' => 'The default privileges new members will receive are:', |
); |
); |
|
$lt{'plin'} = &mt('Indicate which [_1]optional[_2] privileges members '. |
|
'will receive by default for a specific tool.','<b>','</b>'); |
if ($crstype eq 'Community') { |
if ($crstype eq 'Community') { |
$lt{'thes'} = &mt('These will be the privileges given to members assigned in the future via automatic group assignment for users who receive specific sections/roles in the community '); |
$lt{'thes'} = &mt('These will be the privileges given to members assigned in the future via automatic group assignment for users who receive specific sections/roles in the community '); |
} |
} |
Line 3244 sub write_group_data {
|
Line 3273 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 3352 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 3532 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 $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 3554 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 3574 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 4003 sub map_updater {
|
Line 4039 sub map_updater {
|
$LONCAPA::map::resources[$newidx] = $itemtitle.':'.$newmapurl. |
$LONCAPA::map::resources[$newidx] = $itemtitle.':'.$newmapurl. |
':false:normal:res'; |
':false:normal:res'; |
$LONCAPA::map::order[1+$#LONCAPA::map::order]=$newidx; |
$LONCAPA::map::order[1+$#LONCAPA::map::order]=$newidx; |
my ($outtext,$errtext) = &LONCAPA::map::storemap($parentmap,1); |
my ($outtext,$errtext) = &LONCAPA::map::storemap($parentmap,1,1); |
if ($errtext) { |
if ($errtext) { |
$outcome = '<div class="LC_error">' |
$outcome = '<div class="LC_error">' |
.&mt('Error saving updated parent folder.')." ($parentmap): $errtext" |
.&mt('Error saving updated parent folder.')." ($parentmap): $errtext" |
Line 4173 sub validate_groupname {
|
Line 4209 sub validate_groupname {
|
} |
} |
if ($action eq 'create') { |
if ($action eq 'create') { |
if (exists($curr_groups{$groupname})) { |
if (exists($curr_groups{$groupname})) { |
return $exitmsg.$lt{'cnnb'}.&mt('an existing [_1]',$gpterm). |
return $exitmsg.$lt{'cnnb'}.&mt("an existing $gpterm"). |
$lt{'inth'}.'.<br />'.$lt{'grna'}; |
$lt{'inth'}.'.<br />'.$lt{'grna'}; |
} elsif (exists($deleted_groups{$groupname})) { |
} elsif (exists($deleted_groups{$groupname})) { |
return $exitmsg.$lt{'cnnb'}.&mt('a [_1] which previously existed',$gpterm). |
return $exitmsg.$lt{'cnnb'}.&mt("a $gpterm which previously existed"). |
$lt{'inth'}.'.<br />'.$lt{'grna'}; |
$lt{'inth'}.'.<br />'.$lt{'grna'}; |
} |
} |
} elsif ($action eq 'modify') { |
} elsif ($action eq 'modify') { |
unless(exists($curr_groups{$groupname})) { |
unless(exists($curr_groups{$groupname})) { |
$earlyout = &mt('[_1] name:',$ucgpterm).' '.$groupname.$lt{'thgr'}. |
$earlyout = &mt("$ucgpterm name:").' '.$groupname.$lt{'thgr'}. |
$lt{'inth'}; |
$lt{'inth'}; |
return $earlyout; |
return $earlyout; |
} |
} |