version 1.5, 2006/02/18 01:27:07
|
version 1.6, 2006/02/21 18:56:00
|
Line 88 sub handler {
|
Line 88 sub handler {
|
\%functions,\%idx,$view_permission, |
\%functions,\%idx,$view_permission, |
$manage_permission,$rowColor1,$rowColor2); |
$manage_permission,$rowColor1,$rowColor2); |
} else { |
} else { |
$r->print('You do not have group administration '. |
$r->print(&mt('You do not have group administration '. |
'privileges in this course'); |
'privileges in this course')); |
} |
} |
} else { |
} else { |
&print_main_menu($r,$cdom,$cnum,$function,$tabcol,\%functions,\%idx, |
&print_main_menu($r,$cdom,$cnum,$function,$tabcol,\%functions,\%idx, |
Line 129 sub display_groups {
|
Line 129 sub display_groups {
|
delete => '<a href="/adm/coursegroups?action=delete&refpage='. |
delete => '<a href="/adm/coursegroups?action=delete&refpage='. |
$env{'form.refpage'}.'&groupname=', |
$env{'form.refpage'}.'&groupname=', |
); |
); |
my %actiontext = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
modify => 'Modify', |
modify => 'Modify', |
view => 'View', |
view => 'View', |
delete => 'Delete', |
delete => 'Delete', |
|
act => 'Action', |
|
gname => 'Group Name', |
|
desc => 'Description', |
|
crea => 'Creator', |
|
crtd => 'Created', |
|
last => 'Last Modified', |
|
func => 'Functionality', |
|
quot => 'Quota (Mb)', |
|
memb => 'Members', |
|
file => 'Files', |
|
dibd => 'Discussion Boards', |
|
dius => 'Disk Use', |
); |
); |
$r->print('<br /><br />'); |
$r->print('<br /><br />'); |
if ($view_permission) { |
if ($view_permission) { |
Line 145 sub display_groups {
|
Line 157 sub display_groups {
|
$r->print(<<"END"); |
$r->print(<<"END"); |
<table border="0" cellpadding="4" cellspacing="1"> |
<table border="0" cellpadding="4" cellspacing="1"> |
<tr bgcolor="$tabcol" align="center"> |
<tr bgcolor="$tabcol" align="center"> |
<td><b>Action</b></td> |
<td><b>$lt{'act'}</b></td> |
<td><b><a href="javascript:changeSort('groupname')">Group Name</a></b></td> |
<td><b><a href="javascript:changeSort('groupname')">$lt{'gname'}</a></b></td> |
<td><b><a href="javascript:changeSort('description')">Description</a></b></td> |
<td><b><a href="javascript:changeSort('description')">$lt{'desc'}</a></b></td> |
<td><b><a href="javascript:changeSort('creator')">Creator</a></b> |
<td><b><a href="javascript:changeSort('creator')">$lt{'crea'}</a></b> |
</td> |
</td> |
<td><b><a href="javascript:changeSort('creation')">Created</a></b> |
<td><b><a href="javascript:changeSort('creation')">$lt{'crtd'}</a></b> |
</td> |
</td> |
<td><b><a href="javascript:changeSort('modified')">Last Modified</a></b> |
<td><b><a href="javascript:changeSort('modified')">$lt{'last'}</a></b> |
</td> |
</td> |
<td><b>Functionality</b> |
<td><b>$lt{'func'}</b> |
</td> |
</td> |
<td><b><a href="javascript:changeSort('quota')">Quota (Mb)</a></b></td> |
<td><b><a href="javascript:changeSort('quota')">$lt{'quot'}</a></b></td> |
<td><b><a href="javascript:changeSort('totalmembers)">Members</a></b></td> |
<td><b><a href="javascript:changeSort('totalmembers)">$lt{'memb'}</a></b></td> |
<td><b><a href="javascript:changeSort('totalfiles')">Files</a></b></td> |
<td><b><a href="javascript:changeSort('totalfiles')">$lt{'file'}</a></b></td> |
<td><b><a href="javascript:changeSort('boards')">Discussion boards</a></b></td> |
<td><b><a href="javascript:changeSort('boards')">$lt{'dibd'}</a></b></td> |
<td><b><a href="javascript:changeSort('diskuse')">Disk use</a></b></td> |
<td><b><a href="javascript:changeSort('diskuse')">$lt{'dius'}</a></b></td> |
</tr> |
</tr> |
END |
END |
my %Sortby = (); |
my %Sortby = (); |
Line 218 END
|
Line 230 END
|
my $diskuse = $grp_info{$group}{'diskuse'}; |
my $diskuse = $grp_info{$group}{'diskuse'}; |
my $functionality; |
my $functionality; |
foreach my $tool (sort(keys(%{$functions}))) { |
foreach my $tool (sort(keys(%{$functions}))) { |
if (defined($grp_info{$group}{functions}{$tool})) { |
if ($grp_info{$group}{functions}{$tool} eq 'on') { |
$functionality .= ' '.$tool; |
$functionality .= ' '.$tool; |
} |
} |
} |
} |
if (!$functionality) { |
if (!$functionality) { |
$functionality = 'None available'; |
$functionality = &mt('None available'); |
} |
} |
my $link = $actionlinks{$action}; |
my $link = $actionlinks{$action}; |
if ($action eq 'modify' || $action eq 'delete') { |
if ($action eq 'modify' || $action eq 'delete') { |
Line 231 END
|
Line 243 END
|
} else { |
} else { |
$link .= $group.'/grppg?register=1'; |
$link .= $group.'/grppg?register=1'; |
} |
} |
$link .= '">'.$actiontext{$action}.'</a>'; |
$link .= '">'.$lt{$action}.'</a>'; |
$r->print('<tr bgcolor="'.$rowColor.'"><td><small>'.$link.'</small></td><td><small>'.$group.'</small></td><td><small>'.$description.'</small></td><td><small>'.$creator.'</small></td><td><small>'. &Apache::lonnavmaps::timeToHumanString($creation).'</small></td><td><small>'. &Apache::lonnavmaps::timeToHumanString($modified).'</small></td><td><small>'.$functionality.'</small></td><td><small>'.$quota.'</small></td><td><small>'.$totalmembers.'</small></td><td><small>'.$totalfiles.'</small></td><td><small>'.$boards.'</small></td><td><small>'.$diskuse.'</small></td></tr>'); |
$r->print('<tr bgcolor="'.$rowColor.'"><td><small>'.$link.'</small></td><td><small>'.$group.'</small></td><td><small>'.$description.'</small></td><td><small>'.$creator.'</small></td><td><small>'. &Apache::lonnavmaps::timeToHumanString($creation).'</small></td><td><small>'. &Apache::lonnavmaps::timeToHumanString($modified).'</small></td><td><small>'.$functionality.'</small></td><td><small>'.$quota.'</small></td><td><small>'.$totalmembers.'</small></td><td><small>'.$totalfiles.'</small></td><td><small>'.$boards.'</small></td><td><small>'.$diskuse.'</small></td></tr>'); |
$rowNum ++; |
$rowNum ++; |
} |
} |
Line 256 END
|
Line 268 END
|
} |
} |
} |
} |
} else { |
} else { |
$r->print('You are not currently a member of any active groups in this course'); |
$r->print(&mt('You are not currently a member of any '. |
|
'active groups in this course')); |
} |
} |
} |
} |
return; |
return; |
Line 276 sub group_administration {
|
Line 289 sub group_administration {
|
my %usertools = (); |
my %usertools = (); |
my %stored = (); |
my %stored = (); |
my %memchg; |
my %memchg; |
my @member_changes = ('delete','expire','activate','reenable', |
my @member_changes = ('deletion','expire','activate','reenable', |
'changefunc','changepriv'); |
'changefunc','changepriv'); |
my $state = $env{'form.state'}; |
my $state = $env{'form.state'}; |
my ($groupname,$description,$startdate,$enddate,$granularity,$specificity); |
my ($groupname,$description,$startdate,$enddate,$granularity,$specificity); |
Line 315 sub group_administration {
|
Line 328 sub group_administration {
|
} |
} |
} |
} |
|
|
if (($action eq 'modify') && (($state eq 'change_privs') || ($state eq 'memresult'))) { |
|
foreach my $chg (@member_changes) { |
|
if (defined($env{'form.'.$chg})) { |
|
@{$memchg{$chg}} = &Apache::loncommon::get_env_multiple('form.'.$chg); |
|
} |
|
} |
|
&check_changes(\@member_changes,\%memchg); |
|
foreach my $change (@member_changes) { |
|
if (($change eq 'delete') || ($change eq 'expire')) { |
|
next; |
|
} |
|
foreach my $user (@{$memchg{$change}}) { |
|
%{$usertools{$user}} = (); |
|
} |
|
} |
|
} |
|
|
|
if ($action eq 'modify') { |
if ($action eq 'modify') { |
if ($state eq '') { |
if ($state eq '') { |
$state = 'pick_group'; |
$state = 'pick_group'; |
Line 471 sub group_administration {
|
Line 467 sub group_administration {
|
} |
} |
} |
} |
|
|
if (($state eq 'pick_members') || ($state eq 'pick_privs')) { |
if (($state eq 'pick_members') || ($state eq 'pick_privs') || ($state eq 'change_privs')) { |
&build_members_list($cdom,$cnum,\@types,\@roles, |
&build_members_list($cdom,$cnum,\@types,\@roles,\@sections,\%users, |
\@sections,\%users,\%userdata); |
\%userdata); |
|
} |
|
if ($state eq 'pick_members') { |
if ((keys(%users) > 0) && (@tools > 0)) { |
if ((keys(%users) > 0) && (@tools > 0)) { |
foreach my $tool (@tools) { |
foreach my $tool (@tools) { |
if ($granularity eq 'Yes') { |
if ($granularity eq 'Yes') { |
Line 483 sub group_administration {
|
Line 481 sub group_administration {
|
$elements{$action}{'pick_members'}{'specificity'} = 'radio'; |
$elements{$action}{'pick_members'}{'specificity'} = 'radio'; |
} |
} |
} |
} |
|
if ($state eq 'change_members') { |
|
my %membership = &Apache::lonnet::get_group_membership($cdom,$cnum, |
|
$groupname); |
|
my $now = time; |
|
my $num_expire = 0; |
|
my $num_activate = 0; |
|
my $num_reenable = 0; |
|
my $num_deletion = 0; |
|
my $numusers = 0; |
|
foreach my $key (sort(keys(%membership))) { |
|
if ($key =~ /^\Q$groupname\E:([^:]+:[^:]+)$/) { |
|
my $user = $1; |
|
my($end,$start,@userprivs) = split(/:/,$membership{$key}); |
|
unless ($start == -1) { |
|
$numusers ++; |
|
$num_deletion ++; |
|
if (($end > 0) && ($end < $now)) { |
|
$num_reenable ++; |
|
next; |
|
} elsif (($start > $now)) { |
|
$num_activate = 1; |
|
next; |
|
} else { |
|
$num_expire ++; |
|
next; |
|
} |
|
next; |
|
} |
|
if ($num_reenable && $num_activate && $num_expire) { |
|
last; |
|
} |
|
} |
|
} |
|
if ($num_deletion) { |
|
$elements{$action}{'change_members'}{'deletion'} = 'checkbox'; |
|
} |
|
if ($num_expire) { |
|
$elements{$action}{'change_members'}{'expire'} = 'checkbox'; |
|
} |
|
if ($num_activate) { |
|
$elements{$action}{'change_members'}{'activate'} = 'checkbox'; |
|
} |
|
if ($num_reenable) { |
|
$elements{$action}{'change_members'}{'reenable'} = 'checkbox'; |
|
} |
|
if ($numusers) { |
|
foreach my $tool (@tools) { |
|
if ($granularity eq 'Yes') { |
|
$elements{$action}{'change_members'}{'user_'.$tool} = 'checkbox'; |
|
} |
|
} |
|
if ($specificity eq 'Yes') { |
|
$elements{$action}{'change_members'}{'changepriv'} = 'checkbox'; |
|
} |
|
} |
|
} |
|
|
if (($state eq 'pick_privs') || ($state eq 'change_privs') || |
if (($state eq 'pick_privs') || ($state eq 'change_privs') || |
(($specificity eq 'No') && |
(($specificity eq 'No') && |
Line 495 sub group_administration {
|
Line 549 sub group_administration {
|
} |
} |
} |
} |
} |
} |
if ((($state eq 'pick_privs') || ($state eq 'change_privs')) |
} |
&& ($specificity eq 'Yes')) { |
|
foreach my $user (sort(keys(%usertools))) { |
if (($action eq 'modify') && (($state eq 'change_privs') || ($state eq 'memresult'))) { |
foreach my $tool (keys(%{$usertools{$user}})) { |
foreach my $chg (@member_changes) { |
foreach my $priv (keys(%{$toolprivs{$tool}})) { |
if (defined($env{'form.'.$chg})) { |
unless (exists($fixedprivs{$tool}{$priv})) { |
@{$memchg{$chg}} = &Apache::loncommon::get_env_multiple('form.'.$chg); |
$elements{$action}{$state}{'userpriv_'.$priv} = 'checkbox'; |
} |
|
} |
|
|
|
if ($state eq 'change_privs') { |
|
my %membership = &Apache::lonnet::get_group_membership($cdom,$cnum, |
|
$groupname); |
|
my $now = time; |
|
foreach my $key (sort(keys(%membership))) { |
|
if ($key =~ /^\Q$groupname\E:([^:]+:[^:]+)$/) { |
|
my $user = $1; |
|
my $changefunc = 0; |
|
my ($end,$start,@userprivs) = split(/:/,$membership{$key}); |
|
unless ($start == -1) { |
|
if (($end > 0) && ($end < $now)) { |
|
unless (grep/^$user$/,$memchg{'reenable'}) { |
|
next; |
|
} |
|
} |
|
my @currtools = (); |
|
if (@userprivs > 0) { |
|
foreach my $tool (sort(keys(%fixedprivs))) { |
|
foreach my $priv (keys(%{$fixedprivs{$tool}})) { |
|
if (grep/^$priv$/,@userprivs) { |
|
push(@currtools,$tool); |
|
last; |
|
} |
|
} |
|
} |
|
} |
|
foreach my $tool (@currtools) { |
|
if (keys(%{$usertools{$user}}) > 0) { |
|
if (!$usertools{$user}{$tool}) { |
|
push(@{$memchg{'changefunc'}},$user); |
|
$changefunc = 1; |
|
last; |
|
} |
|
} else { |
|
push(@{$memchg{'changefunc'}},$user); |
|
$changefunc = 1; |
|
} |
|
} |
|
if ($changefunc) { |
|
next; |
|
} |
|
if (keys(%{$usertools{$user}}) > 0) { |
|
foreach my $tool (keys(%{$usertools{$user}})) { |
|
if (!grep/^$tool$/,@currtools) { |
|
push(@{$memchg{'changefunc'}},$user); |
|
$changefunc = 1; |
|
last; |
|
} |
|
} |
} |
} |
} |
} |
} |
} |
} |
} |
|
&check_changes(\@member_changes,\%memchg); |
|
my %temptools; |
|
foreach my $change (@member_changes) { |
|
if (($change eq 'deletion') || ($change eq 'expire')) { |
|
next; |
|
} |
|
foreach my $user (@{$memchg{$change}}) { |
|
unless (exists($usertools{$user})) { |
|
%{$usertools{$user}} = (); |
|
} |
|
%{$temptools{$user}} = %{$usertools{$user}}; |
|
} |
|
} |
|
%usertools = %temptools; |
|
} elsif ($state eq 'memresult') { |
|
foreach my $change (@member_changes) { |
|
if ($change eq 'expire' || $change eq 'deletion') { |
|
next; |
|
} |
|
if (ref($memchg{$change}) eq 'ARRAY') { |
|
my @users = @{$memchg{$change}}; |
|
foreach my $user (@users) { |
|
unless (exists($usertools{$user})) { |
|
%{$usertools{$user}} = (); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
if ((($state eq 'pick_privs') || ($state eq 'change_privs')) |
|
&& ($specificity eq 'Yes')) { |
|
foreach my $user (sort(keys(%usertools))) { |
|
foreach my $tool (keys(%{$usertools{$user}})) { |
|
foreach my $priv (keys(%{$toolprivs{$tool}})) { |
|
unless (exists($fixedprivs{$tool}{$priv})) { |
|
$elements{$action}{$state}{'userpriv_'.$priv} = 'checkbox'; |
|
} |
|
} |
|
} |
} |
} |
} |
} |
|
|
Line 519 function backPage(formname,prevstate) {
|
Line 665 function backPage(formname,prevstate) {
|
formname.state.value = prevstate; |
formname.state.value = prevstate; |
formname.submit(); |
formname.submit(); |
} |
} |
|
function changeSort(caller) { |
|
document.$state.state.value = '$state'; |
|
document.$state.sortby.value = caller; |
|
document.$state.submit(); |
|
} |
|
|
|; |
|; |
$jscript .= &Apache::lonhtmlcommon::set_form_elements( |
$jscript .= &Apache::lonhtmlcommon::set_form_elements( |
Line 767 sub display_control {
|
Line 918 sub display_control {
|
$startdate,$enddate,$tools,$functions, |
$startdate,$enddate,$tools,$functions, |
$toolprivs,$fixedprivs,$userdata,$usertools, |
$toolprivs,$fixedprivs,$userdata,$usertools, |
$memchg,$idx,$states,$stored,$sectioncount, |
$memchg,$idx,$states,$stored,$sectioncount, |
$navbuttons,$rowColor1,$rowColor2) = @_; |
$navbuttons,$rowColor1,$rowColor2); |
} elsif ($state eq 'chgresult' || $state eq 'memresult' || |
} elsif ($state eq 'chgresult' || $state eq 'memresult' || |
$state eq 'addresult') { |
$state eq 'addresult') { |
&process_request($r,$cdom,$cnum,$tabcol,$action,$state,$page, |
&process_request($r,$cdom,$cnum,$tabcol,$action,$state,$page, |
Line 829 sub onload_action {
|
Line 980 sub onload_action {
|
|
|
sub footer { |
sub footer { |
return(<<ENDFOOT); |
return(<<ENDFOOT); |
|
<input type="hidden" name="sortby" value="$env{'form.sortby'}" /> |
</form> |
</form> |
</body> |
</body> |
</html> |
</html> |
Line 870 sub group_members {
|
Line 1022 sub group_members {
|
foreach my $member (keys %memberhash) { |
foreach my $member (keys %memberhash) { |
$totalmembers ++; |
$totalmembers ++; |
my ($end,$start) = split(/:/,$memberhash{$member}); |
my ($end,$start) = split(/:/,$memberhash{$member}); |
if (($end!=0) && ($end<$now)) { |
unless ($start == -1) { |
$previous ++; |
if (($end!=0) && ($end<$now)) { |
} elsif (($start!=0) && ($start>$now)) { |
$previous ++; |
$future ++; |
} elsif (($start!=0) && ($start>$now)) { |
} else { |
$future ++; |
$active ++; |
} else { |
|
$active ++; |
|
} |
} |
} |
} |
} |
if ($totalmembers == 0) { |
if ($totalmembers == 0) { |
Line 1030 sub membership_options {
|
Line 1184 sub membership_options {
|
'picr' => 'Pick the criteria to use to build a list of '. |
'picr' => 'Pick the criteria to use to build a list of '. |
'course users from which you will select ', |
'course users from which you will select ', |
'meof' => 'members of the new group.', |
'meof' => 'members of the new group.', |
'adme' => 'additional members of the group.', |
'admg' => 'additional members of the group.', |
'ifno' => 'If you do not wish to add members when you first '. |
'ifno' => 'If you do not wish to add members when you first '. |
'create the group, do not make any selections', |
'create the group, do not make any selections', |
'acty' => 'Access types', |
'acty' => 'Access types', |
Line 1056 sub membership_options {
|
Line 1210 sub membership_options {
|
if ($action eq 'create') { |
if ($action eq 'create') { |
$r->print($lt{'meof'}.'<br />'.$lt{'ifno'}); |
$r->print($lt{'meof'}.'<br />'.$lt{'ifno'}); |
} else { |
} else { |
$r->print($lt{'adme'}); |
$r->print($lt{'admg'}); |
} |
} |
$r->print(' |
$r->print(' |
<br /> |
<br /> |
Line 1155 sub choose_members_form {
|
Line 1309 sub choose_members_form {
|
my %origmembers; |
my %origmembers; |
$r->print(&Apache::lonhtmlcommon::echo_form_input( |
$r->print(&Apache::lonhtmlcommon::echo_form_input( |
['origin','action','state','page','member','specificity','branch', |
['origin','action','state','page','member','specificity','branch', |
'defpriv','autorole','autoadd','autodrop'], |
'defpriv','autorole','autoadd','autodrop','sortby'], |
\@regexps)); |
\@regexps)); |
my $earlyout = &validate_groupname($groupname,$action,$cdom,$cnum); |
my $earlyout = &validate_groupname($groupname,$action,$cdom,$cnum); |
$r->print(' |
$r->print(' |
Line 1189 sub choose_members_form {
|
Line 1343 sub choose_members_form {
|
$groupname); |
$groupname); |
foreach my $key (sort(keys(%membership))) { |
foreach my $key (sort(keys(%membership))) { |
if ($key =~ /^\Q$groupname\E:([^:]+):([^:]+)$/) { |
if ($key =~ /^\Q$groupname\E:([^:]+):([^:]+)$/) { |
my $uname = $1; |
my ($end,$start,@userprivs) = split(/:/,$membership{$key}); |
my $udom = $2; |
unless ($start == -1) { |
my $user = $uname.':'.$udom; |
my $uname = $1; |
$origmembers{$user} = 1; |
my $udom = $2; |
|
my $user = $uname.':'.$udom; |
|
$origmembers{$user} = 1; |
|
} |
} |
} |
} |
} |
} |
} |
Line 1824 sub change_members_form {
|
Line 1981 sub change_members_form {
|
); |
); |
my @regexps = ('user_','userpriv_'); |
my @regexps = ('user_','userpriv_'); |
$r->print(&Apache::lonhtmlcommon::echo_form_input( |
$r->print(&Apache::lonhtmlcommon::echo_form_input( |
['origin','action','state','page','expire','delete', |
['origin','action','state','page','expire','deletion', |
'changefunc','changepriv'],\@regexps)); |
'reenable','activate','changepriv','sortby'], |
|
\@regexps)); |
my $rowimg = 1; |
my $rowimg = 1; |
my @available = (); |
my @available = (); |
my @unavailable = (); |
my @unavailable = (); |
Line 1869 sub current_membership {
|
Line 2027 sub current_membership {
|
my %membership = &Apache::lonnet::get_group_membership($cdom,$cnum, |
my %membership = &Apache::lonnet::get_group_membership($cdom,$cnum, |
$groupname); |
$groupname); |
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
|
'actn' => 'Action?', |
|
'name' => 'Name', |
|
'usnm' => 'Username', |
|
'doma' => 'Domain', |
|
'stda' => 'Start Date', |
|
'enda' => 'End Date', |
'expi' => 'Expire', |
'expi' => 'Expire', |
'reen' => 'Re-enable', |
'reen' => 'Re-enable', |
'acti' => 'Activate', |
'acti' => 'Activate', |
'dele' => 'Delete', |
'dele' => 'Delete', |
'curf' => 'Current Functionality', |
'curf' => 'Current Functionality', |
'chfn' => 'Change Functions', |
|
'chpr' => 'Change Privileges' |
'chpr' => 'Change Privileges' |
); |
); |
if (keys(%membership) > 0) { |
if (keys(%membership) > 0) { |
Line 1976 sub current_membership {
|
Line 2139 sub current_membership {
|
if ($num_activate) { |
if ($num_activate) { |
&check_uncheck_buttons($r,$formname,'activate',$lt{'acti'}); |
&check_uncheck_buttons($r,$formname,'activate',$lt{'acti'}); |
} |
} |
&check_uncheck_buttons($r,$formname,'delete',$lt{'dele'}); |
&check_uncheck_buttons($r,$formname,'deletion',$lt{'dele'}); |
if (@{$available} > 0) { |
if (@{$available} > 0) { |
if ($granularity eq 'Yes') { |
|
&check_uncheck_buttons($r,$formname,'changefunc',$lt{'chfn'}); |
|
} |
|
if ($specificity eq 'Yes') { |
if ($specificity eq 'Yes') { |
&check_uncheck_buttons($r,$formname,'changepriv',$lt{'chpr'}); |
&check_uncheck_buttons($r,$formname,'changepriv',$lt{'chpr'}); |
} |
} |
Line 2018 END
|
Line 2178 END
|
$r->print(<<"END"); |
$r->print(<<"END"); |
<table border="0" cellpadding="4" cellspacing="1"> |
<table border="0" cellpadding="4" cellspacing="1"> |
<tr bgcolor="$tabcol" align="center"> |
<tr bgcolor="$tabcol" align="center"> |
<td><b>Action?</b></td> |
<td><b>$lt{'actn'}</b></td> |
<td><b><a href="javascript:changeSort('fullname')">Name</a></b></td> |
<td><b><a href="javascript:changeSort('fullname')">$lt{'name'}</a></b></td> |
<td><b><a href="javascript:changeSort('username')">Username</a></b> |
<td><b><a href="javascript:changeSort('username')">$lt{'usnm'}</a></b> |
</td> |
</td> |
<td><b><a href="javascript:changeSort('domain')">Domain</a></b></td> |
<td><b><a href="javascript:changeSort('domain')">$lt{'doma'}</a></b></td> |
<td><b><a href="javascript:changeSort('id')">ID</a></b></td> |
<td><b><a href="javascript:changeSort('id')">ID</a></b></td> |
<td><b><a href="javascript:changeSort('start')">Start Date</a></b></td> |
<td><b><a href="javascript:changeSort('start')">$lt{'stda'}</a></b></td> |
<td><b><a href="javascript:changeSort('end')">End Date</a></b></td> |
<td><b><a href="javascript:changeSort('end')">$lt{'enda'}</a></b></td> |
END |
END |
|
my $colspan = 0; |
if ($hastools) { |
if ($hastools) { |
$r->print('<td><b>'.$lt{'curf'}.'</b></td>'); |
$r->print('<td><b>'.$lt{'curf'}.'</b></td>'); |
|
$colspan ++; |
} |
} |
if ($addtools) { |
if ($addtools) { |
$r->print('<td><b>Additional Functionality</b></td>'); |
$r->print('<td><b>Additional Functionality</b></td>'); |
|
$colspan ++; |
} |
} |
$r->print('</tr>'); |
$r->print('</tr>'); |
|
if ($colspan) { |
|
if ($granularity eq 'Yes') { |
|
$r->print('<tr bgcolor="#cccccc"> |
|
<td colspan="7"> </td> |
|
<td colspan="'.$colspan.'" align="center"><small><nobr><b>'.&mt('All:'). |
|
'</b> '); |
|
foreach my $tool (@{$available}) { |
|
$r->print('<input type="checkbox" name="togglefunc" '. |
|
'onclick="javascript:toggleTools(document.'.$formname.'.user_'.$tool.',this);">'. |
|
'<b>'.$tool.'</b> '); |
|
} |
|
$r->print('</nobr></small></td></tr>'); |
|
} |
|
} |
my %Sortby = (); |
my %Sortby = (); |
foreach my $user (sort(keys(%current))) { |
foreach my $user (sort(keys(%current))) { |
if ($env{'form.sortby'} eq 'fullname') { |
if ($env{'form.sortby'} eq 'fullname') { |
Line 2079 END
|
Line 2256 END
|
$lt{'acti'}.'</nobr><br />'); |
$lt{'acti'}.'</nobr><br />'); |
} |
} |
$r->print('<nobr>'. |
$r->print('<nobr>'. |
'<input type="checkbox" name="delete" value="'.$user.'" />'. |
'<input type="checkbox" name="deletion" value="'.$user.'" />'. |
$lt{'dele'}.'</nobr>'); |
$lt{'dele'}.'</nobr>'); |
if ($granularity eq 'Yes') { |
|
$r->print('<br /><nobr>'. |
|
'<input type="checkbox" name="changefunc" value="'.$user.'" />'.$lt{'chfn'}. |
|
'</nobr>'); |
|
} |
|
if ($specificity eq 'Yes') { |
if ($specificity eq 'Yes') { |
$r->print('<br /><nobr>'. |
$r->print('<br /><nobr>'. |
'<input type="checkbox" name="changepriv" value="'.$user.'" />'.$lt{'chpr'}. |
'<input type="checkbox" name="changepriv" value="'.$user.'" />'.$lt{'chpr'}. |
Line 2098 END
|
Line 2270 END
|
$udom.'</small></td><td><small>'.$id.'</small></td><td><small>'.$start. |
$udom.'</small></td><td><small>'.$id.'</small></td><td><small>'.$start. |
'</small></td><td><small>'.$end.'</small></td>'); |
'</small></td><td><small>'.$end.'</small></td>'); |
if ($hastools) { |
if ($hastools) { |
$r->print('<td align="left"><small><nobr>'); |
$r->print('<td align="left"><small><nobr>'. |
|
' '); |
foreach my $tool (@{$current{$user}{currtools}}) { |
foreach my $tool (@{$current{$user}{currtools}}) { |
if ($granularity eq 'Yes') { |
if ($granularity eq 'Yes') { |
$r->print('<input type="checkbox" |
$r->print('<input type="checkbox" |
Line 2173 sub change_privs_form {
|
Line 2346 sub change_privs_form {
|
$rowColor2) = @_; |
$rowColor2) = @_; |
my @regexps = ('userpriv_'); |
my @regexps = ('userpriv_'); |
my $nexttext; |
my $nexttext; |
|
my %lt = &Apache::lonlocal::texthash( |
|
'tode' => 'To be deleted', |
|
'toex' => 'To be expired', |
|
'nome' => 'No members to be deleted or expired from the group.', |
|
); |
$r->print(&Apache::lonhtmlcommon::echo_form_input( |
$r->print(&Apache::lonhtmlcommon::echo_form_input( |
['origin','action','state','page'],\@regexps)); |
['origin','action','state','page','sortby'],\@regexps)); |
$nexttext = $$navbuttons{'adme'}; |
if ($env{'form.branch'} eq 'adds') { |
|
$nexttext = $$navbuttons{'adme'}; |
|
} else { |
|
$nexttext = $$navbuttons{'mose'}; |
|
} |
$r->print('<br /><table width="100%" cellpadding="0" cellspacing="0" border="0">'); |
$r->print('<br /><table width="100%" cellpadding="0" cellspacing="0" border="0">'); |
|
&topic_bar($r,$tabcol,3,&mt('Members to delete or expire')); |
|
my $exp_or_del = 0; |
|
if (ref($$memchg{'deletion'}) eq 'ARRAY') { |
|
if (@{$$memchg{'deletion'}} > 0) { |
|
$r->print('<tr><td> </td><td colspan="3"><b>'.$lt{'tode'}.':</b><br /><ul>'); |
|
foreach my $user (@{$$memchg{'deletion'}}) { |
|
$r->print('<li>'.$$userdata{$user}[$$idx{fullname}]. |
|
' ('.$user.')</li>'); |
|
} |
|
$r->print('</ul></td><tr><td colspan="4"> </td></tr>'); |
|
$exp_or_del += @{$$memchg{'deletion'}}; |
|
} |
|
} |
|
if (ref($$memchg{'expire'}) eq 'ARRAY') { |
|
if (@{$$memchg{'expire'}} > 0) { |
|
$r->print('<tr><td> </td><td colspan="3"><b>'.$lt{'toex'}.':</b><br /><ul>'); |
|
foreach my $user (@{$$memchg{'expire'}}) { |
|
$r->print('<li>'.$$userdata{$user}[$$idx{fullname}]. |
|
' ('.$user.')</li>'); |
|
} |
|
$r->print('</ul></td><tr><td colspan="4"> </td></tr>'); |
|
$exp_or_del += @{$$memchg{'expire'}}; |
|
} |
|
} |
|
if (!$exp_or_del) { |
|
$r->print('<tr><td> </td><td colspan="3">'.$lt{'nome'}. |
|
'</td></tr><tr><td colspan="4"> </td></tr>'); |
|
} |
|
|
&topic_bar($r,$tabcol,3,&mt('Group member privileges')); |
&topic_bar($r,$tabcol,4,&mt('Group member privileges')); |
|
|
&member_privileges_form($r,$tabcol,$action,$formname,$tools,$toolprivs, |
my $numchgs = &member_privileges_form($r,$tabcol,$action,$formname,$tools, |
$fixedprivs,$userdata,$usertools,$idx,$memchg, |
$toolprivs,$fixedprivs,$userdata, |
$states,$stored,$rowColor1,$rowColor2); |
$usertools,$idx,$memchg,$states, |
|
$stored,$rowColor1,$rowColor2); |
$r->print('</td></tr><tr><td colspan="4"> </td></tr>'); |
$r->print('</td></tr><tr><td colspan="4"> </td></tr>'); |
my $prevtext = $$navbuttons{'gtps'}; |
my $prevtext = $$navbuttons{'gtps'}; |
&display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext, |
if ($numchgs || $exp_or_del) { |
$$states{$action}[$page+1],$nexttext); |
&display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext, |
|
$$states{$action}[$page+1],$nexttext); |
|
} else { |
|
&display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext); |
|
} |
$r->print('</table>'); |
$r->print('</table>'); |
return; |
return; |
} |
} |
Line 2238 sub choose_privs_form {
|
Line 2450 sub choose_privs_form {
|
if ($action eq 'create') { |
if ($action eq 'create') { |
push(@regexps,'sec_'); |
push(@regexps,'sec_'); |
$r->print(&Apache::lonhtmlcommon::echo_form_input( |
$r->print(&Apache::lonhtmlcommon::echo_form_input( |
['origin','action','state','page','autoadd','autodrop'], |
['origin','action','state','page','sortby','autoadd','autodrop'], |
\@regexps)); |
\@regexps)); |
$nexttext = $$navbuttons{'crgr'}; |
$nexttext = $$navbuttons{'crgr'}; |
} else { |
} else { |
$r->print(&Apache::lonhtmlcommon::echo_form_input( |
$r->print(&Apache::lonhtmlcommon::echo_form_input( |
['origin','action','state','page'],\@regexps)); |
['origin','action','state','page','sortby'],\@regexps)); |
$nexttext = $$navbuttons{'adme'}; |
$nexttext = $$navbuttons{'adme'}; |
} |
} |
|
|
Line 2273 sub choose_privs_form {
|
Line 2485 sub choose_privs_form {
|
|
|
sub build_boxes { |
sub build_boxes { |
my ($r,$tools,$usertools,$fixedprivs,$toolprivs,$showtools, |
my ($r,$tools,$usertools,$fixedprivs,$toolprivs,$showtools, |
$showboxes,$prefix,$specificity) = @_; |
$showboxes,$prefix,$specificity,$excluded) = @_; |
my $totalboxes = 0; |
my $totalboxes = 0; |
if (@{$tools} > 0) { |
if (@{$tools} > 0) { |
if ($specificity eq 'Yes') { |
if ($specificity eq 'Yes') { |
foreach my $tool (@{$tools}) { |
foreach my $tool (@{$tools}) { |
@{$$showboxes{$tool}} = (); |
@{$$showboxes{$tool}} = (); |
foreach my $user (sort(keys(%{$usertools}))) { |
foreach my $user (sort(keys(%{$usertools}))) { |
unless (grep/^$tool$/,@{$showtools}) { |
if (ref($excluded) eq 'ARRAY') { |
push(@{$showtools},$tool); |
if (grep/^$user$/,@{$excluded}) { |
|
next; |
|
} |
} |
} |
foreach my $priv (sort(keys(%{$$toolprivs{$tool}}))) { |
if ($$usertools{$user}{$tool}) { |
unless (exists($$fixedprivs{$tool}{$priv})) { |
unless (grep/^$tool$/,@{$showtools}) { |
unless(grep(/^$priv$/,@{$$showboxes{$tool}})) { |
push(@{$showtools},$tool); |
push(@{$$showboxes{$tool}},$priv); |
} |
$totalboxes ++; |
foreach my $priv (sort(keys(%{$$toolprivs{$tool}}))) { |
|
unless (exists($$fixedprivs{$tool}{$priv})) { |
|
unless(grep(/^$priv$/,@{$$showboxes{$tool}})) { |
|
push(@{$$showboxes{$tool}},$priv); |
|
$totalboxes ++; |
|
} |
} |
} |
} |
} |
} |
} |
Line 2338 sub member_privileges_form {
|
Line 2557 sub member_privileges_form {
|
'there are no specific user privileges to set.', |
'there are no specific user privileges to set.', |
'asng' => 'As no group tools will be made available to users, '. |
'asng' => 'As no group tools will be made available to users, '. |
'there are no specific user privileges to set.', |
'there are no specific user privileges to set.', |
|
'nogm' => 'No group member privileges to display or set, '. |
|
'as you have not indicated that you will be activating,'. |
|
' re-enabling, changing privileges, or adding/removing '. |
|
'functionality for any current members ', |
'full' => 'Fullname', |
'full' => 'Fullname', |
'user' => 'Username', |
'user' => 'Username', |
'doma' => 'Domain', |
'doma' => 'Domain', |
Line 2355 sub member_privileges_form {
|
Line 2578 sub member_privileges_form {
|
} |
} |
my @showtools; |
my @showtools; |
my %showboxes = (); |
my %showboxes = (); |
my $totalboxes = 0; |
|
my $numtools = 1 + @{$tools}; |
my $numtools = 1 + @{$tools}; |
|
|
$totalboxes = &build_boxes($r,$tools,$usertools,$fixedprivs,$toolprivs, |
my @excluded = (); |
\@showtools,\%showboxes,'userpriv_', |
my $numchgs = 0; |
$specificity); |
if ($formname eq 'change_privs') { |
|
my @currmembers = (); |
|
if (ref($$memchg{'deletion'}) eq 'ARRAY') { |
|
push(@excluded,@{$$memchg{'deletion'}}); |
|
} |
|
if (ref($$memchg{'expire'}) eq 'ARRAY') { |
|
push(@excluded,@{$$memchg{'expire'}}); |
|
} |
|
if (@excluded > 0) { |
|
foreach my $user (sort(keys(%{$usertools}))) { |
|
if (grep/^$user$/,@excluded) { |
|
next; |
|
} |
|
push(@currmembers,$user); |
|
} |
|
} else { |
|
@currmembers = sort(keys(%{$usertools})); |
|
} |
|
$numchgs = @currmembers; |
|
if (!$numchgs) { |
|
$r->print('<tr><td> </td><td colspan="3">'.$lt{'nogm'}); |
|
return $numchgs; |
|
} |
|
} |
|
|
|
my $totalboxes = &build_boxes($r,$tools,$usertools,$fixedprivs, |
|
$toolprivs,\@showtools,\%showboxes, |
|
'userpriv_',$specificity,\@excluded); |
if (@{$tools} > 0) { |
if (@{$tools} > 0) { |
if ($specificity eq 'Yes') { |
if ($specificity eq 'Yes') { |
if ($totalboxes > 0) { |
if ($totalboxes > 0) { |
my $numcells = 2; |
my $numcells = 2; |
my $colspan = $numcells + 1; |
my $colspan = $numcells + 1; |
my %total; |
my %total; |
$r->print(' |
if (keys(%{$usertools}) > 1) { |
|
$r->print(' |
<tr> |
<tr> |
<td> </td> |
<td> </td> |
<td colspan="3"> |
<td colspan="3"> |
<table border="0" cellspacing="2" cellpadding="2" border="0"> |
<table border="0" cellspacing="2" cellpadding="2" border="0"> |
<tr> |
<tr> |
'); |
'); |
foreach my $tool (@{$tools}) { |
foreach my $tool (@{$tools}) { |
if (@{$showboxes{$tool}} > 0) { |
if (@{$showboxes{$tool}} > 0) { |
$r->print('<td valign="top">'); |
$r->print('<td valign="top">'); |
$r->print('<table class="thinborder"><tr bgcolor="'.$tabcol. |
$r->print('<table class="thinborder"><tr bgcolor="'. |
'"><th colspan="'.$colspan.'">'.$tool.'</th></tr><tr>'); |
$tabcol.'"><th colspan="'.$colspan.'">'. |
my $privcount = 0; |
$tool.'</th></tr><tr>'); |
foreach my $priv (@{$showboxes{$tool}}) { |
my $privcount = 0; |
$privcount ++; |
foreach my $priv (@{$showboxes{$tool}}) { |
if (($privcount == @{$showboxes{$tool}}) && ($privcount > 1)) { |
$privcount ++; |
if ($privcount%$numcells) { |
if (($privcount == @{$showboxes{$tool}}) && |
$r->print('<td colspan="'.$colspan.'">'); |
($privcount > 1)) { |
|
if ($privcount%$numcells) { |
|
$r->print('<td colspan="'.$colspan.'">'); |
|
} else { |
|
$r->print('<td>'); |
|
} |
} else { |
} else { |
$r->print('<td>'); |
$r->print('<td>'); |
} |
} |
} else { |
$r->print(qq| |
$r->print('<td>'); |
|
} |
|
$r->print(qq| |
|
<fieldset><legend><b>$$toolprivs{$tool}{$priv}</b></legend> |
<fieldset><legend><b>$$toolprivs{$tool}{$priv}</b></legend> |
<nobr> |
<nobr> |
<input type="button" value="check all" |
<input type="button" value="check all" |
Line 2400 sub member_privileges_form {
|
Line 2652 sub member_privileges_form {
|
<input type="button" value="uncheck all" |
<input type="button" value="uncheck all" |
onclick="javascript:uncheckAll(document.$formname.userpriv_$priv)" /> |
onclick="javascript:uncheckAll(document.$formname.userpriv_$priv)" /> |
</nobr></fieldset><br />|); |
</nobr></fieldset><br />|); |
$r->print('</td>'); |
$r->print('</td>'); |
if ($privcount < @{$showboxes{$tool}}) { |
if ($privcount < @{$showboxes{$tool}}) { |
if (@{$showboxes{$tool}} > 2) { |
if (@{$showboxes{$tool}} > 2) { |
if ($privcount%$numcells == 0) { |
if ($privcount%$numcells == 0) { |
$r->print('</tr><tr>'); |
$r->print('</tr><tr>'); |
|
} |
|
} else { |
|
$r->print('<tr></tr>'); |
} |
} |
} else { |
|
$r->print('<tr></tr>'); |
|
} |
} |
} |
} |
|
$r->print('</tr></table></td><td> </td>'); |
} |
} |
$r->print('</tr></table></td><td> </td>'); |
|
} |
} |
|
$r->print('</tr></table></td></tr>'); |
|
$r->print('<tr><td colspan="4"> </td></tr>'); |
} |
} |
$r->print('</tr></table></td></tr>'); |
$r->print('<tr><td> </td><td colspan="3">'); |
$r->print('<tr><td colspan="4"> </td></tr><tr><td> </td><td colspan="3">'); |
|
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(<<"END"); |
$r->print(<<"END"); |
<tr bgcolor="$tabcol"> |
<tr bgcolor="$tabcol"> |
Line 2427 sub member_privileges_form {
|
Line 2681 sub member_privileges_form {
|
END |
END |
&member_privs_entries($r,$tabcol,$rowColor1,$rowColor2, |
&member_privs_entries($r,$tabcol,$rowColor1,$rowColor2, |
$usertools,$toolprivs,$fixedprivs, |
$usertools,$toolprivs,$fixedprivs, |
$userdata,$idx,\@showtools,\@defprivs); |
$userdata,$idx,\@showtools,\@defprivs, |
|
\@excluded); |
$r->print('</td>'); |
$r->print('</td>'); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print('</td></tr> |
$r->print('</td></tr> |
Line 2456 END
|
Line 2711 END
|
} else { |
} else { |
$r->print('<tr><td> </td><td colspan="3">'.$lt{'asng'}); |
$r->print('<tr><td> </td><td colspan="3">'.$lt{'asng'}); |
} |
} |
return; |
return $numchgs; |
} |
} |
|
|
sub process_request { |
sub process_request { |
Line 2466 sub process_request {
|
Line 2721 sub process_request {
|
$sectioncount,$stored,$rowColor1,$rowColor2) = @_; |
$sectioncount,$stored,$rowColor1,$rowColor2) = @_; |
|
|
$r->print(&Apache::lonhtmlcommon::echo_form_input( |
$r->print(&Apache::lonhtmlcommon::echo_form_input( |
['origin','action','state','page'])); |
['origin','action','state','page','sortby'])); |
|
|
my $earlyout = &validate_groupname($groupname,$action,$cdom,$cnum); |
my $earlyout = &validate_groupname($groupname,$action,$cdom,$cnum); |
if ($earlyout) { |
if ($earlyout) { |
Line 2516 sub process_request {
|
Line 2771 sub process_request {
|
} |
} |
if (($action eq 'create' && $outcome eq 'ok') || (($action eq 'modify') && |
if (($action eq 'create' && $outcome eq 'ok') || (($action eq 'modify') && |
(($state eq 'memresult') || ($state eq 'addresult')))) { |
(($state eq 'memresult') || ($state eq 'addresult')))) { |
&process_membership($r,$cdom,$cnum,$groupname,$tools,$enddate, |
&process_membership($r,$cdom,$cnum,$action,$state,$groupname,$tools, |
$startdate,$userdata,$idx,$toolprivs,$usertools, |
$enddate,$startdate,$userdata,$idx,$toolprivs, |
$specificity,\@defprivs); |
$usertools,$specificity,\@defprivs,$memchg); |
} |
} |
return; |
return; |
} |
} |
Line 2621 sub write_group_data {
|
Line 2876 sub write_group_data {
|
} |
} |
|
|
sub process_membership { |
sub process_membership { |
my ($r,$cdom,$cnum,$groupname,$tools,$enddate,$startdate,$userdata,$idx, |
my ($r,$cdom,$cnum,$action,$state,$groupname,$tools,$enddate,$startdate, |
$toolprivs,$usertools,$specificity,$defprivs) = @_; |
$userdata,$idx,$toolprivs,$usertools,$specificity,$defprivs,$memchg)=@_; |
my %usersettings = (); |
my %usersettings = (); |
my @added= (); |
my %added= (); |
my @failed = (); |
my %failed = (); |
|
my $num_ok = 0; |
|
my $num_fail = 0; |
my %group_privs = (); |
my %group_privs = (); |
my %tooltype = (); |
my %tooltype = (); |
|
|
Line 2655 sub process_membership {
|
Line 2912 sub process_membership {
|
$group_privs{$user} =~ s/:$//; |
$group_privs{$user} =~ s/:$//; |
} |
} |
|
|
|
my $now = time; |
|
my @activate = (); |
|
my @expire = (); |
|
my @deletion = (); |
|
my @reenable = (); |
|
if ($state eq 'memresult') { |
|
if (ref($$memchg{'activate'}) eq 'ARRAY') { |
|
@activate = @{$$memchg{'activate'}}; |
|
} |
|
if (ref($$memchg{'expire'}) eq 'ARRAY') { |
|
@expire = @{$$memchg{'expire'}}; |
|
} |
|
if (ref($$memchg{'deletion'}) eq 'ARRAY') { |
|
@deletion = @{$$memchg{'deletion'}}; |
|
} |
|
if (ref($$memchg{'reenable'}) eq 'ARRAY') { |
|
@reenable = @{$$memchg{'reenable'}}; |
|
} |
|
if (@expire + @deletion > 0) { |
|
my %membership = &Apache::lonnet::get_group_membership($cdom,$cnum, |
|
$groupname); |
|
foreach my $user (@expire) { |
|
my ($currend,$currstart,@userprivs) = |
|
split(/:/,$membership{$groupname.':'.$user}); |
|
$group_privs{$user} = join(':',@userprivs); |
|
if ($currstart > $now) { |
|
$currstart = $now; |
|
} |
|
$usersettings{$groupname.':'.$user} = $now.':'.$currstart.':'. |
|
$group_privs{$user}; |
|
if (&Apache::lonnet::modify_group_roles($cdom,$cnum,$groupname, |
|
$user,$now,$currstart, |
|
$group_privs{$user}) eq 'ok') { |
|
push(@{$added{'expired'}},$user); |
|
$num_ok ++; |
|
} else { |
|
push(@{$failed{'expired'}},$user); |
|
$num_fail ++; |
|
} |
|
} |
|
foreach my $user (@deletion) { |
|
$usersettings{$groupname.':'.$user} = $now.':-1:'; |
|
if (&Apache::lonnet::modify_group_roles($cdom,$cnum,$groupname, |
|
$user,$now,'-1','') |
|
eq 'ok') { |
|
push(@{$added{'deleted'}},$user); |
|
$num_ok ++; |
|
} else { |
|
push(@{$failed{'deleted'}},$user); |
|
$num_fail ++; |
|
} |
|
} |
|
} |
|
} |
|
|
foreach my $user (sort(keys(%{$usertools}))) { |
foreach my $user (sort(keys(%{$usertools}))) { |
$usersettings{$groupname.':'.$user} = $enddate.':'.$startdate.':'. |
my $type; |
|
my $start = $startdate; |
|
my $end = $enddate; |
|
if ($state eq 'memresult') { |
|
$type = 'modified'; |
|
if (@activate > 0) { |
|
if (grep/^$user$/,@activate) { |
|
$start = $now; |
|
$type = 'activated'; |
|
} |
|
} |
|
if (@reenable > 0) { |
|
if (grep/^$user$/,@reenable) { |
|
$type = 'reenabled'; |
|
} |
|
} |
|
} else { |
|
$type = 'added'; |
|
} |
|
$usersettings{$groupname.':'.$user} = $end.':'.$start.':'. |
$group_privs{$user}; |
$group_privs{$user}; |
if (&Apache::lonnet::modify_group_roles($cdom,$cnum,$groupname, |
if (&Apache::lonnet::modify_group_roles($cdom,$cnum,$groupname, |
$user,$enddate,$startdate, |
$user,$end,$start, |
$group_privs{$user}) eq 'ok') { |
$group_privs{$user}) eq 'ok') { |
push(@added,$user); |
push(@{$added{$type}},$user); |
|
$num_ok ++; |
} else { |
} else { |
push(@failed,$user); |
push(@{$failed{$type}},$user); |
|
$num_fail ++; |
} |
} |
} |
} |
my $roster_result = &Apache::lonnet::modify_coursegroup_membership($cdom, |
my $roster_result = &Apache::lonnet::modify_coursegroup_membership($cdom, |
$cnum,\%usersettings); |
$cnum,\%usersettings); |
if (@added > 0) { |
if ($num_ok) { |
$r->print('Users were added with following privileges:<br />'); |
foreach my $type (sort(keys(%added))) { |
foreach my $user (@added) { |
$r->print(&mt('The following users were successfully [_1]',$type)); |
my @privs = split(/:/,$group_privs{$user}); |
if ($type eq 'activated' || $type eq 'added' || $type eq 'reenabled') { |
my $privlist= ''; |
$r->print(&mt(' with the following privileges')); |
my $curr_tool = ''; |
} |
foreach my $priv (@privs) { |
$r->print(':<br />'); |
unless ($curr_tool eq $tooltype{$priv}) { |
foreach my $user (@{$added{$type}}) { |
$curr_tool = $tooltype{$priv}; |
my $privlist; |
$privlist .= '<b>'.$curr_tool.'</b>: '; |
if ($type eq 'activated' || $type eq 'added') { |
} |
my @privs = split(/:/,$group_privs{$user}); |
$privlist .= $$toolprivs{$curr_tool}{$priv}.', '; |
my $curr_tool = ''; |
} |
foreach my $priv (@privs) { |
$privlist =~ s/, $//; |
unless ($curr_tool eq $tooltype{$priv}) { |
$r->print($$userdata{$user}[$$idx{fullname}].' - '.$user.': '.$privlist.'<br />'); |
$curr_tool = $tooltype{$priv}; |
} |
$privlist .= '<b>'.$curr_tool.'</b>: '; |
} |
} |
if (@failed > 0) { |
$privlist .= $$toolprivs{$curr_tool}{$priv}.', '; |
$r->print('Addition of the following users was unsuccessful:<br />'); |
} |
foreach my $user (@failed) { |
$privlist =~ s/, $//; |
$r->print($$userdata{$user}[$$idx{fullname}].' - '.$user.'<br />'); |
} |
|
$r->print($$userdata{$user}[$$idx{fullname}].' - '.$user.': '.$privlist.'<br />'); |
|
} |
|
} |
|
} |
|
if ($num_fail) { |
|
foreach my $type (sort(keys(%failed))) { |
|
$r->print(&mt('The following users could not be [_1], because an error occurred:<br />',$type)); |
|
foreach my $user (@{$failed{$type}}) { |
|
$r->print($$userdata{$user}[$$idx{fullname}].' - '.$user.'<br />'); |
|
} |
} |
} |
} |
} |
if ($roster_result eq 'ok') { |
if ($roster_result eq 'ok') { |
Line 2870 sub modify_menu {
|
Line 3213 sub modify_menu {
|
state => 'change_settings', |
state => 'change_settings', |
branch => 'settings', |
branch => 'settings', |
}, |
}, |
{ text => 'Modify access, tools and/or privileges for previous,future'. |
{ text => 'Modify access, tools and/or privileges for previous, '. |
'or current members', |
'future, or current members', |
help => 'Course_Modify_Group_Membership', |
help => 'Course_Modify_Group_Membership', |
state => 'change_members', |
state => 'change_members', |
branch => 'members', |
branch => 'members', |
Line 2899 sub modify_menu {
|
Line 3242 sub modify_menu {
|
|
|
sub member_privs_entries { |
sub member_privs_entries { |
my ($r,$tabcol,$rowColor1,$rowColor2,$usertools,$toolprivs, |
my ($r,$tabcol,$rowColor1,$rowColor2,$usertools,$toolprivs, |
$fixedprivs,$userdata,$idx,$showtools,$defprivs) = @_; |
$fixedprivs,$userdata,$idx,$showtools,$defprivs,$excluded) = @_; |
my $rowColor; |
my $rowColor; |
my $rowNum = 0; |
my $rowNum = 0; |
foreach my $user (sort(keys(%{$usertools}))) { |
foreach my $user (sort(keys(%{$usertools}))) { |
|
if (defined($excluded)) { |
|
if (ref($excluded) eq 'ARRAY') { |
|
if (grep/^$user$/,@{$excluded}) { |
|
next; |
|
} |
|
} |
|
} |
my ($uname,$udom) = split(/:/,$user); |
my ($uname,$udom) = split(/:/,$user); |
if ($rowNum %2 == 1) { |
if ($rowNum %2 == 1) { |
$rowColor = $rowColor1; |
$rowColor = $rowColor1; |
Line 3118 sub check_changes {
|
Line 3468 sub check_changes {
|
@{$exclusions{'changepriv'}} = ('expire','changefunc'); |
@{$exclusions{'changepriv'}} = ('expire','changefunc'); |
|
|
foreach my $change (@{$member_changes}) { |
foreach my $change (@{$member_changes}) { |
if ($change eq 'delete') { |
if ($change eq 'deletion') { |
next; |
next; |
} |
} |
my @checks = ('delete'); |
my @checks = ('deletion'); |
if (exists($exclusions{$change})) { |
if (exists($exclusions{$change})) { |
push(@checks,@{$exclusions{$change}}); |
push(@checks,@{$exclusions{$change}}); |
} |
} |
Line 3129 sub check_changes {
|
Line 3479 sub check_changes {
|
foreach my $item (@{$$memchg{$change}}) { |
foreach my $item (@{$$memchg{$change}}) { |
my $match = 0; |
my $match = 0; |
foreach my $check (@checks) { |
foreach my $check (@checks) { |
if (@{$$memchg{$check}} > 0) { |
if (defined($$memchg{$check})) { |
if (grep/^$item$/,@{$$memchg{$check}}) { |
if (ref(@{$$memchg{$check}}) eq 'ARRAY') { |
$match = 1; |
if (@{$$memchg{$check}} > 0) { |
last; |
if (grep/^$item$/,@{$$memchg{$check}}) { |
|
$match = 1; |
|
last; |
|
} |
|
} |
} |
} |
} |
} |
} |
} |