--- loncom/interface/loncreateuser.pm 2006/06/02 13:58:31 1.120 +++ loncom/interface/loncreateuser.pm 2007/06/07 22:23:11 1.150 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.120 2006/06/02 13:58:31 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.150 2007/06/07 22:23:11 banghart Exp $ # # Copyright Michigan State University Board of Trustees # @@ -66,7 +66,7 @@ use Apache::loncommon; use Apache::lonlocal; use Apache::longroup; use lib '/home/httpd/lib/perl/'; -use LONCAPA; +use LONCAPA qw(:DEFAULT :match); my $loginscript; # piece of javascript used in two separate instances my $generalrule; @@ -99,8 +99,8 @@ sub initialize_authen_forms { sub my_custom_roles { my %returnhash=(); my %rolehash=&Apache::lonnet::dump('roles'); - foreach (keys %rolehash) { - if ($_=~/^rolesdef\_(\w+)$/) { + foreach my $key (keys %rolehash) { + if ($key=~/^rolesdef\_(\w+)$/) { $returnhash{$1}=$1; } } @@ -116,12 +116,86 @@ sub authorpriv { return 1; } +# ==================================================== + +sub portfolio_quota { + my ($ccuname,$ccdomain) = @_; + my %lt = &Apache::lonlocal::texthash( + 'disk' => "Disk space allocated to user's portfolio files", + 'cuqu' => "Current quota", + 'cust' => "Custom quota", + 'defa' => "Default", + 'chqu' => "Change quota", + ); + my ($currquota,$quotatype,$inststatus,$defquota) = + &Apache::loncommon::get_user_quota($ccuname,$ccdomain); + my ($usertypes,$order) = &Apache::lonnet::retrieve_inst_usertypes($ccdomain); + my ($longinsttype,$showquota,$custom_on,$custom_off,$defaultinfo); + if ($inststatus ne '') { + if ($usertypes->{$inststatus} ne '') { + $longinsttype = $usertypes->{$inststatus}; + } + } + $custom_on = ' '; + $custom_off = ' checked="checked" '; + my $quota_javascript = <<"END_SCRIPT"; + +END_SCRIPT + if ($quotatype eq 'custom') { + $custom_on = $custom_off; + $custom_off = ' '; + $showquota = $currquota; + if ($longinsttype eq '') { + $defaultinfo = &mt('For this user, the default quota would be [_1] + Mb.',$defquota); + } else { + $defaultinfo = &mt("For this user, the default quota would be [_1] + Mb, as determined by the user's institutional + affiliation ([_2]).",$defquota,$longinsttype); + } + } else { + if ($longinsttype eq '') { + $defaultinfo = &mt('For this user, the default quota is [_1] + Mb.',$defquota); + } else { + $defaultinfo = &mt("For this user, the default quota of [_1] + Mb, is determined by the user's institutional + affiliation ([_2]).",$defquota,$longinsttype); + } + } + my $output = $quota_javascript. + '
$lt{'rev'} | $lt{'ren'} | $lt{'del'} | $lt{'rol'} | $lt{'e -xt'} | $lt{'sta'} | $lt{'end'} | -END +'.$lt{'rev'}.' | '.$lt{'ren'}.' | '.$lt{'del'}. +' | '.$lt{'rol'}.' | '.$lt{'ext'}. +' | '.$lt{'sta'}.' | '.$lt{'end'}.' | '. +&Apache::loncommon::end_data_table_header_row()); foreach my $type ('Construction Space','Course','Group','Domain','System','Unknown') { if ($output{$type}) { $r->print($output{$type}."\n"); } } - $r->print('
---|
$authformloc
ENDBADAUTH } else { - # This user is not allowed to modify the users + # This user is not allowed to modify the user's # authentication scheme, so just notify them of the problem my %lt=&Apache::lonlocal::texthash( 'err' => "ERROR", @@ -802,9 +854,6 @@ ENDBADAUTH ); $r->print(<$authformint
$authformfsys
"; } $authformcurrent.=' (will override current values)$lt{'act'} | $lt{'rol'} | $lt{'ext'} | -$lt{'sta'} | $lt{'end'} | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
- | $lt{'cau'} | -$cudom\_$cuname | -
+ $r->print(''.$lt{'cs'}.''."\n". + &Apache::loncommon::start_data_table()."\n". + &Apache::loncommon::start_data_table_header_row()."\n". + ' | '.$lt{'act'}.' | '.$lt{'rol'}.' | '. + ''.$lt{'ext'}.' | '.$lt{'sta'}.' | '. + ''.$lt{'end'}.' | '."\n". + &Apache::loncommon::end_data_table_header_row()."\n". + &Apache::loncommon::start_data_table_row()."\n". + '+ + | +'.$lt{'cau'}.' | +'.$cudom.'_'.$cuname.' | ++ '.$lt{'ssd'}.' | +$lt{'ssd'} | -+"javascript:pjump('."'date_end','End Date Co-Author',document.cu.end_$cudom\_$cuname\_ca.value,'end_$cudom\_$cuname\_ca','cu.pres','dateset'".')">'.$lt{'sed'}.' | '."\n". + &Apache::loncommon::end_data_table_row()."\n". + &Apache::loncommon::start_data_table_row()."\n". +'+ | '.$lt{'caa'}.' | +'.$cudom.'_'.$cuname.' | +$lt{'sed'} | -
- | $lt{'caa'} | -$cudom\_$cuname | -+"javascript:pjump('."'date_start','Start Date Assistant Co-Author',document.cu.start_$cudom\_$cuname\_aa.value,'start_$cudom\_$cuname\_aa','cu.pres','dateset'".')">'.$lt{'ssd'}.' | +$lt{'ssd'} | --$lt{'sed'} | -
'.&mt('Activate').' | '.&mt('Role').' | '.&mt('Extent').' | '. - ''.&mt('Start').' | '.&mt('End').' | '.&mt('Activate').' | '.&mt('Role').' | '. + &mt('Extent').' | '. + ''.&mt('Start').' | '.&mt('End').' | '. + &Apache::loncommon::end_data_table_header_row(); + foreach my $thisdomain (sort(&Apache::lonnet::all_domains())) { + foreach my $role ('dc','li','dg','au','sc') { + if (&Apache::lonnet::allowed('c'.$role,$thisdomain)) { + my $plrole=&Apache::lonnet::plaintext($role); my %lt=&Apache::lonlocal::texthash( 'ssd' => "Set Start Date", 'sed' => "Set End Date" ); $num_domain_level ++; - $domaintext .= <<"ENDDROW"; -
---|---|---|---|---|---|---|---|---|---|
- | $plrole | -$thisdomain | -+ $domaintext .= +&Apache::loncommon::start_data_table_row(). +' | + | '.$plrole.' | +'.$thisdomain.' | +$lt{'ssd'} | -+"javascript:pjump('."'date_start','Start Date $plrole',document.cu.start_$thisdomain\_$role.value,'start_$thisdomain\_$role','cu.pres','dateset'".')">'.$lt{'ssd'}.' | +$lt{'sed'} | -
'.&mt('ERROR').': '.&mt('Unknown command').' '.$_.'
'.&mt('ERROR').': '.&mt('Unknown command').' '.$key.'