version 1.34, 2006/06/30 22:38:26
|
version 1.37, 2006/07/04 20:50:52
|
Line 368 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 438 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 686 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 757 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 868 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 1242 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 1348 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 1780 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 2227 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 2347 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 2362 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 2375 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}))) { |
|
if ($env{'form.sortby'} eq 'fullname') { |
|
push(@{$Sortby{$$current{$user}{fullname}}},$user); |
|
} elsif ($env{'form.sortby'} eq 'username') { |
|
push(@{$Sortby{$$current{$user}{uname}}},$user); |
|
} elsif ($env{'form.sortby'} eq 'domain') { |
|
push(@{$Sortby{$$current{$user}{udom}}},$user); |
|
} elsif ($env{'form.sortby'} eq 'id') { |
|
push(@{$Sortby{$$current{$user}{id}}},$user); |
|
} else { |
|
push(@{$Sortby{$$current{$user}{fullname}}},$user); |
} |
} |
my %Sortby = (); |
} |
foreach my $user (sort(keys(%current))) { |
my $rowNum = 0; |
if ($env{'form.sortby'} eq 'fullname') { |
my $rowColor; |
push(@{$Sortby{$current{$user}{fullname}}},$user); |
foreach my $key (sort(keys(%Sortby))) { |
} elsif ($env{'form.sortby'} eq 'username') { |
foreach my $user (@{$Sortby{$key}}) { |
push(@{$Sortby{$current{$user}{uname}}},$user); |
if ($rowNum %2 == 1) { |
} elsif ($env{'form.sortby'} eq 'domain') { |
$rowColor = $rowColor1; |
push(@{$Sortby{$current{$user}{udom}}},$user); |
|
} elsif ($env{'form.sortby'} eq 'id') { |
|
push(@{$Sortby{$current{$user}{id}}},$user); |
|
} 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 2995 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 3006 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 3058 sub write_group_data {
|
Line 3006 sub write_group_data {
|
$description,$tools,\%groupinfo, |
$description,$tools,\%groupinfo, |
$gpterm,$ucgpterm,$crstype); |
$gpterm,$ucgpterm,$crstype); |
if ($result ne 'ok') { |
if ($result ne 'ok') { |
$r->print(&mt('A problem occurred when creating folders for the new [_1]. [_2].',$gpterm,$result)); |
$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 { |
Line 3072 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 3675 sub map_updater {
|
Line 3623 sub map_updater {
|
my $newmapurl=&Apache::lonnet::finishuserfileupload($cnum,$cdom,$itemname, |
my $newmapurl=&Apache::lonnet::finishuserfileupload($cnum,$cdom,$itemname, |
$newfile); |
$newfile); |
if ($newmapurl !~ m|^/uploaded|) { |
if ($newmapurl !~ m|^/uploaded|) { |
$outcome = "Error uploading new folder ($newfile): $newmapurl"; |
$outcome = &mt('Error uploading new folder.')." ($newfile): $newmapurl".'<br />'; |
return $outcome; |
return $outcome; |
} |
} |
my ($errtext,$fatal)=&Apache::lonratedt::mapread($parentmap); |
my ($errtext,$fatal)=&Apache::lonratedt::mapread($parentmap); |
if ($fatal) { |
if ($fatal) { |
$outcome = "Error reading contents of parent folder ($parentmap): $errtext\n"; |
$outcome = &mt('Error reading contents of parent folder')." ($parentmap): $errtext".'<br />'; |
return $outcome; |
return $outcome; |
} else { |
} else { |
my $newidx=&Apache::lonratedt::getresidx($newmapurl); |
my $newidx=&Apache::lonratedt::getresidx($newmapurl); |
Line 3689 sub map_updater {
|
Line 3637 sub map_updater {
|
$Apache::lonratedt::order[1+$#Apache::lonratedt::order]=$newidx; |
$Apache::lonratedt::order[1+$#Apache::lonratedt::order]=$newidx; |
my ($outtext,$errtext) = &Apache::lonratedt::storemap($parentmap,1); |
my ($outtext,$errtext) = &Apache::lonratedt::storemap($parentmap,1); |
if ($errtext) { |
if ($errtext) { |
$outcome = "Error storing updated parent folder ($parentmap): $errtext\n"; |
$outcome = &mt('Error storing updated parent folder')." ($parentmap): $errtext".'<br />'; |
return $outcome; |
return $outcome; |
} |
} |
} |
} |
Line 3710 sub new_map {
|
Line 3658 sub new_map {
|
|
|
sub parm_setter { |
sub parm_setter { |
my ($navmap,$cdom,$url,$groupname) = @_; |
my ($navmap,$cdom,$url,$groupname) = @_; |
my %parmresult; |
my $allresults; |
my %hide_settings = ( |
my %hide_settings = ( |
'course' => { |
'course' => { |
'num' => 13, |
'num' => 13, |
Line 3725 sub parm_setter {
|
Line 3673 sub parm_setter {
|
my $res = $navmap->getResourceByUrl($url); |
my $res = $navmap->getResourceByUrl($url); |
my $symb = $res->symb(); |
my $symb = $res->symb(); |
foreach my $level (keys(%hide_settings)) { |
foreach my $level (keys(%hide_settings)) { |
$parmresult{$level} = &Apache::lonparmset::storeparm_by_symb($symb, |
my $parmresult = &Apache::lonparmset::storeparm_by_symb($symb, |
'0_hiddenresource', |
'0_hiddenresource', |
$hide_settings{$level}{'num'}, |
$hide_settings{$level}{'num'}, |
$hide_settings{$level}{'set'}, |
$hide_settings{$level}{'set'}, |
'string_yesno',undef,$cdom, |
'string_yesno',undef,$cdom, |
undef,undef, |
undef,undef, |
$hide_settings{$level}{'extra'}); |
$hide_settings{$level}{'extra'}); |
|
if ($parmresult) { |
|
$allresults .= $level.': '.$parmresult; |
|
} |
} |
} |
return %parmresult; |
return $allresults; |
} |
} |
|
|
sub create_homepage { |
sub create_homepage { |