version 1.31, 2006/06/30 03:33:50
|
version 1.37, 2006/07/04 20:50:52
|
Line 230 END
|
Line 230 END
|
$grp_info{$group}{'diskuse'} = sprintf("%.0f",$pct_use); |
$grp_info{$group}{'diskuse'} = sprintf("%.0f",$pct_use); |
} else { |
} else { |
$grp_info{$group}{'diskuse'} = 'N/A'; |
$grp_info{$group}{'diskuse'} = 'N/A'; |
} |
} |
|
my ($groupboards,$boardshash)=&Apache::longroup::get_group_bbinfo( |
|
$cdom,$cnum,$group); |
|
$grp_info{$group}{'boards'} = scalar(@{$groupboards}); |
if ($env{'form.sortby'} eq 'groupname') { |
if ($env{'form.sortby'} eq 'groupname') { |
push(@{$Sortby{$group}},$group); |
push(@{$Sortby{$group}},$group); |
} elsif ($env{'form.sortby'} eq 'description') { |
} elsif ($env{'form.sortby'} eq 'description') { |
Line 299 END
|
Line 302 END
|
$group.'">'.$lt{'modify'}.'</a>'; |
$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><nobr>'.&mt('Files: ').$totalfiles.'</nobr><br /><nobr>'.&mt('Folders: ').$totaldirs.'</nobr></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 align="right"><small>'.$quota.'</small></td><td align="right"><small>'.$totalmembers.'</small></td><td align="right"><small><nobr>'.&mt('Files: ').$totalfiles.'</nobr><br /><nobr>'.&mt('Folders: ').$totaldirs.'</nobr></small></td><td align="right"><small>'.$boards.'</small></td><td align="right"><small>'.$diskuse.'</small></td></tr>'); |
$rowNum ++; |
$rowNum ++; |
} |
} |
} |
} |
Line 365 sub group_administration {
|
Line 368 sub group_administration {
|
my @member_changes = ('deletion','expire','activate','reenable', |
my @member_changes = ('deletion','expire','activate','reenable', |
'changefunc','changepriv'); |
'changefunc','changepriv'); |
my ($groupname,$description,$startdate,$enddate,$granularity,$specificity, |
my ($groupname,$description,$startdate,$enddate,$granularity,$specificity, |
$quota); |
$quota,$validate_script); |
|
|
if (defined($env{'form.groupname'})) { |
if (defined($env{'form.groupname'})) { |
$groupname = $env{'form.groupname'}; |
$groupname = $env{'form.groupname'}; |
Line 435 sub group_administration {
|
Line 438 sub group_administration {
|
} |
} |
} |
} |
|
|
my %toolprivs = |
my $toolprivs = &Apache::longroup::get_tool_privs($gpterm); |
( |
|
email => { |
|
sgm => 'Send '.$gpterm.' mail', |
|
sgb => 'Broadcast mail', |
|
}, |
|
discussion => { |
|
cgb => 'Create boards', |
|
pgd => 'Post', |
|
pag => 'Anon. posts', |
|
rgi => 'Get identities', |
|
vgb => 'View boards', |
|
}, |
|
chat => { |
|
pgc => 'Chat', |
|
}, |
|
files => { |
|
rgf => 'Retrieve', |
|
ugf => 'Upload', |
|
mgf => 'Modify', |
|
dgf => 'Delete', |
|
agf => 'Control Access', |
|
}, |
|
roster => { |
|
vgm => 'View', |
|
}, |
|
homepage => { |
|
vgh => 'View page', |
|
mgh => 'Modify page', |
|
}, |
|
); |
|
|
|
my %fixedprivs = |
my $fixedprivs = &Apache::longroup::get_fixed_privs(); |
( |
|
email => {sgm => 1}, |
|
discussion => {vgb => 1}, |
|
chat => {pgc => 1}, |
|
files => {rgf => 1}, |
|
roster => {vgm => 1}, |
|
homepage => {vgh => 1}, |
|
); |
|
|
|
my %elements = |
my %elements = |
( |
( |
Line 683 sub group_administration {
|
Line 648 sub group_administration {
|
} |
} |
my @currtools = (); |
my @currtools = (); |
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}})) { |
if (grep/^$priv$/,@userprivs) { |
if (grep/^$priv$/,@userprivs) { |
push(@currtools,$tool); |
push(@currtools,$tool); |
last; |
last; |
Line 754 sub group_administration {
|
Line 719 sub group_administration {
|
&& ($specificity eq 'Yes')) { |
&& ($specificity eq 'Yes')) { |
foreach my $user (sort(keys(%usertools))) { |
foreach my $user (sort(keys(%usertools))) { |
foreach my $tool (keys(%{$usertools{$user}})) { |
foreach my $tool (keys(%{$usertools{$user}})) { |
foreach my $priv (keys(%{$toolprivs{$tool}})) { |
foreach my $priv (keys(%{$$toolprivs{$tool}})) { |
unless (exists($fixedprivs{$tool}{$priv})) { |
unless (exists($$fixedprivs{$tool}{$priv})) { |
$elements{$action}{$state}{'userpriv_'.$priv} = 'checkbox'; |
$elements{$action}{$state}{'userpriv_'.$priv} = 'checkbox'; |
} |
} |
} |
} |
} |
} |
} |
} |
} |
} |
|
|
|
if (($action eq 'create' && $state eq 'pick_name') || |
|
($action eq 'modify' && $state eq 'change_settings')) { |
|
my ($crsquota,$freespace,$maxposs) = &get_quota_constraints($action,\%stored); |
|
my $space_trim = '/^\s*|\s*\$/g,""'; |
|
my $float_check = '/^([0-9]*\.?[0-9]*)$/'; |
|
$validate_script = ' |
|
var newquota = document.'.$state.'.quota.value; |
|
newquota.replace('.$space_trim.'); |
|
if (newquota == "" ) { |
|
document.'.$state.'.quota.value = 0; |
|
newquota = 0; |
|
} |
|
var maxposs = '.$maxposs.'; |
|
if (newquota > maxposs) { |
|
alert("The file repository quota you entered for this group ("+newquota+" Mb) exceeds the maximum possible ("+maxposs+" Mb). Please enter a smaller number."); |
|
return; |
|
} |
|
var re_quota = '.$float_check.'; |
|
var check_quota = newquota.match(re_quota); |
|
if (check_quota == null) { |
|
alert("The quota you entered contains invalid characters, the quota should only include numbers, with or without a decimal point."); |
|
return; |
|
} |
|
if (newquota == 0) { |
|
var warn_zero = 0; |
|
for (var i=0; i<document.'.$state.'.tool.length; i++) { |
|
if (document.'.$state.'.tool[i].value == "files") { |
|
if (document.'.$state.'.tool[i].checked) { |
|
warn_zero = 1; |
|
} |
|
} |
|
} |
|
if (warn_zero == 1) { |
|
alert("You have indicated that the file repository should be enabled, but you have set the respository quota to 0 Mb.\nThis will prevent any upload of files.\nPlease set a value or disable the repository feature."); |
|
return; |
|
} |
|
} |
|
'; |
|
} |
my $jscript = &Apache::loncommon::check_uncheck_jscript(); |
my $jscript = &Apache::loncommon::check_uncheck_jscript(); |
$jscript .= qq| |
$jscript .= qq| |
function nextPage(formname,nextstate) { |
function nextPage(formname,nextstate) { |
formname.state.value= nextstate; |
formname.state.value= nextstate; |
|
$validate_script |
formname.submit(); |
formname.submit(); |
} |
} |
function backPage(formname,prevstate) { |
function backPage(formname,prevstate) { |
Line 865 function changeSort(caller) {
|
Line 870 function changeSort(caller) {
|
("$crumbtitle Manager")); |
("$crumbtitle Manager")); |
&display_control($r,$cdom,$cnum,$tabcol,$action,$state,$page, |
&display_control($r,$cdom,$cnum,$tabcol,$action,$state,$page, |
\%sectioncount,$groupname,$description,$functions, |
\%sectioncount,$groupname,$description,$functions, |
\@tools,\%toolprivs,\%fixedprivs,$startdate,$enddate, |
\@tools,$toolprivs,$fixedprivs,$startdate,$enddate, |
\%users,\%userdata,$idx,\%memchg,\%usertools, |
\%users,\%userdata,$idx,\%memchg,\%usertools, |
$function,$view_permission,$manage_permission, |
$function,$view_permission,$manage_permission, |
\%stored,$granularity,$quota,$specificity,\@types,\@roles, |
\%stored,$granularity,$quota,$specificity,\@types,\@roles, |
Line 1239 sub groupsettings_options {
|
Line 1244 sub groupsettings_options {
|
'doyo' => "Do you want to assign different functionality ". |
'doyo' => "Do you want to assign different functionality ". |
"to different $gpterm members?", |
"to different $gpterm members?", |
); |
); |
my $crsquota = $env{'course.'.$env{'request.course.id'}.'.internal.coursequota'}; |
my ($crsquota,$freespace,$maxposs) = &get_quota_constraints($action,$stored); |
if ($crsquota eq '') { |
|
$crsquota = 20; |
|
} |
|
my $freespace = $crsquota - &Apache::longroup::sum_quotas(); |
|
my $maxposs = $$stored{'quota'} + $freespace; |
|
&topic_bar($r,$tabcol,$image,$lt{'gnde'}); |
&topic_bar($r,$tabcol,$image,$lt{'gnde'}); |
$r->print(' |
$r->print(' |
<tr> |
<tr> |
Line 1345 END
|
Line 1345 END
|
return; |
return; |
} |
} |
|
|
|
sub get_quota_constraints { |
|
my ($action,$stored) = @_; |
|
my ($crsquota,$freespace,$maxposs); |
|
$crsquota = $env{'course.'.$env{'request.course.id'}.'.internal.coursequota'}; |
|
if ($crsquota eq '') { |
|
$crsquota = 20; |
|
} |
|
$freespace = $crsquota - &Apache::longroup::sum_quotas(); |
|
if ($action eq 'create') { |
|
$maxposs = $freespace; |
|
} else { |
|
$maxposs = $$stored{'quota'} + $freespace; |
|
} |
|
return ($crsquota,$freespace,$maxposs); |
|
} |
|
|
sub membership_options { |
sub membership_options { |
my ($r,$action,$state,$tabcol,$sectioncount,$image,$gpterm,$ucgpterm) = @_; |
my ($r,$action,$state,$tabcol,$sectioncount,$image,$gpterm,$ucgpterm) = @_; |
my $crstype = &Apache::loncommon::course_type(); |
my $crstype = &Apache::loncommon::course_type(); |
Line 1368 sub membership_options {
|
Line 1384 sub membership_options {
|
future => &mt('Will have future access'), |
future => &mt('Will have future access'), |
); |
); |
|
|
my @roles = ('st','cc','in','ta','ep','cr'); |
#FIXME need to plumb around for the various cr roles defined by the user |
|
my @roles = ('st','cc','in','ta','ep'); |
|
|
my @sections = keys(%{$sectioncount}); |
my @sections = keys(%{$sectioncount}); |
|
|
Line 1776 sub pick_new_members {
|
Line 1793 sub pick_new_members {
|
if (@{$available} > 0) { |
if (@{$available} > 0) { |
if ($granularity eq 'Yes') { |
if ($granularity eq 'Yes') { |
$r->print('<tr bgcolor="#cccccc"> |
$r->print('<tr bgcolor="#cccccc"> |
<td colspan="5"> </td> |
<td colspan="6"> </td> |
<td align="center"><small><nobr><b>'.&mt('All:').'</b> '); |
<td align="center"><small><nobr><b>'.&mt('All:').'</b> '); |
foreach my $tool (@{$available}) { |
foreach my $tool (@{$available}) { |
$r->print('<label><input type="checkbox" name="togglefunc" '. |
$r->print('<label><input type="checkbox" name="togglefunc" '. |
Line 2223 sub current_membership {
|
Line 2240 sub current_membership {
|
'curf' => 'Current Functionality', |
'curf' => 'Current Functionality', |
'chpr' => 'Change Privileges' |
'chpr' => 'Change Privileges' |
); |
); |
if (keys(%membership) > 0) { |
my ($current,$hastools,$addtools,$num_reenable,$num_activate,$num_expire) = |
my %current = (); |
&Apache::longroup::group_memberlist($cdom,$cnum,$groupname,$fixedprivs, |
my %allnames = (); |
$available); |
my $hastools = 0; |
if (keys(%{$current}) > 0) { |
my $addtools = 0; |
$r->print(' |
my $num_reenable = 0; |
|
my $num_activate = 0; |
|
my $num_expire = 0; |
|
foreach my $key (sort(keys(%membership))) { |
|
if ($key =~ /^\Q$groupname\E:([^:]+):([^:]+)$/) { |
|
my $uname = $1; |
|
my $udom = $2; |
|
my $user = $uname.':'.$udom; |
|
my($end,$start,@userprivs) = split(/:/,$membership{$key}); |
|
unless ($start == -1) { |
|
$allnames{$udom}{$uname} = 1; |
|
$current{$user} = { |
|
uname => $uname, |
|
udom => $udom, |
|
start => &Apache::lonlocal::locallocaltime($start), |
|
currtools => [], |
|
newtools => [], |
|
}; |
|
|
|
if ($end == 0) { |
|
$current{$user}{end} = 'No end date'; |
|
} else { |
|
$current{$user}{end} = |
|
&Apache::lonlocal::locallocaltime($end); |
|
} |
|
my $now = time; |
|
if (($end > 0) && ($end < $now)) { |
|
$current{$user}{changestate} = 'reenable'; |
|
$num_reenable++; |
|
} elsif (($start > $now)) { |
|
$current{$user}{changestate} = 'activate'; |
|
$num_activate ++; |
|
} else { |
|
$current{$user}{changestate} = 'expire'; |
|
$num_expire ++; |
|
} |
|
if (@userprivs > 0) { |
|
foreach my $tool (sort(keys(%{$fixedprivs}))) { |
|
foreach my $priv (keys(%{$$fixedprivs{$tool}})) { |
|
if (grep/^$priv$/,@userprivs) { |
|
push(@{$current{$user}{currtools}},$tool); |
|
last; |
|
} |
|
} |
|
} |
|
$hastools = 1; |
|
} |
|
if (@{$available} > 0) { |
|
if (@{$current{$user}{currtools}} > 0) { |
|
if ("@{$available}" ne "@{$current{$user}{currtools}}") { |
|
foreach my $tool (@{$available}) { |
|
unless (grep/^$tool$/,@{$current{$user}{currtools}}) { |
|
push(@{$current{$user}{newtools}},$tool); |
|
} |
|
} |
|
} |
|
} else { |
|
@{$current{$user}{newtools}} = @{$available}; |
|
} |
|
if (@{$current{$user}{newtools}} > 0) { |
|
$addtools = 1; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
if (keys(%current) > 0) { |
|
my %idhash; |
|
foreach my $udom (keys(%allnames)) { |
|
%{$idhash{$udom}} = &Apache::lonnet::idrget($udom, |
|
keys(%{$allnames{$udom}})); |
|
foreach my $uname (keys(%{$idhash{$udom}})) { |
|
$current{$uname.':'.$udom}{'id'} = $idhash{$udom}{$uname}; |
|
} |
|
foreach my $uname (keys(%{$allnames{$udom}})) { |
|
$current{$uname.':'.$udom}{'fullname'} = |
|
&Apache::loncommon::plainname($uname,$udom, |
|
'lastname'); |
|
} |
|
} |
|
$r->print(' |
|
<tr> |
<tr> |
<td> </td> |
<td> </td> |
<td colspan="2"> |
<td colspan="2"> |
<table> |
<table> |
<tr>'); |
<tr>'); |
if ($num_expire) { |
if ($num_expire) { |
&check_uncheck_buttons($r,$formname,'expire',$lt{'expi'}); |
&check_uncheck_buttons($r,$formname,'expire',$lt{'expi'}); |
} |
} |
if ($num_reenable) { |
if ($num_reenable) { |
&check_uncheck_buttons($r,$formname,'reenable',$lt{'reen'}); |
&check_uncheck_buttons($r,$formname,'reenable',$lt{'reen'}); |
} |
} |
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,'deletion',$lt{'dele'}); |
|
if (@{$available} > 0) { |
|
if ($specificity eq 'Yes') { |
|
&check_uncheck_buttons($r,$formname,'changepriv',$lt{'chpr'}); |
} |
} |
&check_uncheck_buttons($r,$formname,'deletion',$lt{'dele'}); |
if ($granularity eq 'Yes') { |
if (@{$available} > 0) { |
$r->print(&check_uncheck_tools($r,$available)); |
if ($specificity eq 'Yes') { |
$r->print(' |
&check_uncheck_buttons($r,$formname,'changepriv',$lt{'chpr'}); |
|
} |
|
if ($granularity eq 'Yes') { |
|
$r->print(&check_uncheck_tools($r,$available)); |
|
$r->print(' |
|
<td> |
<td> |
<nobr> |
<nobr> |
<fieldset><legend><b>'.$lt{'curf'}.'</b></legend> |
<fieldset><legend><b>'.$lt{'curf'}.'</b></legend> |
Line 2343 sub current_membership {
|
Line 2279 sub current_membership {
|
</nobr> |
</nobr> |
</td> |
</td> |
'); |
'); |
} |
|
} |
} |
$r->print(<<"END"); |
} |
|
$r->print(<<"END"); |
</tr> |
</tr> |
</table> |
</table> |
</td> |
</td> |
Line 2358 sub current_membership {
|
Line 2294 sub current_membership {
|
<td> </td> |
<td> </td> |
<td colspan="3"> |
<td colspan="3"> |
END |
END |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$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>$lt{'actn'}</b></td> |
<td><b>$lt{'actn'}</b></td> |
Line 2371 END
|
Line 2307 END
|
<td><b><a href="javascript:changeSort('start')">$lt{'stda'}</a></b></td> |
<td><b><a href="javascript:changeSort('start')">$lt{'stda'}</a></b></td> |
<td><b><a href="javascript:changeSort('end')">$lt{'enda'}</a></b></td> |
<td><b><a href="javascript:changeSort('end')">$lt{'enda'}</a></b></td> |
END |
END |
my $colspan = 0; |
my $colspan = 0; |
if ($hastools) { |
if ($hastools) { |
$r->print('<td><b>'.$lt{'curf'}.'</b></td>'); |
$r->print('<td><b>'.$lt{'curf'}.'</b></td>'); |
$colspan ++; |
$colspan ++; |
} |
} |
if ($addtools) { |
if ($addtools) { |
$r->print('<td><b>Additional Functionality</b></td>'); |
$r->print('<td><b>Additional Functionality</b></td>'); |
$colspan ++; |
$colspan ++; |
} |
} |
$r->print('</tr>'); |
$r->print('</tr>'); |
if ($colspan) { |
if ($colspan) { |
if ($granularity eq 'Yes') { |
if ($granularity eq 'Yes') { |
$r->print('<tr bgcolor="#cccccc"> |
$r->print('<tr bgcolor="#cccccc"> |
<td colspan="7"> </td> |
<td colspan="7"> </td> |
<td colspan="'.$colspan.'" align="center"><small><nobr><b>'.&mt('All:'). |
<td colspan="'.$colspan.'" align="center"><small><nobr><b>'.&mt('All:'). |
'</b> '); |
'</b> '); |
foreach my $tool (@{$available}) { |
foreach my $tool (@{$available}) { |
$r->print('<label><input type="checkbox" name="togglefunc"'. |
$r->print('<label><input type="checkbox" name="togglefunc"'. |
' onclick="javascript:toggleTools(document.'.$formname.'.user_'.$tool.',this);"'. |
' onclick="javascript:toggleTools(document.'.$formname.'.user_'.$tool.',this);"'. |
' value="'.$tool.'">'.'<b>'.$tool.'</b></label> '); |
' value="'.$tool.'">'.'<b>'.$tool.'</b></label> '); |
} |
|
$r->print('</nobr></small></td></tr>'); |
|
} |
} |
|
$r->print('</nobr></small></td></tr>'); |
} |
} |
my %Sortby = (); |
} |
foreach my $user (sort(keys(%current))) { |
my %Sortby = (); |
if ($env{'form.sortby'} eq 'fullname') { |
foreach my $user (sort(keys(%{$current}))) { |
push(@{$Sortby{$current{$user}{fullname}}},$user); |
if ($env{'form.sortby'} eq 'fullname') { |
} elsif ($env{'form.sortby'} eq 'username') { |
push(@{$Sortby{$$current{$user}{fullname}}},$user); |
push(@{$Sortby{$current{$user}{uname}}},$user); |
} elsif ($env{'form.sortby'} eq 'username') { |
} elsif ($env{'form.sortby'} eq 'domain') { |
push(@{$Sortby{$$current{$user}{uname}}},$user); |
push(@{$Sortby{$current{$user}{udom}}},$user); |
} elsif ($env{'form.sortby'} eq 'domain') { |
} elsif ($env{'form.sortby'} eq 'id') { |
push(@{$Sortby{$$current{$user}{udom}}},$user); |
push(@{$Sortby{$current{$user}{id}}},$user); |
} elsif ($env{'form.sortby'} eq 'id') { |
|
push(@{$Sortby{$$current{$user}{id}}},$user); |
|
} else { |
|
push(@{$Sortby{$$current{$user}{fullname}}},$user); |
|
} |
|
} |
|
my $rowNum = 0; |
|
my $rowColor; |
|
foreach my $key (sort(keys(%Sortby))) { |
|
foreach my $user (@{$Sortby{$key}}) { |
|
if ($rowNum %2 == 1) { |
|
$rowColor = $rowColor1; |
} else { |
} else { |
push(@{$Sortby{$current{$user}{fullname}}},$user); |
$rowColor = $rowColor2; |
} |
} |
} |
my $id = $$current{$user}{id}; |
my $rowNum = 0; |
my $fullname = $$current{$user}{fullname}; |
my $rowColor; |
my $udom = $$current{$user}{udom}; |
foreach my $key (sort(keys(%Sortby))) { |
my $uname = $$current{$user}{uname}; |
foreach my $user (@{$Sortby{$key}}) { |
my $start = $$current{$user}{start}; |
if ($rowNum %2 == 1) { |
my $end = $$current{$user}{end}; |
$rowColor = $rowColor1; |
$r->print('<tr bgcolor="'.$rowColor.'"> |
} else { |
<td><small>'); |
$rowColor = $rowColor2; |
if ($$current{$user}{changestate} eq 'reenable') { |
} |
$r->print('<nobr><label>'. |
my $id = $current{$user}{id}; |
|
my $fullname = $current{$user}{fullname}; |
|
my $udom = $current{$user}{udom}; |
|
my $uname = $current{$user}{uname}; |
|
my $start = $current{$user}{start}; |
|
my $end = $current{$user}{end}; |
|
$r->print('<tr bgcolor="'.$rowColor.'"> |
|
<td><small>'); |
|
if ($current{$user}{changestate} eq 'reenable') { |
|
$r->print('<nobr><label>'. |
|
'<input type="checkbox" name="reenable" value="'.$user.'" />'. |
'<input type="checkbox" name="reenable" value="'.$user.'" />'. |
$lt{'reen'}.'</label></nobr><br />'); |
$lt{'reen'}.'</label></nobr><br />'); |
} elsif ($current{$user}{changestate} eq 'expire') { |
} elsif ($$current{$user}{changestate} eq 'expire') { |
$r->print('<nobr><label>'. |
$r->print('<nobr><label>'. |
'<input type="checkbox" name="expire" value="'.$user.'" />'. |
'<input type="checkbox" name="expire" value="'.$user.'" />'. |
$lt{'expi'}.'</label></nobr><br />'); |
$lt{'expi'}.'</label></nobr><br />'); |
} elsif ($current{$user}{changestate} eq 'activate') { |
} elsif ($$current{$user}{changestate} eq 'activate') { |
$r->print('<nobr><label>'. |
$r->print('<nobr><label>'. |
'<input type="checkbox" name="activate" value="'.$user.'" />'. |
'<input type="checkbox" name="activate" value="'.$user.'" />'. |
$lt{'acti'}.'</label></nobr><br />'); |
$lt{'acti'}.'</label></nobr><br />'); |
} |
} |
$r->print('<nobr><label>'. |
$r->print('<nobr><label>'. |
'<input type="checkbox" name="deletion" value="'.$user.'" />'. |
'<input type="checkbox" name="deletion" value="'.$user.'" />'. |
$lt{'dele'}.'</label></nobr>'); |
$lt{'dele'}.'</label></nobr>'); |
if ($specificity eq 'Yes') { |
if ($specificity eq 'Yes') { |
$r->print('<br /><nobr><label>'. |
$r->print('<br /><nobr><label>'. |
'<input type="checkbox" name="changepriv" value="'.$user.'" />'.$lt{'chpr'}. |
'<input type="checkbox" name="changepriv" value="'.$user.'" />'.$lt{'chpr'}. |
'</label></nobr>'); |
'</label></nobr>'); |
} |
} |
$r->print(' |
$r->print(' |
</td> |
</td> |
<td><small>'. |
<td><small>'. |
$fullname.'</small></td><td><small>'.$uname.'</small></td><td><small>'. |
$fullname.'</small></td><td><small>'.$uname.'</small></td><td><small>'. |
$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('<label><input type="checkbox" '. |
$r->print('<label><input type="checkbox" '. |
'checked="checked" '. |
'checked="checked" '. |
'name="user_'.$tool.'" value="'. |
'name="user_'.$tool.'" value="'. |
$user.'" />'.$tool.'</label>'); |
$user.'" />'.$tool.'</label>'); |
} else { |
} else { |
$r->print('<input type="hidden" '. |
$r->print('<input type="hidden" '. |
'checked="checked" '. |
'checked="checked" '. |
'name="user_'.$tool.'" value="'. |
'name="user_'.$tool.'" value="'. |
$user.'" />'.$tool); |
$user.'" />'.$tool); |
} |
} |
$r->print(' '); |
$r->print(' '); |
} |
|
$r->print('</nobr></small></td>'); |
|
} |
} |
if ($addtools) { |
$r->print('</nobr></small></td>'); |
$r->print('<td align="left"><small>'); |
} |
if ($granularity eq 'Yes') { |
if ($addtools) { |
foreach my $tool (@{$current{$user}{newtools}}) { |
$r->print('<td align="left"><small>'); |
$r->print('<nobr><label><input type="checkbox" |
if ($granularity eq 'Yes') { |
|
foreach my $tool (@{$$current{$user}{newtools}}) { |
|
$r->print('<nobr><label><input type="checkbox" |
name="user_'.$tool.'" value="'. |
name="user_'.$tool.'" value="'. |
$user.'" />'.$tool. |
$user.'" />'.$tool. |
'</label></nobr> '); |
'</label></nobr> '); |
} |
} |
} else { |
} else { |
foreach my $tool (@{$current{$user}{newtools}}) { |
foreach my $tool (@{$$current{$user}{newtools}}) { |
$r->print('<nobr><input type="hidden" |
$r->print('<nobr><input type="hidden" |
name="user_'. $tool.'" value="'. |
name="user_'. $tool.'" value="'. |
$user.'" />'.$tool. |
$user.'" />'.$tool. |
'</nobr> '); |
'</nobr> '); |
} |
|
} |
} |
$r->print('</small></td>'); |
|
} |
} |
$r->print('</tr>'."\n"); |
$r->print('</small></td>'); |
$rowNum ++; |
|
} |
} |
|
$r->print('</tr>'."\n"); |
|
$rowNum ++; |
} |
} |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
} |
$r->print(' |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
|
$r->print(' |
</td> |
</td> |
</tr>'); |
</tr>'); |
} |
|
} |
} |
return; |
return; |
} |
} |
Line 2991 sub write_group_data {
|
Line 2926 sub write_group_data {
|
'specificity','autoadd','autodrop','quota'); |
'specificity','autoadd','autodrop','quota'); |
my @mult_attributes = ('roles','types','sectionpick','defpriv'); |
my @mult_attributes = ('roles','types','sectionpick','defpriv'); |
|
|
|
my ($crsquota,$freespace,$maxposs) = &get_quota_constraints($action, |
|
$stored); |
|
my $quota = $env{'form.quota'}; |
|
|
|
$quota =~ s/^\s*([^\s]*)\s*$/$1/; |
|
if ($quota eq '') { |
|
$quota = 0; |
|
} |
|
if ($quota !~ /^\d*\.?\d*$/) { |
|
$quota = 0; |
|
$r->print(&mt('The value you entered for the quota for the file repository in this [_1] contained invalid characters, so it has been set to 0 Mb. You can change this by modifying the [_1] settings.<br />',$gpterm)); |
|
} |
|
if ($quota > $maxposs) { |
|
$quota = $maxposs; |
|
$r->print(&mt('The value you entered for the quota for the file repository in this [_1] exceeded the maximum possible value, so it has been set to [_2] Mb (the maximum possible value).<br />',$gpterm,$maxposs)); |
|
} |
my %groupinfo = ( |
my %groupinfo = ( |
description => $esc_description, |
description => $esc_description, |
startdate => $startdate, |
startdate => $startdate, |
Line 3002 sub write_group_data {
|
Line 2953 sub write_group_data {
|
specificity => $specificity, |
specificity => $specificity, |
autoadd => $env{'form.autoadd'}, |
autoadd => $env{'form.autoadd'}, |
autodrop => $env{'form.autodrop'}, |
autodrop => $env{'form.autodrop'}, |
quota => $env{'form.quota'}, |
quota => $quota, |
); |
); |
|
|
foreach my $func (keys(%{$functions})) { |
foreach my $func (keys(%{$functions})) { |
my $status; |
my $status; |
if (grep(/^$func$/,@{$tools})) { |
if (grep(/^$func$/,@{$tools})) { |
Line 3050 sub write_group_data {
|
Line 3002 sub write_group_data {
|
|
|
if ($result eq 'ok') { |
if ($result eq 'ok') { |
if ($action eq 'create') { |
if ($action eq 'create') { |
my $put_result = &create_homepage($cdom,$cnum,$groupname, |
my $result = &add_group_folder($cdom,$cnum,$now,$groupname,$action, |
\%groupinfo,$tools,$gpterm, |
$description,$tools,\%groupinfo, |
$ucgpterm); |
$gpterm,$ucgpterm,$crstype); |
|
if ($result ne 'ok') { |
|
$r->print(&mt('A problem occurred when creating folders for the new [_1]. [_2].<br />',$gpterm,$result)); |
|
} |
$r->print(&mt('[_1] [_2] was created.<br />',$ucgpterm,$groupname)); |
$r->print(&mt('[_1] [_2] was created.<br />',$ucgpterm,$groupname)); |
} else { |
} else { |
$r->print(&mt('[_1] [_2] was updated.<br />',$ucgpterm,$groupname)); |
$r->print(&mt('[_1] [_2] was updated.<br />',$ucgpterm,$groupname)); |
Line 3065 sub write_group_data {
|
Line 3020 sub write_group_data {
|
&Apache::lonnet::logthis("Failed to store $gpterm $groupname ". |
&Apache::lonnet::logthis("Failed to store $gpterm $groupname ". |
'in '.lc($crstype).': '.$cnum. |
'in '.lc($crstype).': '.$cnum. |
' in domain: '.$cdom); |
' in domain: '.$cdom); |
$r->print(&mt('An error occurred when [_1] the new [_2]. '. |
$r->print(&mt('An error occurred when [_1] the [_2]. '. |
'Please try again.',$actiontype{$action},$gpterm)); |
'Please try again.',$actiontype{$action},$gpterm)); |
} |
} |
return $result; |
return $result; |
Line 3578 sub date_setting_table {
|
Line 3533 sub date_setting_table {
|
return ($start_table, $end_table); |
return ($start_table, $end_table); |
} |
} |
|
|
|
sub add_group_folder { |
|
my ($cdom,$cnum,$now,$groupname,$action,$description,$tools,$groupinfo, |
|
$gpterm,$ucgpterm,$crstype) = @_; |
|
if ($cdom eq '' || $cnum eq '') { |
|
return &mt('Error: invalid course domain or number - group folder creation failed'); |
|
} |
|
my ($outcome,$allgrpsmap,$grpmap,$boardsmap,$grppage); |
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
|
my $crspath = '/uploaded/'.$cdom.'/'.$cnum.'/'; |
|
$allgrpsmap = $crspath.'default_0.sequence'; |
|
my $topmap = $navmap->getResourceByUrl($allgrpsmap); |
|
undef($navmap); |
|
if ($action eq 'create') { |
|
# check if default_0.sequence exists. |
|
if (!$topmap) { |
|
my $grpstitle = &mt('[_1] [_2]',$crstype,$ucgpterm); |
|
my $topmap_url = '/'.$env{'course.'.$env{'request.course.id'}.'.url'}; |
|
$topmap_url =~ s|/+|/|g; |
|
if ($topmap_url =~ m|^/uploaded|) { |
|
$outcome = &map_updater($cdom,$cnum,'default_0.sequence', |
|
'toplevelgroup',$grpstitle,$topmap_url); |
|
if ($outcome ne 'ok') { |
|
return $outcome; |
|
} |
|
} else { |
|
$outcome = &mt('Non-standard course - group folder not added.'); |
|
return $outcome; |
|
} |
|
} |
|
my $grpfolder = &mt('[_1] Folder -',$ucgpterm,).$description; |
|
$grppage='/adm/'.$cdom.'/'.$cnum.'/'.$groupname.'/grppg'; |
|
my $grptitle = &mt('Group homepage').' - '.$description; |
|
my ($seqid,$discussions,$disctitle); |
|
my $outcome = &map_updater($cdom,$cnum,'default_'.$now.'.sequence', |
|
'grpseq',$grpfolder,$allgrpsmap,$grppage, |
|
$grptitle); |
|
if ($outcome ne 'ok') { |
|
return $outcome; |
|
} |
|
my $pageout = &create_homepage($cdom,$cnum,$groupname,$groupinfo, |
|
$tools,$gpterm,$ucgpterm,$now); |
|
# Link to folder for bulletin boards |
|
$grpmap = $crspath.'default_'.$now.'.sequence'; |
|
if (grep/^discussion$/,@{$tools}) { |
|
$seqid = $now + 1; |
|
$disctitle = &mt('Discussion Boards'); |
|
my $outcome = &map_updater($cdom,$cnum,'default_'.$seqid. |
|
'.sequence','bbseq',$disctitle,$grpmap); |
|
if ($outcome ne 'ok') { |
|
return $outcome; |
|
} |
|
$boardsmap = $crspath.'default_'.$seqid.'.sequence'; |
|
} |
|
} else { |
|
#modify group folder if status of discussions tools is changed |
|
} |
|
my ($furl,$ferr)= &Apache::lonuserstate::readmap($cdom.'/'.$cnum); |
|
$navmap = Apache::lonnavmaps::navmap->new(); |
|
# modify parameters |
|
my $parm_result; |
|
if ($action eq 'create') { |
|
if ($allgrpsmap) { |
|
$parm_result .= &parm_setter($navmap,$cdom,$allgrpsmap,$groupname); |
|
} |
|
if ($grpmap) { |
|
$parm_result .= &parm_setter($navmap,$cdom,$grpmap,$groupname); |
|
} |
|
if ($grppage) { |
|
$parm_result .= &parm_setter($navmap,$cdom,$grppage,$groupname); |
|
} |
|
if ($boardsmap) { |
|
$parm_result .= &parm_setter($navmap,$cdom,$boardsmap,$groupname); |
|
} |
|
} |
|
if ($parm_result) { |
|
return $parm_result; |
|
} else { |
|
return 'ok'; |
|
} |
|
} |
|
|
|
sub map_updater { |
|
my ($cdom,$cnum,$newfile,$itemname,$itemtitle,$parentmap,$startsrc, |
|
$starttitle,$endsrc,$endtitle) = @_; |
|
my $outcome; |
|
$env{'form.'.$itemname} = &new_map($startsrc,$starttitle,$endsrc, |
|
$endtitle); |
|
my $newmapurl=&Apache::lonnet::finishuserfileupload($cnum,$cdom,$itemname, |
|
$newfile); |
|
if ($newmapurl !~ m|^/uploaded|) { |
|
$outcome = &mt('Error uploading new folder.')." ($newfile): $newmapurl".'<br />'; |
|
return $outcome; |
|
} |
|
my ($errtext,$fatal)=&Apache::lonratedt::mapread($parentmap); |
|
if ($fatal) { |
|
$outcome = &mt('Error reading contents of parent folder')." ($parentmap): $errtext".'<br />'; |
|
return $outcome; |
|
} else { |
|
my $newidx=&Apache::lonratedt::getresidx($newmapurl); |
|
$Apache::lonratedt::resources[$newidx] = $itemtitle.':'.$newmapurl. |
|
':false:normal:res'; |
|
$Apache::lonratedt::order[1+$#Apache::lonratedt::order]=$newidx; |
|
my ($outtext,$errtext) = &Apache::lonratedt::storemap($parentmap,1); |
|
if ($errtext) { |
|
$outcome = &mt('Error storing updated parent folder')." ($parentmap): $errtext".'<br />'; |
|
return $outcome; |
|
} |
|
} |
|
return 'ok'; |
|
} |
|
|
|
sub new_map { |
|
my ($startsrc,$starttitle,$endsrc,$endtitle) = @_; |
|
my $newmapstr = ' |
|
<map> |
|
<resource id="1" src="'.$startsrc.'" type="start" title="'.$starttitle.'"></resource> |
|
<link from="1" to="2" index="1"></link> |
|
<resource id="2" src="'.$endsrc.'" type="finish" title="'.$endtitle.'"></resource> |
|
</map> |
|
'; |
|
return $newmapstr; |
|
} |
|
|
|
sub parm_setter { |
|
my ($navmap,$cdom,$url,$groupname) = @_; |
|
my $allresults; |
|
my %hide_settings = ( |
|
'course' => { |
|
'num' => 13, |
|
'set' => 'yes', |
|
}, |
|
'group' => { |
|
'num' => 5, |
|
'set' => 'no', |
|
'extra' => $groupname, |
|
}, |
|
); |
|
my $res = $navmap->getResourceByUrl($url); |
|
my $symb = $res->symb(); |
|
foreach my $level (keys(%hide_settings)) { |
|
my $parmresult = &Apache::lonparmset::storeparm_by_symb($symb, |
|
'0_hiddenresource', |
|
$hide_settings{$level}{'num'}, |
|
$hide_settings{$level}{'set'}, |
|
'string_yesno',undef,$cdom, |
|
undef,undef, |
|
$hide_settings{$level}{'extra'}); |
|
if ($parmresult) { |
|
$allresults .= $level.': '.$parmresult; |
|
} |
|
} |
|
return $allresults; |
|
} |
|
|
sub create_homepage { |
sub create_homepage { |
my ($cdom,$cnum,$name,$groupinfo,$tools,$gpterm,$ucgpterm) = @_; |
my ($cdom,$cnum,$name,$groupinfo,$tools,$gpterm,$ucgpterm,$now) = @_; |
my $functionality = join(',',@{$tools}); |
my $functionality = join(',',@{$tools}); |
my $content = &unescape($$groupinfo{description}); |
my $content = &unescape($$groupinfo{description}); |
$content=~s/\s+$//s; |
$content=~s/\s+$//s; |
Line 3592 sub create_homepage {
|
Line 3701 sub create_homepage {
|
'abb_links' => $functionality, |
'abb_links' => $functionality, |
'bbb_content' => $content, |
'bbb_content' => $content, |
'ccc_webreferences' => '', |
'ccc_webreferences' => '', |
'uploaded.lastmodified' => time, |
'uploaded.lastmodified' => $now, |
); |
); |
my $putresult = &Apache::lonnet::put('grppage_'.$name,\%pageinfo,$cdom,$cnum); |
my $putresult = &Apache::lonnet::put('grppage_'.$name,\%pageinfo,$cdom,$cnum); |
return $putresult; |
return $putresult; |