version 1.19, 2006/05/18 18:35:13
|
version 1.26, 2006/06/27 18:49:14
|
Line 1
|
Line 1
|
|
# The LearningOnline Network with CAPA |
|
# |
|
# $Id$ |
# |
# |
# Copyright Michigan State University Board of Trustees |
# Copyright Michigan State University Board of Trustees |
# |
# |
Line 32 use Apache::lonlocal;
|
Line 35 use Apache::lonlocal;
|
use Apache::lonnavmaps; |
use Apache::lonnavmaps; |
use Apache::longroup; |
use Apache::longroup; |
use Apache::Constants qw(:common :http); |
use Apache::Constants qw(:common :http); |
|
use lib '/home/httpd/lib/perl/'; |
|
use LONCAPA; |
|
|
sub handler { |
sub handler { |
my ($r) = @_; |
my ($r) = @_; |
Line 83 sub handler {
|
Line 88 sub handler {
|
my $rowColor2 = "#eeeeee"; |
my $rowColor2 = "#eeeeee"; |
|
|
my $action = $env{'form.action'}; |
my $action = $env{'form.action'}; |
|
my $state = $env{'form.state'}; |
|
if ((!defined($action)) || ($action eq 'view')) { |
|
if (!defined($state)) { |
|
$state = 'view'; |
|
} |
|
} |
if ($action eq 'create' || $action eq 'modify' || $action eq 'view') { |
if ($action eq 'create' || $action eq 'modify' || $action eq 'view') { |
if ($view_permission || $manage_permission) { |
if ($view_permission || $manage_permission) { |
&group_administration($r,$action,$cdom,$cnum,$function,$tabcol, |
&group_administration($r,$action,$state,$cdom,$cnum,$function, |
\%functions,\%idx,$view_permission, |
$tabcol,\%functions,\%idx,$view_permission, |
$manage_permission,$rowColor1,$rowColor2); |
$manage_permission,$rowColor1,$rowColor2); |
} else { |
} else { |
$r->print(&mt('You do not have group administration '. |
$r->print(&mt('You do not have group administration '. |
Line 94 sub handler {
|
Line 105 sub handler {
|
} |
} |
} else { |
} else { |
&print_main_menu($r,$cdom,$cnum,$function,$tabcol,\%functions,\%idx, |
&print_main_menu($r,$cdom,$cnum,$function,$tabcol,\%functions,\%idx, |
$view_permission,$manage_permission,$action, |
$view_permission,$manage_permission,$action,$state, |
$rowColor1,$rowColor2); |
$rowColor1,$rowColor2); |
} |
} |
return OK; |
return OK; |
Line 102 sub handler {
|
Line 113 sub handler {
|
|
|
sub print_main_menu { |
sub print_main_menu { |
my ($r,$cdom,$cnum,$function,$tabcol,$functions,$idx,$view_permission, |
my ($r,$cdom,$cnum,$function,$tabcol,$functions,$idx,$view_permission, |
$manage_permission,$action,$rowColor1,$rowColor2) = @_; |
$manage_permission,$action,$state,$rowColor1,$rowColor2) = @_; |
$r->print(&header('Course Groups',undef,undef,undef,undef,$function)); |
my $jscript = qq| |
|
function changeSort(caller) { |
|
document.$state.sortby.value = caller; |
|
document.$state.submit(); |
|
}\n|; |
|
$r->print(&header('Course Groups',$jscript,$action,$state, |
|
undef,$function)); |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>"/adm/coursegroups", |
({href=>"/adm/coursegroups", |
text=>"Course Groups",}); |
text=>"Course Groups",}); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Course Groups')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Course Groups')); |
&display_groups($r,$cdom,$cnum,$function,$tabcol,$functions,$idx, |
&display_groups($r,$cdom,$cnum,$function,$tabcol,$functions,$idx, |
$view_permission,$manage_permission,$action,$rowColor1, |
$view_permission,$manage_permission,$action,$state, |
$rowColor2); |
$rowColor1,$rowColor2); |
$r->print(&footer()); |
$r->print(&footer()); |
return; |
return; |
} |
} |
|
|
sub display_groups { |
sub display_groups { |
my ($r,$cdom,$cnum,$function,$tabcol,$functions,$idx,$view_permission, |
my ($r,$cdom,$cnum,$function,$tabcol,$functions,$idx,$view_permission, |
$manage_permission,$action,$rowColor1,$rowColor2) = @_; |
$manage_permission,$action,$state,$rowColor1,$rowColor2) = @_; |
my %curr_groups = (); |
my %curr_groups = (); |
my %grp_info = (); |
my %grp_info = (); |
|
|
my %actionlinks = ( |
my %actionlinks = ( |
modify => '<a href="/adm/coursegroups?action=modify&state=pick_task&refpage='. |
modify => '<a href="/adm/coursegroups?action=modify&refpage='. |
$env{'form.refpage'}.'&groupname=', |
$env{'form.refpage'}.'&groupname=', |
view => '<a href="/adm/'.$cdom.'/'.$cnum.'/', |
view => '<a href="/adm/'.$cdom.'/'.$cnum.'/', |
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 %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
modify => 'Modify', |
modify => 'Modify', |
Line 174 sub display_groups {
|
Line 190 sub display_groups {
|
<td><b>$lt{'func'}</b> |
<td><b>$lt{'func'}</b> |
</td> |
</td> |
<td><b><a href="javascript:changeSort('quota')">$lt{'quot'}</a></b></td> |
<td><b><a href="javascript:changeSort('quota')">$lt{'quot'}</a></b></td> |
<td><b><a href="javascript:changeSort('totalmembers)">$lt{'memb'}</a></b></td> |
<td><b><a href="javascript:changeSort('totalmembers')">$lt{'memb'}</a></b></td> |
<td><b><a href="javascript:changeSort('totalfiles')">$lt{'file'}</a></b></td> |
<td><b><a href="javascript:changeSort('totalfiles')">$lt{'file'}</a></b></td> |
<td><b><a href="javascript:changeSort('boards')">$lt{'dibd'}</a></b></td> |
<td><b><a href="javascript:changeSort('boards')">$lt{'dibd'}</a></b></td> |
<td><b><a href="javascript:changeSort('diskuse')">$lt{'dius'}</a></b></td> |
<td><b><a href="javascript:changeSort('diskuse')">$lt{'dius'}</a></b></td> |
Line 224 END
|
Line 240 END
|
$rowColor = $rowColor2; |
$rowColor = $rowColor2; |
} |
} |
my $description = |
my $description = |
&Apache::lonnet::unescape($grp_info{$group}{'description'}); |
&unescape($grp_info{$group}{'description'}); |
my $creator = $grp_info{$group}{'creator'}; |
my $creator = $grp_info{$group}{'creator'}; |
my $creation = $grp_info{$group}{'creation'}; |
my $creation = $grp_info{$group}{'creation'}; |
my $modified = $grp_info{$group}{'modified'}; |
my $modified = $grp_info{$group}{'modified'}; |
Line 248 END
|
Line 264 END
|
} else { |
} else { |
$link .= $group.'/grppg'; |
$link .= $group.'/grppg'; |
} |
} |
$link .= '">'.$lt{$action}.'</a>'; |
$link .= '">'.$lt{$action}.'</a>'; |
|
if ($action eq 'view') { |
|
if (($manage_permission) && |
|
($env{'form.refpage'} ne 'enrl')) { |
|
$link .= ' '.$actionlinks{'modify'}. |
|
$group.'">'.$lt{'modify'}.'</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 ++; |
} |
} |
} |
} |
$r->print('</table>'); |
$r->print('</table>'); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
|
$r->print('<input type="hidden" name="refpage" '. |
|
'value="'.$env{'form.refpage'}.'" />'); |
|
if ($action eq 'view') { |
|
if (!defined($state)) { |
|
$state = 'view'; |
|
} |
|
$r->print('<input type="hidden" name="state" value="'. |
|
$state.'" />'); |
|
} |
} else { |
} else { |
$r->print($lt{'nogr'}); |
$r->print($lt{'nogr'}); |
if ($manage_permission) { |
if ($manage_permission) { |
Line 273 END
|
Line 305 END
|
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 = &Apache::lonnet::unescape( |
my $description = &unescape( |
$group_info{description}); |
$group_info{description}); |
my ($uname,$udom) = split(/:/,$group_info{creator}); |
my ($uname,$udom) = split(/:/,$group_info{creator}); |
$r->print('<font size="+1"><a href="/adm/'.$udom.'/'.$uname.'/'.$group.'/grppg">'.$group,'</a><font><br /><small>'.$description.'</small><br /><br />'); |
$r->print('<font size="+1"><a href="/adm/'.$udom.'/'.$uname.'/'.$group.'/grppg">'.$group,'</a><font><br /><small>'.$description.'</small><br /><br />'); |
Line 288 END
|
Line 320 END
|
} |
} |
|
|
sub group_administration { |
sub group_administration { |
my ($r,$action,$cdom,$cnum,$function,$tabcol,$functions,$idx, |
my ($r,$action,$state,$cdom,$cnum,$function,$tabcol,$functions,$idx, |
$view_permission,$manage_permission,$rowColor1,$rowColor2) = @_; |
$view_permission,$manage_permission,$rowColor1,$rowColor2) = @_; |
my %sectioncount = (); |
my %sectioncount = (); |
my @tools = (); |
my @tools = (); |
Line 303 sub group_administration {
|
Line 335 sub group_administration {
|
my %memchg; |
my %memchg; |
my @member_changes = ('deletion','expire','activate','reenable', |
my @member_changes = ('deletion','expire','activate','reenable', |
'changefunc','changepriv'); |
'changefunc','changepriv'); |
my $state = $env{'form.state'}; |
|
my ($groupname,$description,$startdate,$enddate,$granularity,$specificity); |
my ($groupname,$description,$startdate,$enddate,$granularity,$specificity); |
|
|
if (defined($env{'form.groupname'})) { |
if (defined($env{'form.groupname'})) { |
Line 342 sub group_administration {
|
Line 373 sub group_administration {
|
|
|
if ($action eq 'modify') { |
if ($action eq 'modify') { |
if ($state eq '') { |
if ($state eq '') { |
$state = 'pick_group'; |
if (defined($env{'form.groupname'})) { |
|
$state = 'pick_task'; |
|
} else { |
|
$state = 'pick_group'; |
|
} |
} else { |
} else { |
%stored = &retrieve_settings($cdom,$cnum,$groupname); |
%stored = &retrieve_settings($cdom,$cnum,$groupname); |
if (ref($stored{'types'}) eq 'ARRAY') { |
if (ref($stored{'types'}) eq 'ARRAY') { |
Line 367 sub group_administration {
|
Line 402 sub group_administration {
|
} |
} |
} |
} |
|
|
my %toolprivs = (); |
my %toolprivs = |
%{$toolprivs{'email'}} = ( |
( |
sgm => 'Send group mail', |
email => { |
sgb => 'Broadcast mail', |
sgm => 'Send group mail', |
); |
sgb => 'Broadcast mail', |
%{$toolprivs{'discussion'}} = ( |
}, |
cgb => 'Create boards', |
discussion => { |
pgd => 'Post', |
cgb => 'Create boards', |
pag => 'Anon. posts', |
pgd => 'Post', |
rgi => 'Get identities', |
pag => 'Anon. posts', |
vgb => 'View boards', |
rgi => 'Get identities', |
); |
vgb => 'View boards', |
%{$toolprivs{'chat'}} = ( |
}, |
pgc => 'Chat', |
chat => { |
); |
pgc => 'Chat', |
%{$toolprivs{'files'}} = ( |
}, |
rgf => 'Retrieve', |
files => { |
ugf => 'Upload', |
rgf => 'Retrieve', |
dgf => 'Delete', |
ugf => 'Upload', |
); |
mgf => 'Modify', |
%{$toolprivs{'roster'}} = ( |
dgf => 'Delete', |
vgm => 'View', |
agf => 'Control Access', |
); |
}, |
%{$toolprivs{'homepage'}} = ( |
roster => { |
vgh => 'View page', |
vgm => 'View', |
mgh => 'Modify page', |
}, |
); |
homepage => { |
my %fixedprivs = (); |
vgh => 'View page', |
%{$fixedprivs{'email'}} = ('sgm' => 1); |
mgh => 'Modify page', |
%{$fixedprivs{'discussion'}} = ('vgb' => 1); |
}, |
%{$fixedprivs{'chat'}} = ('pgc' => 1); |
); |
%{$fixedprivs{'files'}} = ('rgf' => 1); |
|
%{$fixedprivs{'roster'}} = ('vgm' => 1); |
my %fixedprivs = |
%{$fixedprivs{'homepage'}} = ('vgh' => 1); |
( |
|
email => {sgm => 1}, |
my %elements = (); |
discussion => {vgb => 1}, |
%{$elements{'create'}} = (); |
chat => {pgc => 1}, |
%{$elements{'modify'}} = (); |
files => {rgf => 1}, |
%{$elements{'create'}{'pick_name'}} = ( |
roster => {vgm => 1}, |
startdate_month => 'selectbox', |
homepage => {vgh => 1}, |
startdate_hour => 'selectbox', |
); |
enddate_month => 'selectbox', |
|
enddate_hour => 'selectbox', |
my %elements = |
startdate_day => 'text', |
( |
startdate_year => 'text', |
create => { |
startdate_minute => 'text', |
pick_name => { |
startdate_second => 'text', |
startdate_month => 'selectbox', |
enddate_day => 'text', |
startdate_hour => 'selectbox', |
enddate_year => 'text', |
enddate_month => 'selectbox', |
enddate_minute => 'text', |
enddate_hour => 'selectbox', |
enddate_second => 'text', |
startdate_day => 'text', |
groupname => 'text', |
startdate_year => 'text', |
description => 'text', |
startdate_minute => 'text', |
tool => 'checkbox', |
startdate_second => 'text', |
granularity => 'radio', |
enddate_day => 'text', |
no_end_date => 'checkbox', |
enddate_year => 'text', |
); |
enddate_minute => 'text', |
%{$elements{'modify'}{'change_settings'}} = ( |
enddate_second => 'text', |
%{$elements{'create'}{'pick_name'}}, |
groupname => 'text', |
specificity => 'radio', |
description => 'text', |
defpriv => 'checkbox', |
tool => 'checkbox', |
autorole => 'checkbox', |
granularity => 'radio', |
autoadd => 'radio', |
no_end_date => 'checkbox', |
autodrop => 'radio', |
}, |
); |
pick_members => { |
|
member => 'checkbox', |
|
defpriv => 'checkbox', |
|
}, |
|
}, |
|
); |
|
|
|
$elements{'modify'} = { |
|
change_settings => { |
|
%{$elements{'create'}{'pick_name'}}, |
|
specificity => 'radio', |
|
defpriv => 'checkbox', |
|
autorole => 'checkbox', |
|
autoadd => 'radio', |
|
autodrop => 'radio', |
|
}, |
|
add_members => { |
|
types => 'selectbox', |
|
roles => 'selectbox', |
|
}, |
|
}; |
|
|
if (ref($stored{'autorole'}) eq 'ARRAY') { |
if (ref($stored{'autorole'}) eq 'ARRAY') { |
foreach my $role (@{$stored{'autorole'}}) { |
foreach my $role (@{$stored{'autorole'}}) { |
unless ($role eq 'cc') { |
unless ($role eq 'cc') { |
Line 440 sub group_administration {
|
Line 496 sub group_administration {
|
} |
} |
} |
} |
} |
} |
%{$elements{'create'}{'pick_members'}} = ( |
|
member => 'checkbox', |
|
defpriv => 'checkbox', |
|
); |
|
|
|
%{$elements{'modify'}{'add_members'}} = ( |
|
types => 'selectbox', |
|
roles => 'selectbox', |
|
); |
|
|
|
if (($action eq 'create') && ($state eq 'pick_name')) { |
if (($action eq 'create') && ($state eq 'pick_name')) { |
$elements{'create'}{'pick_name'}{'types'} = 'selectbox'; |
$elements{'create'}{'pick_name'}{'types'} = 'selectbox'; |
Line 476 sub group_administration {
|
Line 523 sub group_administration {
|
} |
} |
if (defined($env{'form.sectionpick'})) { |
if (defined($env{'form.sectionpick'})) { |
@sections=&Apache::loncommon::get_env_multiple('form.sectionpick'); |
@sections=&Apache::loncommon::get_env_multiple('form.sectionpick'); |
if (grep/^_all$/,@sections) { |
if (grep/^all$/,@sections) { |
@sections = sort {$a cmp $b} keys(%sectioncount); |
@sections = sort {$a cmp $b} keys(%sectioncount); |
} |
} |
} |
} |
Line 560 sub group_administration {
|
Line 607 sub group_administration {
|
} |
} |
|
|
if (($state eq 'pick_privs') || ($state eq 'change_privs') || |
if (($state eq 'pick_privs') || ($state eq 'change_privs') || |
(($specificity eq 'No') && |
(($specificity eq 'No') && |
(($state eq 'result') || ($state eq 'memresult')))) { |
($state eq 'memresult' || $state eq 'result' || $state eq 'addresult'))) { |
foreach my $tool (@tools) { |
foreach my $tool (@tools) { |
my @values = &Apache::loncommon::get_env_multiple('form.user_'.$tool); |
my @values = &Apache::loncommon::get_env_multiple('form.user_'.$tool); |
foreach my $user (@values) { |
foreach my $user (@values) { |
|
if ($state eq 'pick_privs' || $state eq 'result' |
|
|| $state eq 'addresult') { |
|
if (!grep(/^\Q$user\E$/,@members)) { |
|
next; |
|
} |
|
} |
unless(exists($usertools{$user}{$tool})) { |
unless(exists($usertools{$user}{$tool})) { |
$usertools{$user}{$tool} = 1; |
$usertools{$user}{$tool} = 1; |
} |
} |
Line 705 function changeSort(caller) {
|
Line 758 function changeSort(caller) {
|
@{$branchstates{'members'}} = ('change_members','change_privs','memresult'); |
@{$branchstates{'members'}} = ('change_members','change_privs','memresult'); |
@{$branchstates{'adds'}} = ('add_members','pick_members','pick_privs', |
@{$branchstates{'adds'}} = ('add_members','pick_members','pick_privs', |
'addresult'); |
'addresult'); |
|
|
if (defined($env{'form.branch'})) { |
if (defined($env{'form.branch'})) { |
push (@{$states{$action}},@{$branchstates{$env{'form.branch'}}}); |
push (@{$states{$action}},@{$branchstates{$env{'form.branch'}}}); |
} |
} |
Line 801 function changeSort(caller) {
|
Line 854 function changeSort(caller) {
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs |
$r->print(&Apache::lonhtmlcommon::breadcrumbs |
('Course Groups Manager')); |
('Course Groups Manager')); |
&display_groups($r,$cdom,$cnum,$function,$tabcol,$functions,$idx, |
&display_groups($r,$cdom,$cnum,$function,$tabcol,$functions,$idx, |
$view_permission,$manage_permission,$action, |
$view_permission,$manage_permission,$action,$state, |
$rowColor1,$rowColor2); |
$rowColor1,$rowColor2); |
|
|
} |
} |
Line 821 sub retrieve_settings {
|
Line 874 sub retrieve_settings {
|
my %stored; |
my %stored; |
|
|
$stored{'description'} = |
$stored{'description'} = |
&Apache::lonnet::unescape($groupinfo{'description'}); |
&unescape($groupinfo{'description'}); |
$stored{'startdate'} = $groupinfo{'startdate'}; |
$stored{'startdate'} = $groupinfo{'startdate'}; |
$stored{'enddate'} = $groupinfo{'enddate'}; |
$stored{'enddate'} = $groupinfo{'enddate'}; |
if ($stored{'enddate'} == 0) { |
if ($stored{'enddate'} == 0) { |
Line 903 sub display_control {
|
Line 956 sub display_control {
|
my $groupname = $env{'form.groupname'}; |
my $groupname = $env{'form.groupname'}; |
if ($state eq 'pick_group') { |
if ($state eq 'pick_group') { |
&display_groups($r,$cdom,$cnum,$function,$tabcol,$functions,$idx, |
&display_groups($r,$cdom,$cnum,$function,$tabcol,$functions,$idx, |
$view_permission,$manage_permission,$action, |
$view_permission,$manage_permission,$action,$state, |
$rowColor1,$rowColor2); |
$rowColor1,$rowColor2); |
} elsif ($state eq 'pick_task') { |
} elsif ($state eq 'pick_task') { |
&modify_menu($r,$groupname,$page); |
&modify_menu($r,$groupname,$page); |
Line 1207 sub membership_options {
|
Line 1260 sub membership_options {
|
'meof' => 'members of the new group.', |
'meof' => 'members of the new group.', |
'admg' => '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.', |
|
'asub' => 'A subsequent step will also allow you to specify automatic adding/dropping of group members triggered by specified role and section changes.', |
'acty' => 'Access types', |
'acty' => 'Access types', |
'coro' => 'Course roles', |
'coro' => 'Course roles', |
'cose' => 'Course sections', |
'cose' => 'Course sections', |
Line 1229 sub membership_options {
|
Line 1283 sub membership_options {
|
<td colspan="3"> |
<td colspan="3"> |
<b>'.$lt{'gmem'}.'</b><br/>'.$lt{'picr'}); |
<b>'.$lt{'gmem'}.'</b><br/>'.$lt{'picr'}); |
if ($action eq 'create') { |
if ($action eq 'create') { |
$r->print($lt{'meof'}.'<br />'.$lt{'ifno'}); |
$r->print($lt{'meof'}.'<br />'.$lt{'ifno'}.'<br />'.$lt{'asub'}); |
} else { |
} else { |
$r->print($lt{'admg'}); |
$r->print($lt{'admg'}); |
} |
} |
Line 2077 sub current_membership {
|
Line 2131 sub current_membership {
|
my($end,$start,@userprivs) = split(/:/,$membership{$key}); |
my($end,$start,@userprivs) = split(/:/,$membership{$key}); |
unless ($start == -1) { |
unless ($start == -1) { |
$allnames{$udom}{$uname} = 1; |
$allnames{$udom}{$uname} = 1; |
%{$current{$user}} = (); |
$current{$user} = { |
$current{$user}{uname} = $uname; |
uname => $uname, |
$current{$user}{udom} = $udom; |
udom => $udom, |
$current{$user}{start} = |
start => &Apache::lonlocal::locallocaltime($start), |
&Apache::lonlocal::locallocaltime($start); |
currtools => [], |
|
newtools => [], |
|
}; |
|
|
if ($end == 0) { |
if ($end == 0) { |
$current{$user}{end} = 'No end date'; |
$current{$user}{end} = 'No end date'; |
} else { |
} else { |
Line 2099 sub current_membership {
|
Line 2156 sub current_membership {
|
$current{$user}{changestate} = 'expire'; |
$current{$user}{changestate} = 'expire'; |
$num_expire ++; |
$num_expire ++; |
} |
} |
@{$current{$user}{currtools}} = (); |
|
@{$current{$user}{newtools}} = (); |
|
if (@userprivs > 0) { |
if (@userprivs > 0) { |
foreach my $tool (sort(keys(%{$fixedprivs}))) { |
foreach my $tool (sort(keys(%{$fixedprivs}))) { |
foreach my $priv (keys(%{$$fixedprivs{$tool}})) { |
foreach my $priv (keys(%{$$fixedprivs{$tool}})) { |
Line 2813 sub write_group_data {
|
Line 2868 sub write_group_data {
|
$creation = $$stored{'creation'}; |
$creation = $$stored{'creation'}; |
$creator = $$stored{'creator'}; |
$creator = $$stored{'creator'}; |
} |
} |
my $esc_description = &Apache::lonnet::escape($description); |
my $esc_description = &escape($description); |
my @single_attributes = ('description','functions','startdate','enddate', |
my @single_attributes = ('description','functions','startdate','enddate', |
'creation','modified','creator','granularity', |
'creation','modified','creator','granularity', |
'specificity','autoadd','autodrop'); |
'specificity','autoadd','autodrop'); |
Line 2905 sub process_membership {
|
Line 2960 sub process_membership {
|
my $num_ok = 0; |
my $num_ok = 0; |
my $num_fail = 0; |
my $num_fail = 0; |
my %group_privs = (); |
my %group_privs = (); |
|
my %curr_privs = (); |
|
my %curr_start = (); |
|
my %curr_end = (); |
my %tooltype = (); |
my %tooltype = (); |
|
|
foreach my $tool (@{$tools}) { |
foreach my $tool (@{$tools}) { |
Line 2923 sub process_membership {
|
Line 2981 sub process_membership {
|
} |
} |
} else { |
} else { |
if (@{$defprivs} > 0) { |
if (@{$defprivs} > 0) { |
foreach my $priv (@{$defprivs}) { |
if (grep/^\Q$priv\E$/,@{$defprivs}) { |
foreach my $user (sort(keys(%{$usertools}))) { |
foreach my $user (sort(keys(%{$usertools}))) { |
if ($$usertools{$user}{$tool}) { |
if ($$usertools{$user}{$tool}) { |
$group_privs{$user} .= $priv.':'; |
$group_privs{$user} .= $priv.':'; |
Line 2943 sub process_membership {
|
Line 3001 sub process_membership {
|
my @expire = (); |
my @expire = (); |
my @deletion = (); |
my @deletion = (); |
my @reenable = (); |
my @reenable = (); |
|
my @unchanged = (); |
if ($state eq 'memresult') { |
if ($state eq 'memresult') { |
if (ref($$memchg{'activate'}) eq 'ARRAY') { |
if (ref($$memchg{'activate'}) eq 'ARRAY') { |
@activate = @{$$memchg{'activate'}}; |
@activate = @{$$memchg{'activate'}}; |
Line 2956 sub process_membership {
|
Line 3015 sub process_membership {
|
if (ref($$memchg{'reenable'}) eq 'ARRAY') { |
if (ref($$memchg{'reenable'}) eq 'ARRAY') { |
@reenable = @{$$memchg{'reenable'}}; |
@reenable = @{$$memchg{'reenable'}}; |
} |
} |
|
my %membership = &Apache::lonnet::get_group_membership($cdom,$cnum, |
|
$groupname); |
|
foreach my $key (sort(keys(%membership))) { |
|
if ($key =~ /^\Q$groupname\E:([^:]+:[^:]+)$/) { |
|
($curr_end{$1},$curr_start{$1},$curr_privs{$1}) = |
|
split(/:/,$membership{$key},3); |
|
} |
|
} |
if (@expire + @deletion > 0) { |
if (@expire + @deletion > 0) { |
my %membership = &Apache::lonnet::get_group_membership($cdom,$cnum, |
|
$groupname); |
|
foreach my $user (@expire) { |
foreach my $user (@expire) { |
my ($currend,$currstart,@userprivs) = |
my $savestart = $curr_start{$user}; |
split(/:/,$membership{$groupname.':'.$user}); |
if ($savestart > $now) { |
$group_privs{$user} = join(':',@userprivs); |
$savestart = $now; |
if ($currstart > $now) { |
|
$currstart = $now; |
|
} |
} |
$usersettings{$groupname.':'.$user} = $now.':'.$currstart.':'. |
$usersettings{$groupname.':'.$user} = $now.':'.$savestart.':'. |
$group_privs{$user}; |
$curr_privs{$user}; |
if (&Apache::lonnet::modify_group_roles($cdom,$cnum,$groupname, |
if (&Apache::lonnet::modify_group_roles($cdom,$cnum,$groupname, |
$user,$now,$currstart, |
$user,$now,$savestart, |
$group_privs{$user}) eq 'ok') { |
$curr_privs{$user}) eq 'ok') { |
push(@{$added{'expired'}},$user); |
push(@{$added{'expired'}},$user); |
$num_ok ++; |
$num_ok ++; |
} else { |
} else { |
Line 2994 sub process_membership {
|
Line 3057 sub process_membership {
|
} |
} |
|
|
foreach my $user (sort(keys(%{$usertools}))) { |
foreach my $user (sort(keys(%{$usertools}))) { |
|
if ((grep(/^$user$/,@expire)) || (grep(/^$user$/,@deletion))) { |
|
next; |
|
} |
my $type; |
my $type; |
my $start = $startdate; |
my $start = $startdate; |
my $end = $enddate; |
my $end = $enddate; |
if ($state eq 'memresult') { |
if ($state eq 'memresult') { |
|
if ($curr_privs{$user} eq $group_privs{$user}) { |
|
push(@unchanged,$user); |
|
next; |
|
} |
|
if (exists($curr_start{$user})) { |
|
$start = $curr_start{$user}; |
|
} |
|
if (exists($curr_end{$user})) { |
|
$end = $curr_end{$user}; |
|
} |
$type = 'modified'; |
$type = 'modified'; |
if (@activate > 0) { |
if (@activate > 0) { |
if (grep/^$user$/,@activate) { |
if (grep/^$user$/,@activate) { |
$start = $now; |
$start = $now; |
|
$end = $enddate; |
$type = 'activated'; |
$type = 'activated'; |
} |
} |
} |
} |
if (@reenable > 0) { |
if (@reenable > 0) { |
if (grep/^$user$/,@reenable) { |
if (grep/^$user$/,@reenable) { |
|
$start = $startdate; |
|
$end = $enddate; |
$type = 'reenabled'; |
$type = 'reenabled'; |
} |
} |
} |
} |
Line 3030 sub process_membership {
|
Line 3109 sub process_membership {
|
if ($num_ok) { |
if ($num_ok) { |
foreach my $type (sort(keys(%added))) { |
foreach my $type (sort(keys(%added))) { |
$r->print(&mt('The following users were successfully [_1]',$type)); |
$r->print(&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')); |
$r->print(&mt(' with the following privileges')); |
} |
} |
$r->print(':<br />'); |
$r->print(':<br />'); |
Line 3051 sub process_membership {
|
Line 3130 sub process_membership {
|
} |
} |
$r->print($$userdata{$user}[$$idx{fullname}].' - '.$user.$privlist.'<br />'); |
$r->print($$userdata{$user}[$$idx{fullname}].' - '.$user.$privlist.'<br />'); |
} |
} |
|
$r->print('<br />'); |
} |
} |
} |
} |
if ($num_fail) { |
if ($num_fail) { |
Line 3060 sub process_membership {
|
Line 3140 sub process_membership {
|
$r->print($$userdata{$user}[$$idx{fullname}].' - '.$user.'<br />'); |
$r->print($$userdata{$user}[$$idx{fullname}].' - '.$user.'<br />'); |
} |
} |
} |
} |
|
$r->print('<br />'); |
|
} |
|
if (@unchanged > 0) { |
|
$r->print(&mt('No change occurred for the following users:<br />')); |
|
foreach my $user (sort(@unchanged)) { |
|
$r->print($$userdata{$user}[$$idx{fullname}].' - '.$user.'<br />'); |
|
} |
|
$r->print('<br />'); |
} |
} |
if ($roster_result eq 'ok') { |
if ($roster_result eq 'ok') { |
$r->print('<br />'.&mt('Group membership list updated.')); |
$r->print('<br />'.&mt('Group membership list updated.')); |
Line 3369 sub date_setting_table {
|
Line 3457 sub date_setting_table {
|
sub create_homepage { |
sub create_homepage { |
my ($cdom,$cnum,$name,$groupinfo,$tools) = @_; |
my ($cdom,$cnum,$name,$groupinfo,$tools) = @_; |
my $functionality = join(',',@{$tools}); |
my $functionality = join(',',@{$tools}); |
my $content = &Apache::lonnet::unescape($$groupinfo{description}); |
my $content = &unescape($$groupinfo{description}); |
$content=~s/\s+$//s; |
$content=~s/\s+$//s; |
$content=~s/^\s+//s; |
$content=~s/^\s+//s; |
$content=~s/\<br\s*\/*\>$//s; |
$content=~s/\<br\s*\/*\>$//s; |