version 1.203, 2007/12/06 04:03:35
|
version 1.204, 2007/12/07 23:09:30
|
Line 1623 sub update_user_data {
|
Line 1623 sub update_user_data {
|
} |
} |
} |
} |
my ($quotachanged,$namechanged,$oldportfolioquota,$newportfolioquota, |
my ($quotachanged,$namechanged,$oldportfolioquota,$newportfolioquota, |
$inststatus,$isdefault,$defquotatext); |
$inststatus,$oldisdefault,$newisdefault,$olddefquotatext, |
|
$newdefquotatext); |
my ($defquota,$settingstatus) = |
my ($defquota,$settingstatus) = |
&Apache::loncommon::default_quota($env{'form.ccdomain'},$inststatus); |
&Apache::loncommon::default_quota($env{'form.ccdomain'},$inststatus); |
my %changeHash; |
my %changeHash; |
|
$changeHash{'portfolioquota'} = $userenv{'portfolioquota'}; |
if ($userenv{'portfolioquota'} ne '') { |
if ($userenv{'portfolioquota'} ne '') { |
$oldportfolioquota = $userenv{'portfolioquota'}; |
$oldportfolioquota = $userenv{'portfolioquota'}; |
if ($env{'form.customquota'} == 1) { |
if ($env{'form.customquota'} == 1) { |
Line 1636 sub update_user_data {
|
Line 1638 sub update_user_data {
|
$newportfolioquota = $env{'form.portfolioquota'}; |
$newportfolioquota = $env{'form.portfolioquota'}; |
$newportfolioquota =~ s/[^\d\.]//g; |
$newportfolioquota =~ s/[^\d\.]//g; |
} |
} |
if ($newportfolioquota != $userenv{'portfolioquota'}) { |
if ($newportfolioquota != $oldportfolioquota) { |
$quotachanged = "a_admin($newportfolioquota,\%changeHash); |
$quotachanged = "a_admin($newportfolioquota,\%changeHash); |
} |
} |
} else { |
} else { |
$quotachanged = "a_admin('',\%changeHash); |
$quotachanged = "a_admin('',\%changeHash); |
$newportfolioquota = $defquota; |
$newportfolioquota = $defquota; |
$isdefault = 1; |
$newisdefault = 1; |
} |
} |
} else { |
} else { |
|
$oldisdefault = 1; |
$oldportfolioquota = $defquota; |
$oldportfolioquota = $defquota; |
if ($env{'form.customquota'} == 1) { |
if ($env{'form.customquota'} == 1) { |
if ($env{'form.portfolioquota'} eq '') { |
if ($env{'form.portfolioquota'} eq '') { |
Line 1656 sub update_user_data {
|
Line 1659 sub update_user_data {
|
$quotachanged = "a_admin($newportfolioquota,\%changeHash); |
$quotachanged = "a_admin($newportfolioquota,\%changeHash); |
} else { |
} else { |
$newportfolioquota = $defquota; |
$newportfolioquota = $defquota; |
$isdefault = 1; |
$newisdefault = 1; |
} |
} |
} |
} |
if ($isdefault) { |
if ($oldisdefault) { |
if ($settingstatus eq '') { |
$olddefquotatext = &get_defaultquota_text($settingstatus); |
$defquotatext = &mt('(default)'); |
} |
} else { |
if ($newisdefault) { |
my ($usertypes,$order) = |
$newdefquotatext = &get_defaultquota_text($settingstatus); |
&Apache::lonnet::retrieve_inst_usertypes($env{'form.ccdomain'}); |
|
if ($usertypes->{$settingstatus} eq '') { |
|
$defquotatext = &mt('(default)'); |
|
} else { |
|
$defquotatext = &mt('(default for [_1])',$usertypes->{$settingstatus}); |
|
} |
|
} |
|
} |
} |
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'} || |
Line 1681 sub update_user_data {
|
Line 1677 sub update_user_data {
|
$env{'form.cpermanentemail'} ne $userenv{'permanentemail'} )) { |
$env{'form.cpermanentemail'} ne $userenv{'permanentemail'} )) { |
$namechanged = 1; |
$namechanged = 1; |
} |
} |
if ($namechanged) { |
if ($namechanged || $quotachanged) { |
# Make the change |
|
$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'}; |
$changeHash{'generation'} = $env{'form.cgeneration'}; |
$changeHash{'generation'} = $env{'form.cgeneration'}; |
$changeHash{'id'} = $env{'form.cid'}; |
$changeHash{'id'} = $env{'form.cid'}; |
$changeHash{'permanentemail'} = $env{'form.cpermanentemail'}; |
$changeHash{'permanentemail'} = $env{'form.cpermanentemail'}; |
my $putresult = &Apache::lonnet::put |
my ($quotachgresult,$namechgresult); |
('environment',\%changeHash, |
if ($quotachanged) { |
$env{'form.ccdomain'},$env{'form.ccuname'}); |
$quotachgresult = |
if ($putresult eq 'ok') { |
&Apache::lonnet::put('environment',\%changeHash, |
|
$env{'form.ccdomain'},$env{'form.ccuname'}); |
|
} |
|
if ($namechanged) { |
|
# Make the change |
|
$namechgresult = |
|
&Apache::lonnet::modifyuser($env{'form.ccdomain'}, |
|
$env{'form.ccuname'},$changeHash{'id'},undef,undef, |
|
$changeHash{'firstname'},$changeHash{'middlename'}, |
|
$changeHash{'lastname'},$changeHash{'generation'}, |
|
$changeHash{'id'},undef,$changeHash{'permanentemail'}); |
|
} |
|
if (($namechanged && $namechgresult eq 'ok') || |
|
($quotachanged && $quotachgresult eq 'ok')) { |
# Tell the user we changed the name |
# Tell the user we changed the name |
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'uic' => "User Information Changed", |
'uic' => "User Information Changed", |
Line 1729 END
|
Line 1737 END
|
<td>$userenv{'generation'} </td> |
<td>$userenv{'generation'} </td> |
<td>$userenv{'id'}</td> |
<td>$userenv{'id'}</td> |
<td>$userenv{'permanentemail'} </td> |
<td>$userenv{'permanentemail'} </td> |
<td>$oldportfolioquota Mb</td> |
<td>$oldportfolioquota Mb $olddefquotatext </td> |
END |
END |
$r->print(&Apache::loncommon::end_data_table_row(). |
$r->print(&Apache::loncommon::end_data_table_row(). |
&Apache::loncommon::start_data_table_row()); |
&Apache::loncommon::start_data_table_row()); |
Line 1741 END
|
Line 1749 END
|
<td>$env{'form.cgeneration'} </td> |
<td>$env{'form.cgeneration'} </td> |
<td>$env{'form.cid'} </td> |
<td>$env{'form.cid'} </td> |
<td>$env{'form.cpermanentemail'} </td> |
<td>$env{'form.cpermanentemail'} </td> |
<td>$newportfolioquota Mb $defquotatext </td> |
<td>$newportfolioquota Mb $newdefquotatext </td> |
END |
END |
$r->print(&Apache::loncommon::end_data_table_row(). |
$r->print(&Apache::loncommon::end_data_table_row(). |
&Apache::loncommon::end_data_table()); |
&Apache::loncommon::end_data_table()); |
Line 1778 END
|
Line 1786 END
|
$env{'form.ccdomain'}.'</span>'); |
$env{'form.ccdomain'}.'</span>'); |
} |
} |
} else { # End of if ($env ... ) logic |
} else { # End of if ($env ... ) logic |
my $putresult; |
# They did not want to change the users name or quota but we can |
if ($quotachanged) { |
# still tell them what the name and quota are |
$putresult = &Apache::lonnet::put |
|
('environment',\%changeHash, |
|
$env{'form.ccdomain'},$env{'form.ccuname'}); |
|
} |
|
# They did not want to change the users name but we can |
|
# still tell them what the name is |
|
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'id' => "ID/Student number", |
'id' => "ID/Student number", |
'mail' => "Permanent e-mail", |
'mail' => "Permanent e-mail", |
Line 1794 END
|
Line 1796 END
|
$r->print(<<"END"); |
$r->print(<<"END"); |
<h4>$userenv{'firstname'} $userenv{'middlename'} $userenv{'lastname'} $userenv{'generation'} |
<h4>$userenv{'firstname'} $userenv{'middlename'} $userenv{'lastname'} $userenv{'generation'} |
END |
END |
if ($userenv{'permanentemail'} eq '') { |
if ($userenv{'permanentemail'} ne '') { |
$r->print('</h4>'); |
$r->print('<br />['.$lt{'mail'}.': '. |
} else { |
$userenv{'permanentemail'}.']'); |
$r->print(' ('.$lt{'mail'}.': '. |
|
$userenv{'permanentemail'}.')</h4>'); |
|
} |
|
if ($putresult eq 'ok') { |
|
if ($oldportfolioquota != $newportfolioquota) { |
|
$r->print('<h4>'.$lt{'disk'}.': '.$newportfolioquota.' Mb '. |
|
$defquotatext.'</h4>'); |
|
&Apache::lonnet::appenv('environment.portfolioquota' => $changeHash{'portfolioquota'}); |
|
} |
|
} |
} |
|
$r->print('<br />['.$lt{'disk'}.': '.$oldportfolioquota.' Mb '. |
|
$olddefquotatext.']</h4>'); |
} |
} |
} |
} |
## |
## |
Line 2035 END
|
Line 2030 END
|
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
} |
} |
|
|
|
sub get_defaultquota_text { |
|
my ($settingstatus) = @_; |
|
my $defquotatext; |
|
if ($settingstatus eq '') { |
|
$defquotatext = &mt('(default)'); |
|
} else { |
|
my ($usertypes,$order) = |
|
&Apache::lonnet::retrieve_inst_usertypes($env{'form.ccdomain'}); |
|
if ($usertypes->{$settingstatus} eq '') { |
|
$defquotatext = &mt('(default)'); |
|
} else { |
|
$defquotatext = &mt('(default for [_1])',$usertypes->{$settingstatus}); |
|
} |
|
} |
|
return $defquotatext; |
|
} |
|
|
sub update_result_form { |
sub update_result_form { |
my ($uhome) = @_; |
my ($uhome) = @_; |
my $outcome = |
my $outcome = |