version 1.133, 2006/11/21 21:03:06
|
version 1.134, 2006/11/21 21:38:44
|
Line 116 sub authorpriv {
|
Line 116 sub authorpriv {
|
return 1; |
return 1; |
} |
} |
|
|
|
# ==================================================== |
|
|
|
sub portfolio_quota { |
|
my ($ccuname,$ccdomain) = @_; |
|
my %lt = &Apache::lonlocal::texthash( |
|
'disk' => "Disk space allocated to user's portfolio files", |
|
); |
|
my $output = '<h3>'.$lt{'disk'}.'</h3>'. |
|
'<input type="text" name="portfolioquota" size ="5" value="'. |
|
&Apache::loncommon::get_user_quota($ccuname,$ccdomain). |
|
'" /> Mb'; |
|
return $output; |
|
} |
|
|
# =================================================================== Phase one |
# =================================================================== Phase one |
|
|
sub print_username_entry_form { |
sub print_username_entry_form { |
Line 501 ENDFORMINFO
|
Line 515 ENDFORMINFO
|
'hs' => "Home Server", |
'hs' => "Home Server", |
'lg' => "Login Data" |
'lg' => "Login Data" |
); |
); |
|
my $portfolioform; |
|
if (&Apache::lonnet::allowed('mpq',$env{'request.role.domain'})) { |
|
# Current user has quota modification privileges |
|
$portfolioform = &portfolio_quota($ccuname,$ccdomain); |
|
} |
my $genhelp=&Apache::loncommon::help_open_topic('Generation'); |
my $genhelp=&Apache::loncommon::help_open_topic('Generation'); |
&initialize_authen_forms(); |
&initialize_authen_forms(); |
$r->print(<<ENDNEWUSER); |
$r->print(<<ENDNEWUSER); |
Line 533 $lt{'hs'}: <select name="hserver" size="
|
Line 552 $lt{'hs'}: <select name="hserver" size="
|
<p>$authformint </p> |
<p>$authformint </p> |
<p>$authformfsys</p> |
<p>$authformfsys</p> |
<p>$authformloc </p> |
<p>$authformloc </p> |
|
<hr /> |
|
$portfolioform |
ENDNEWUSER |
ENDNEWUSER |
} else { # user already exists |
} else { # user already exists |
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
Line 552 $forminfo
|
Line 573 $forminfo
|
ENDCHANGEUSER |
ENDCHANGEUSER |
# Get the users information |
# Get the users information |
my %userenv = &Apache::lonnet::get('environment', |
my %userenv = &Apache::lonnet::get('environment', |
['firstname','middlename','lastname','generation'], |
['firstname','middlename','lastname','generation', |
$ccdomain,$ccuname); |
'portfolioquota'],$ccdomain,$ccuname); |
my %rolesdump=&Apache::lonnet::dump('roles',$ccdomain,$ccuname); |
my %rolesdump=&Apache::lonnet::dump('roles',$ccdomain,$ccuname); |
$r->print(<<END); |
$r->print(<<END); |
<hr /> |
<hr /> |
Line 875 $lt{'yodo'} $lt{'ifch'}: $ccdomain
|
Line 896 $lt{'yodo'} $lt{'ifch'}: $ccdomain
|
ENDNOPRIV |
ENDNOPRIV |
} |
} |
} |
} |
|
if (&Apache::lonnet::allowed('mpq',$env{'request.role.domain'})) { |
|
# Current user has quota modification privileges |
|
$r->print(&portfolio_quota($ccuname,$ccdomain)); |
|
} |
} ## End of "check for bad authentication type" logic |
} ## End of "check for bad authentication type" logic |
} ## End of new user/old user logic |
} ## End of new user/old user logic |
$r->print('<hr /><h3>'.&mt('Add Roles').'</h3>'); |
$r->print('<hr /><h3>'.&mt('Add Roles').'</h3>'); |
Line 1122 ENDMODIFYUSERHEAD
|
Line 1147 ENDMODIFYUSERHEAD
|
if (! $env{'form.makeuser'} ) { |
if (! $env{'form.makeuser'} ) { |
# Check for need to change |
# Check for need to change |
my %userenv = &Apache::lonnet::get |
my %userenv = &Apache::lonnet::get |
('environment',['firstname','middlename','lastname','generation'], |
('environment',['firstname','middlename','lastname','generation', |
$env{'form.ccdomain'},$env{'form.ccuname'}); |
'portfolioquota'],$env{'form.ccdomain'},$env{'form.ccuname'}); |
my ($tmp) = keys(%userenv); |
my ($tmp) = keys(%userenv); |
if ($tmp =~ /^(con_lost|error)/i) { |
if ($tmp =~ /^(con_lost|error)/i) { |
%userenv = (); |
%userenv = (); |
Line 1133 ENDMODIFYUSERHEAD
|
Line 1158 ENDMODIFYUSERHEAD
|
# Strip leading and trailing whitespace |
# Strip leading and trailing whitespace |
$env{'form.c'.$_} =~ s/(\s+$|^\s+)//g; |
$env{'form.c'.$_} =~ s/(\s+$|^\s+)//g; |
} |
} |
|
my ($quotachanged,$namechanged,$oldportfolioquota); |
|
my %changeHash; |
|
if (exists($userenv{'portfolioquota'})) { |
|
$oldportfolioquota = $userenv{'portfolioquota'}; |
|
if (exists($env{'form.portfolioquota'})) { |
|
if ($env{'form.portfolioquota'} ne $userenv{'portfolioquota'}) { |
|
if (&Apache::lonnet::allowed('mpq',$env{'form.ccdomain'})) { |
|
# Current user has quota modification privileges |
|
$quotachanged = 1; |
|
$changeHash{'portfolioquota'} = $env{'form.portfolioquota'}; |
|
} |
|
} |
|
} |
|
} else { |
|
$oldportfolioquota = &default_quota($env{'form.ccdomain'}); |
|
} |
if (&Apache::lonnet::allowed('mau',$env{'form.ccdomain'}) && |
if (&Apache::lonnet::allowed('mau',$env{'form.ccdomain'}) && |
($env{'form.cfirstname'} ne $userenv{'firstname'} || |
($env{'form.cfirstname'} ne $userenv{'firstname'} || |
$env{'form.cmiddlename'} ne $userenv{'middlename'} || |
$env{'form.cmiddlename'} ne $userenv{'middlename'} || |
$env{'form.clastname'} ne $userenv{'lastname'} || |
$env{'form.clastname'} ne $userenv{'lastname'} || |
$env{'form.cgeneration'} ne $userenv{'generation'} )) { |
$env{'form.cgeneration'} ne $userenv{'generation'} )) { |
|
$namechanged = 1; |
|
} |
|
if ($namechanged) { |
# Make the change |
# Make the change |
my %changeHash; |
|
$changeHash{'firstname'} = $env{'form.cfirstname'}; |
$changeHash{'firstname'} = $env{'form.cfirstname'}; |
$changeHash{'middlename'} = $env{'form.cmiddlename'}; |
$changeHash{'middlename'} = $env{'form.cmiddlename'}; |
$changeHash{'lastname'} = $env{'form.clastname'}; |
$changeHash{'lastname'} = $env{'form.clastname'}; |
Line 1155 ENDMODIFYUSERHEAD
|
Line 1198 ENDMODIFYUSERHEAD
|
'mddl' => "middle", |
'mddl' => "middle", |
'lst' => "last", |
'lst' => "last", |
'gen' => "generation", |
'gen' => "generation", |
|
'disk' => "disk space allocated to portfolio files", |
'prvs' => "Previous", |
'prvs' => "Previous", |
'chto' => "Changed To" |
'chto' => "Changed To" |
); |
); |
Line 1165 ENDMODIFYUSERHEAD
|
Line 1209 ENDMODIFYUSERHEAD
|
<th>$lt{'frst'}</th> |
<th>$lt{'frst'}</th> |
<th>$lt{'mddl'}</th> |
<th>$lt{'mddl'}</th> |
<th>$lt{'lst'}</th> |
<th>$lt{'lst'}</th> |
<th>$lt{'gen'}</th></tr> |
<th>$lt{'gen'}</th> |
|
<th>$lt{'disk'}<th></tr> |
<tr><td>$lt{'prvs'}</td> |
<tr><td>$lt{'prvs'}</td> |
<td>$userenv{'firstname'} </td> |
<td>$userenv{'firstname'} </td> |
<td>$userenv{'middlename'} </td> |
<td>$userenv{'middlename'} </td> |
<td>$userenv{'lastname'} </td> |
<td>$userenv{'lastname'} </td> |
<td>$userenv{'generation'} </td></tr> |
<td>$userenv{'generation'} </td> |
|
<td>$oldportfolioquota</td> |
|
</tr> |
<tr><td>$lt{'chto'}</td> |
<tr><td>$lt{'chto'}</td> |
<td>$env{'form.cfirstname'} </td> |
<td>$env{'form.cfirstname'} </td> |
<td>$env{'form.cmiddlename'} </td> |
<td>$env{'form.cmiddlename'} </td> |
<td>$env{'form.clastname'} </td> |
<td>$env{'form.clastname'} </td> |
<td>$env{'form.cgeneration'} </td></tr> |
<td>$env{'form.cgeneration'} </td> |
|
<td>$env{'form.portfolioquota'} Mb</td></tr> |
</table> |
</table> |
END |
END |
} else { # error occurred |
} else { # error occurred |
Line 1184 END
|
Line 1232 END
|
$env{'form.ccdomain'}."</h2>"); |
$env{'form.ccdomain'}."</h2>"); |
} |
} |
} else { # End of if ($env ... ) logic |
} else { # End of if ($env ... ) logic |
|
my $putresult; |
|
if ($quotachanged) { |
|
$putresult = &Apache::lonnet::put |
|
('environment',\%changeHash, |
|
$env{'form.ccdomain'},$env{'form.ccuname'}); |
|
} |
# They did not want to change the users name but we can |
# They did not want to change the users name but we can |
# still tell them what the name is |
# still tell them what the name is |
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'usr' => "User", |
'usr' => "User", |
'id' => "in domain", |
'id' => "in domain", |
'gen' => "Generation" |
'gen' => "Generation", |
|
'disk' => "Disk space allocated to user's portfolio files", |
); |
); |
$r->print(<<"END"); |
$r->print(<<"END"); |
<h2>$lt{'usr'} "$env{'form.ccuname'}" $lt{'id'} "$env{'form.ccdomain'}"</h2> |
<h2>$lt{'usr'} "$env{'form.ccuname'}" $lt{'id'} "$env{'form.ccdomain'}"</h2> |
<h4>$userenv{'firstname'} $userenv{'middlename'} $userenv{'lastname'} </h4> |
<h4>$userenv{'firstname'} $userenv{'middlename'} $userenv{'lastname'} </h4> |
<h4>$lt{'gen'}: $userenv{'generation'}</h4> |
<h4>$lt{'gen'}: $userenv{'generation'}</h4> |
END |
END |
|
if ($putresult eq 'ok') { |
|
if ($oldportfolioquota ne $env{'form.portfolioquota'}) { |
|
$r->print('<h4>'.$lt{'disk'}.': '.$env{'form.portfolioquota'}.' Mb</h4>'); |
|
} |
|
} |
} |
} |
} |
} |
## |
## |