--- loncom/interface/loncreateuser.pm 2013/07/19 18:24:17 1.381 +++ loncom/interface/loncreateuser.pm 2014/02/12 21:29:03 1.391 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.381 2013/07/19 18:24:17 bisitz Exp $ +# $Id: loncreateuser.pm,v 1.391 2014/02/12 21:29:03 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -126,9 +126,7 @@ sub user_quotas { my ($ccuname,$ccdomain) = @_; my %lt = &Apache::lonlocal::texthash( 'usrt' => "User Tools", - 'cuqu' => "Current quota", 'cust' => "Custom quota", - 'defa' => "Default", 'chqu' => "Change quota", ); @@ -168,7 +166,7 @@ END_SCRIPT my %titles = &Apache::lonlocal::texthash ( portfolio => "Disk space allocated to user's portfolio files", - author => "Disk space allocated to user's authoring space (if role assigned)", + author => "Disk space allocated to user's Authoring Space (if role assigned)", ); foreach my $name ('portfolio','author') { my ($currquota,$quotatype,$inststatus,$defquota) = @@ -189,19 +187,19 @@ END_SCRIPT $showquota = $currquota; if ($longinsttype eq '') { $defaultinfo = &mt('For this user, the default quota would be [_1]' - .' Mb.',$defquota); + .' MB.',$defquota); } else { $defaultinfo = &mt("For this user, the default quota would be [_1]". - " Mb, as determined by the user's institutional". + " 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); + .' MB.',$defquota); } else { $defaultinfo = &mt("For this user, the default quota of [_1]". - " Mb, is determined by the user's institutional". + " MB, is determined by the user's institutional". " affiliation ([_2]).",$defquota,$longinsttype); } } @@ -211,8 +209,8 @@ END_SCRIPT ' '.$titles{$name}.''."\n". ' '."\n". &Apache::loncommon::start_data_table_row()."\n". - ' '.$lt{'cuqu'}.': '. - $currquota.' Mb.  '. + ' '. + &mt('Current quota: [_1] MB',$currquota).'  '. $defaultinfo.''."\n". &Apache::loncommon::end_data_table_row()."\n". &Apache::loncommon::start_data_table_row()."\n". @@ -220,13 +218,14 @@ END_SCRIPT ':  '. + ' />'. + &mt('Default ([_1] MB)',$defquota).' '. '  '. ' Mb'."\n". + ' /> '.&mt('MB').''."\n". &Apache::loncommon::end_data_table_row()."\n"; } } @@ -241,7 +240,7 @@ sub build_tools_display { my %lt = &Apache::lonlocal::texthash ( 'blog' => "Personal User Blog", 'aboutme' => "Personal Information Page", - 'webdav' => "WebDAV access to authoring spaces (if SSL and author/co-author)", + 'webdav' => "WebDAV access to Authoring Spaces (if SSL and author/co-author)", 'portfolio' => "Personal User Portfolio", 'avai' => "Available", 'cusa' => "availability", @@ -251,13 +250,14 @@ sub build_tools_display { 'official' => 'Can request creation of official courses', 'unofficial' => 'Can request creation of unofficial courses', 'community' => 'Can request creation of communities', + 'textbook' => 'Can request creation of textbook courses', 'requestauthor' => 'Can request author space', ); if ($context eq 'requestcourses') { %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname, 'requestcourses.official','requestcourses.unofficial', - 'requestcourses.community'); - @usertools = ('official','unofficial','community'); + 'requestcourses.community','requestcourses.textbook'); + @usertools = ('official','unofficial','community','textbook'); @options =('norequest','approval','autolimit','validate'); %validations = &Apache::lonnet::auto_courserequest_checks($ccdomain); %reqtitles = &courserequest_titles(); @@ -446,12 +446,13 @@ sub coursereq_externaluser { 'official' => 'Can request creation of official courses', 'unofficial' => 'Can request creation of unofficial courses', 'community' => 'Can request creation of communities', + 'textbook' => 'Can request creation of textbook courses', ); %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname, 'reqcrsotherdom.official','reqcrsotherdom.unofficial', - 'reqcrsotherdom.community'); - @usertools = ('official','unofficial','community'); + 'reqcrsotherdom.community','reqcrsotherdom.textbook'); + @usertools = ('official','unofficial','community','textbook'); @options = ('approval','validate','autolimit'); %validations = &Apache::lonnet::auto_courserequest_checks($cdom); my $optregex = join('|',@options); @@ -531,6 +532,7 @@ sub courserequest_titles { official => 'Official', unofficial => 'Unofficial', community => 'Communities', + textbook => 'Textbook', norequest => 'Not allowed', approval => 'Approval by Dom. Coord.', validate => 'With validation', @@ -568,6 +570,15 @@ sub requestauthor_display { return %titles; } +sub requestchange_display { + my %titles = &Apache::lonlocal::texthash ( + approval => "availability set to 'on' (approval required)", + automatic => "availability set to 'on' (automatic approval)", + norequest => "availability set to 'off'", + ); + return %titles; +} + sub curr_requestauthor { my ($uname,$udom,$isadv,$inststatuses,$domconfig) = @_; return unless ((ref($inststatuses) eq 'ARRAY') && (ref($domconfig) eq 'HASH')); @@ -1218,6 +1229,7 @@ ENDFORMINFO } } } + my $title = ''; if ($newuser) { my ($portfolioform,$domroleform); if ((&Apache::lonnet::allowed('mpq',$env{'request.role.domain'})) || @@ -1225,15 +1237,12 @@ ENDFORMINFO # Current user has quota or user tools modification privileges $portfolioform = '
'.&user_quotas($ccuname,$ccdomain); } - if (&Apache::lonnet::allowed('cau',$env{'request.role.domain'})) { + if ((&Apache::lonnet::allowed('cau',$env{'request.role.domain'})) && + ($ccdomain eq $env{'request.role.domain'})) { $domroleform = '
'.&domainrole_req($ccuname,$ccdomain); } &initialize_authen_forms($ccdomain,$formname); my %lt=&Apache::lonlocal::texthash( - 'cnu' => 'Create New User', - 'ast' => 'as a student', - 'ame' => 'as a member', - 'ind' => 'in domain', 'lg' => 'Login Data', 'hs' => "Home Server", ); @@ -1247,19 +1256,25 @@ $loginscript // ]]> -

$lt{'cnu'} "$ccuname" $lt{'ind'} $ccdomain ENDTITLE if ($env{'form.action'} eq 'singlestudent') { if ($crstype eq 'Community') { - $r->print(' ('.$lt{'ame'}.')'); + $title = &mt('Create New User [_1] in domain [_2] as a member', + '"'.$ccuname.'"','"'.$ccdomain.'"'); } else { - $r->print(' ('.$lt{'ast'}.')'); + $title = &mt('Create New User [_1] in domain [_2] as a student', + '"'.$ccuname.'"','"'.$ccdomain.'"'); } + } else { + $title = &mt('Create New User [_1] in domain [_2]', + '"'.$ccuname.'"','"'.$ccdomain.'"'); } - $r->print('

'."\n".'
'); + $r->print('

'.$title.'

'."\n"); + $r->print('
'); my $personal_table = &personal_data_display($ccuname,$ccdomain,$newuser,$context, $inst_results{$ccuname.':'.$ccdomain}); + # (Do not offer Disable Safeguard here) $r->print($personal_table); my ($home_server_pick,$numlib) = &Apache::loncommon::home_server_form_item($ccdomain,'hserver', @@ -1346,35 +1361,25 @@ ENDAUTH } $r->print('
'); } else { # user already exists - my %lt=&Apache::lonlocal::texthash( - 'cup' => "Modify existing user: ", - 'ens' => "Enroll one student: ", - 'enm' => "Enroll one member: ", - 'id' => "in domain", - ); - $r->print(< -ENDCHANGEUSER + $r->print($start_page.$forminfo); if ($env{'form.action'} eq 'singlestudent') { if ($crstype eq 'Community') { - $r->print($lt{'enm'}); + $title = &mt('Enroll one member: [_1] in domain [_2]', + '"'.$ccuname.'"','"'.$ccdomain.'"'); } else { - $r->print($lt{'ens'}); + $title = &mt('Enroll one student: [_1] in domain [_2]', + '"'.$ccuname.'"','"'.$ccdomain.'"'); } } else { - $r->print($lt{'cup'}); + $title = &mt('Modify existing user: [_1] in domain [_2]', + '"'.$ccuname.'"','"'.$ccdomain.'"'); } - $r->print(' "'.$ccuname.'" '.$lt{'id'}.' "'.$ccdomain.'"'. - "\n".'
'); - my ($personal_table,$showforceid) = + $r->print('

'.$title.'

'."\n"); + $r->print('
'); + my $personal_table = &personal_data_display($ccuname,$ccdomain,$newuser,$context, $inst_results{$ccuname.':'.$ccdomain}); $r->print($personal_table); - if ($showforceid) { - $r->print(''.&Apache::lonuserutils::forceid_change($context).'
'); - } if (&Apache::lonnet::allowed('ccc',$env{'request.role.domain'})) { $r->print('

'.&mt('User Can Request Creation of Courses/Communities in this Domain?').'

'. &Apache::loncommon::start_data_table()); @@ -1392,7 +1397,8 @@ ENDCHANGEUSER my ($isadv,$isauthor) = &Apache::lonnet::is_advanced_user($ccuname,$ccdomain); if ((!$isauthor) && - (&Apache::lonnet::allowed('cau',$env{'request.role.domain'}))) { + (&Apache::lonnet::allowed('cau',$env{'request.role.domain'})) + && ($env{'request.role.domain'} eq $ccdomain)) { $user_text{'requestauthor'} = &domainrole_req($ccuname,$ccdomain); } $user_text{'auth'} = &user_authentication($ccuname,$ccdomain,$formname); @@ -1404,8 +1410,8 @@ ENDCHANGEUSER if (!&Apache::lonnet::allowed('mpq',$ccdomain)) { if (&Apache::lonnet::allowed('mpq',$env{'request.role.domain'})) { my %lt=&Apache::lonlocal::texthash( - 'dska' => "Disk quotas for user's portfolio and authoring space", - 'youd' => "You do not have privileges to modify the portfolio and/or authoring space quotas for this user.", + 'dska' => "Disk quotas for user's portfolio and Authoring Space", + 'youd' => "You do not have privileges to modify the portfolio and/or Authoring Space quotas for this user.", 'ichr' => "If a change is required, contact a domain coordinator for the domain", ); $user_text{'quota'} = < '15', + middlename => '15', + lastname => '15', + generation => '5', + permanentemail => '25', + id => '15', + ); + + my %lt=&Apache::lonlocal::texthash( + 'pd' => "Personal Data", + 'firstname' => "First Name", + 'middlename' => "Middle Name", + 'lastname' => "Last Name", + 'generation' => "Generation", + 'permanentemail' => "Permanent e-mail address", + 'id' => "Student/Employee ID", + 'lg' => "Login Data", + 'inststatus' => "Affiliation", + 'email' => 'E-mail address', + 'valid' => 'Validation', + ); + + %canmodify_status = &Apache::lonuserutils::can_modify_userinfo($context,$ccdomain, ['inststatus'],$rolesarray); if (!$newuser) { @@ -2173,31 +2203,53 @@ sub personal_data_display { &Apache::lonuserutils::can_modify_userinfo($context,$ccdomain, \@userinfo,$rolesarray); } elsif ($context eq 'selfcreate') { - %canmodify = &selfcreate_canmodify($context,$ccdomain,\@userinfo, - $inst_results,$rolesarray); + if ($newuser eq 'email') { + if (ref($emailusername) eq 'HASH') { + my ($infofields,$infotitles) = &Apache::loncommon::emailusername_info(); + @userinfo = (); + if ((ref($infofields) eq 'ARRAY') && (ref($infotitles) eq 'HASH')) { + foreach my $field (@{$infofields}) { + if ($emailusername->{$field}) { + push(@userinfo,$field); + $canmodify{$field} = 1; + unless ($textboxsize{$field}) { + $textboxsize{$field} = 25; + } + unless ($lt{$field}) { + $lt{$field} = $infotitles->{$field}; + } + } + } + } + } + } else { + %canmodify = &selfcreate_canmodify($context,$ccdomain,\@userinfo, + $inst_results,$rolesarray); + } } - my %lt=&Apache::lonlocal::texthash( - 'pd' => "Personal Data", - 'firstname' => "First Name", - 'middlename' => "Middle Name", - 'lastname' => "Last Name", - 'generation' => "Generation", - 'permanentemail' => "Permanent e-mail address", - 'id' => "Student/Employee ID", - 'lg' => "Login Data", - 'inststatus' => "Affiliation", - ); - my %textboxsize = ( - firstname => '15', - middlename => '15', - lastname => '15', - generation => '5', - permanentemail => '25', - id => '15', - ); + my $genhelp=&Apache::loncommon::help_open_topic('Generation'); $output = '

'.$lt{'pd'}.'

'. &Apache::lonhtmlcommon::start_pick_box(); + if (($context eq 'selfcreate') && ($newuser eq 'email')) { + $output .= &Apache::lonhtmlcommon::row_title($lt{'email'},undef, + 'LC_oddrow_value')."\n". + ''; + $rowcount ++; + $output .= &Apache::lonhtmlcommon::row_closure(1); + my $upassone = ''; + my $upasstwo = ''; + $output .= &Apache::lonhtmlcommon::row_title(&mt('Password'), + 'LC_pick_box_title', + 'LC_oddrow_value')."\n". + $upassone."\n". + &Apache::lonhtmlcommon::row_closure(1)."\n". + &Apache::lonhtmlcommon::row_title(&mt('Confirm password'), + 'LC_pick_box_title', + 'LC_oddrow_value')."\n". + $upasstwo. + &Apache::lonhtmlcommon::row_closure()."\n"; + } foreach my $item (@userinfo) { my $rowtitle = $lt{$item}; my $hiderow = 0; @@ -2211,7 +2263,7 @@ sub personal_data_display { $row .= ''.$inst_results->{$item}; } else { if ($context eq 'selfcreate') { - if ($canmodify{$item}) { + if ($canmodify{$item}) { $row .= ''; $editable ++; } else { @@ -2227,7 +2279,11 @@ sub personal_data_display { $row .= $ccuname; } else { if ($canmodify{$item}) { - $row .= ''; + if ($newuser eq 'email') { + $row .= ''; + } else { + $row .= ''; + } $editable ++; } else { $hiderow = 1; @@ -2243,8 +2299,8 @@ sub personal_data_display { } else { $row .= $userenv{$item}; } - if ($item eq 'id') { - $showforceid = $canmodify{$item}; + if (($item eq 'id') && ($canmodify{$item})) { + $row .= '
'.&Apache::lonuserutils::forceid_change($context); } } $row .= &Apache::lonhtmlcommon::row_closure(1); @@ -2280,7 +2336,7 @@ sub personal_data_display { } } if (!$hiderow) { - my $row = &Apache::lonhtmlcommon::row_title(&mt('Affliations'),undef,'LC_oddrow_value')."\n". + my $row = &Apache::lonhtmlcommon::row_title(&mt('Affiliations'),undef,'LC_oddrow_value')."\n". $shown.&Apache::lonhtmlcommon::row_closure(1); if ($context eq 'selfcreate') { $rowcount ++; @@ -2290,12 +2346,26 @@ sub personal_data_display { } } } + if (($context eq 'selfcreate') && ($newuser eq 'email')) { + if ($captchaform) { + $output .= &Apache::lonhtmlcommon::row_title($lt{'valid'}, + 'LC_pick_box_title')."\n". + $captchaform."\n".'

'. + &Apache::lonhtmlcommon::row_closure(1); + $rowcount ++; + } + my $submit_text = &mt('Create account'); + $output .= &Apache::lonhtmlcommon::row_title()."\n". + '
'. + &Apache::lonhtmlcommon::row_closure(1); + } $output .= &Apache::lonhtmlcommon::end_pick_box(); if (wantarray) { if ($context eq 'selfcreate') { return($output,$rowcount,$editable); } else { - return ($output,$showforceid); + return $output; } } else { return $output; @@ -2460,9 +2530,12 @@ sub update_user_data { if (! exists($env{'form.makeuser'})) { # Modifying an existing user, so check the validity of the name if ($uhome eq 'no_host') { - $r->print($error.&mt('Unable to determine home server for '). - $env{'form.ccuname'}.&mt(' in domain '). - $env{'form.ccdomain'}.'.'); + $r->print( + $error + .'

' + .&mt('Unable to determine home server for [_1] in domain [_2].', + '"'.$env{'form.ccuname'}.'"','"'.$env{'form.ccdomain'}.'"') + .'

'); return; } } @@ -2502,7 +2575,7 @@ sub update_user_data { my (%alerts,%rulematch,%inst_results,%curr_rules); my @userinfo = ('firstname','middlename','lastname','generation','permanentemail','id'); my @usertools = ('aboutme','blog','webdav','portfolio'); - my @requestcourses = ('official','unofficial','community'); + my @requestcourses = ('official','unofficial','community','textbook'); my @requestauthor = ('requestauthor'); my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($env{'form.ccdomain'}); @@ -2597,7 +2670,8 @@ sub update_user_data { $newcustom{$item} = $env{'form.crsreq_'.$item}; if ($env{'form.crsreq_'.$item} eq 'autolimit') { $newcustom{$item} .= '='; - unless ($env{'form.crsreq_'.$item.'_limit'} =~ /\D/) { + $env{'form.crsreq_'.$item.'_limit'} =~ s/\D+//g; + if ($env{'form.crsreq_'.$item.'_limit'}) { $newcustom{$item} .= $env{'form.crsreq_'.$item.'_limit'}; } } @@ -2671,8 +2745,9 @@ sub update_user_data { 'id','permanentemail','portfolioquota','authorquota','inststatus', 'tools.aboutme','tools.blog','tools.webdav','tools.portfolio', 'requestcourses.official','requestcourses.unofficial', - 'requestcourses.community','reqcrsotherdom.official', - 'reqcrsotherdom.unofficial','reqcrsotherdom.community', + 'requestcourses.community','requestcourses.textbook', + 'reqcrsotherdom.official','reqcrsotherdom.unofficial', + 'reqcrsotherdom.community','reqcrsotherdom.textbook', 'requestauthor'], $env{'form.ccdomain'},$env{'form.ccuname'}); my ($tmp) = keys(%userenv); @@ -2923,9 +2998,13 @@ sub update_user_data { } if ($oldisdefault{$name}) { $oldsettingstext{'quota'}{$name} = &get_defaultquota_text($oldsettingstatus{$name}); + } else { + $oldsettingstext{'quota'}{$name} = &mt('custom quota: [_1] MB',$oldquota{$name}); } if ($newisdefault{$name}) { $newsettingstext{'quota'}{$name} = &get_defaultquota_text($newsettingstatus{$name}); + } else { + $newsettingstext{'quota'}{$name} = &mt('custom quota: [_1] MB',$newquota{$name}); } } &tool_changes('tools',\@usertools,\%oldsettings,\%oldsettingstext,\%userenv, @@ -2933,7 +3012,8 @@ sub update_user_data { if ($env{'form.ccdomain'} eq $env{'request.role.domain'}) { &tool_changes('requestcourses',\@requestcourses,\%oldsettings,\%oldsettingstext, \%userenv,\%changeHash,\%changed,\%newsettings,\%newsettingstext); - &tool_changes('requestauthor',\@requestauthor,\%oldsettings,\%oldsettingstext,\%userenv,\%changeHash,\%changed,\%newsettings,\%newsettingstext); + &tool_changes('requestauthor',\@requestauthor,\%oldsettings,\%oldsettingstext, + \%userenv,\%changeHash,\%changed,\%newsettings,\%newsettingstext); } else { &tool_changes('reqcrsotherdom',\@requestcourses,\%oldsettings,\%oldsettingstext, \%userenv,\%changeHash,\%changed,\%newsettings,\%newsettingstext); @@ -2945,8 +3025,8 @@ sub update_user_data { } } foreach my $name ('portfolio','author') { - $oldsettings{'quota'}{$name} = $oldquota{$name}.' Mb'; - $newsettings{'quota'}{$name} = $newquota{$name}.' Mb'; + $oldsettings{'quota'}{$name} = &mt('[_1] MB',$oldquota{$name}); + $newsettings{'quota'}{$name} = &mt('[_1] MB',$newquota{$name}); } if ((keys(%namechanged) > 0) || (keys(%changed) > 0)) { my ($chgresult,$namechgresult); @@ -3045,9 +3125,12 @@ sub update_user_data { &Apache::lonnet::appenv(\%newenvhash); } } else { # error occurred - $r->print(''.&mt('Unable to successfully change environment for').' '. - $env{'form.ccuname'}.' '.&mt('in domain').' '. - $env{'form.ccdomain'}.'
'); + $r->print( + '

' + .&mt('Unable to successfully change environment for [_1] in domain [_2].', + '"'.$env{'form.ccuname'}.'"', + '"'.$env{'form.ccdomain'}.'"') + .'

'); } } else { # End of if ($env ... ) logic # They did not want to change the users name, quota, tool availability, @@ -3095,13 +3178,14 @@ sub update_user_data { if ($env{'form.action'} eq 'singlestudent') { &enroll_single_student($r,$uhome,$amode,$genpwd,$now,$newuser,$context, $crstype,$showcredits,$defaultcredits); - $r->print('

'); - if ($crstype eq 'Community') { - $r->print(&mt('Enroll Another Member')); - } else { - $r->print(&mt('Enroll Another Student')); - } - $r->print('

'); + my $linktext = ($crstype eq 'Community' ? + &mt('Enroll Another Member') : &mt('Enroll Another Student')); + $r->print( + &Apache::lonhtmlcommon::actionbox([ + '' + .($crstype eq 'Community' ? + &mt('Enroll Another Member') : &mt('Enroll Another Student')) + .''])); } else { my @rolechanges = &update_roles($r,$context,$showcredits); if (keys(%namechanged) > 0) { @@ -3156,7 +3240,7 @@ sub display_userinfo { 'id' => 'Student/Employee ID', 'permanentemail' => 'Permanent e-mail address', 'portfolioquota' => 'Disk space allocated to portfolio files', - 'authorquota' => 'Disk space allocated to authoring space', + 'authorquota' => 'Disk space allocated to Authoring Space', 'blog' => 'Blog Availability', 'webdav' => 'WebDAV Availability', 'aboutme' => 'Personal Information Page Availability', @@ -3164,6 +3248,7 @@ sub display_userinfo { 'official' => 'Can Request Official Courses', 'unofficial' => 'Can Request Unofficial Courses', 'community' => 'Can Request Communities', + 'textbook' => 'Can Request Textbook Courses', 'requestauthor' => 'Can Request Author Role', 'inststatus' => "Affiliation", 'prvs' => 'Previous Value:', @@ -3178,67 +3263,83 @@ sub display_userinfo { $r->print(''.$lt{'chto'}.''); $r->print(&Apache::loncommon::end_data_table_header_row()); my @userinfo = ('firstname','middlename','lastname','generation','permanentemail','id'); - foreach my $item (@userinfo) { my $value = $env{'form.c'.$item}; #show changes only: - unless($value eq $userenv->{$item}){ + unless ($value eq $userenv->{$item}){ $r->print(&Apache::loncommon::start_data_table_row()); - $r->print("$lt{$item}\n"); - $r->print(''.$userenv->{$item}.' '); + $r->print("".$userenv->{$item}."\n"); $r->print("$value \n"); - $r->print(&Apache::loncommon::end_data_table_row()); } } foreach my $entry (@{$order}) { - if ($canshow->{$entry} && ($newsetting->{$entry} ne $newsetting->{$entry})) { - $r->print(&Apache::loncommon::start_data_table_row()); - if (($entry eq 'requestcourses') || ($entry eq 'reqcrsotherdom')) { - foreach my $item (@{$requestcourses}) { - $r->print("$lt{$item}\n"); - $r->print("$oldsetting->{$item} $oldsettingtext->{$item}\n"); - my $value = $newsetting->{$item}.' '.$newsettingtext->{$item}; - if ($changedhash->{$item}) { - $value = ''.$value.''; + if ($canshow->{$entry}) { + if (($entry eq 'requestcourses') || ($entry eq 'reqcrsotherdom') || ($entry eq 'requestauthor')) { + my @items; + if ($entry eq 'requestauthor') { + @items = ($entry); + } else { + @items = @{$requestcourses}; + } + foreach my $item (@items) { + if (($newsetting->{$item} ne $oldsetting->{$item}) || + ($newsettingtext->{$item} ne $oldsettingtext->{$item})) { + $r->print(&Apache::loncommon::start_data_table_row()."\n"); + $r->print("$lt{$item}\n"); + $r->print("".$oldsetting->{$item}); + if ($oldsettingtext->{$item}) { + if ($oldsetting->{$item}) { + $r->print(' -- '); + } + $r->print($oldsettingtext->{$item}); + } + $r->print("\n"); + $r->print("".$newsetting->{$item}); + if ($newsettingtext->{$item}) { + if ($newsetting->{$item}) { + $r->print(' -- '); + } + $r->print($newsettingtext->{$item}); + } + $r->print("\n"); + $r->print(&Apache::loncommon::end_data_table_row()."\n"); } - $r->print("$value \n"); } } elsif ($entry eq 'tools') { foreach my $item (@{$usertools}) { - $r->print("$lt{$item}\n"); - $r->print("$oldsetting->{$item} $oldsettingtext->{$item}\n"); - my $value = $newsetting->{$item}.' '.$newsettingtext->{$item}; - if ($changedhash->{$item}) { - $value = ''.$value.''; + if ($newsetting->{$item} ne $oldsetting->{$item}) { + $r->print(&Apache::loncommon::start_data_table_row()."\n"); + $r->print("$lt{$item}\n"); + $r->print("".$oldsetting->{$item}.' '.$oldsettingtext->{$item}."\n"); + $r->print("".$newsetting->{$item}.' '.$newsettingtext->{$item}."\n"); + $r->print(&Apache::loncommon::end_data_table_row()."\n"); } - $r->print("$value \n"); } } elsif ($entry eq 'quota') { if ((ref($oldsetting->{$entry}) eq 'HASH') && (ref($oldsettingtext->{$entry}) eq 'HASH') && (ref($newsetting->{$entry}) eq 'HASH') && (ref($newsettingtext->{$entry}) eq 'HASH')) { foreach my $name ('portfolio','author') { - $r->print("$lt{$name.$entry}\n"); - $r->print("$oldsetting->{$entry}->{$name} $oldsettingtext->{$entry}->{$name} \n"); - my $value = $newsetting->{$entry}->{$name}.' '.$newsettingtext->{$entry}->{$name}; - if ($changedhash->{$entry}) { - $value = ''.$value.''; + if ($newsetting->{$entry}->{$name} ne $oldsetting->{$entry}->{$name}) { + $r->print(&Apache::loncommon::start_data_table_row()."\n"); + $r->print("$lt{$name.$entry}\n"); + $r->print("".$oldsettingtext->{$entry}->{$name}."\n"); + $r->print("".$newsettingtext->{$entry}->{$name}."\n"); + $r->print(&Apache::loncommon::end_data_table_row()."\n"); } - $r->print("$value \n"); } } } else { - $r->print("$lt{$entry}\n"); - $r->print("$oldsetting->{$entry} $oldsettingtext->{$entry} \n"); - my $value = $newsetting->{$entry}.' '.$newsettingtext->{$entry}; - if ($changedhash->{$entry}) { - $value = ''.$value.''; + if ($newsetting->{$entry} ne $oldsetting->{$entry}) { + $r->print(&Apache::loncommon::start_data_table_row()."\n"); + $r->print("$lt{$entry}\n"); + $r->print("".$oldsetting->{$entry}.' '.$oldsettingtext->{$entry}."\n"); + $r->print("".$newsetting->{$entry}.' '.$newsettingtext->{$entry}."\n"); + $r->print(&Apache::loncommon::end_data_table_row()."\n"); } - $r->print("$value \n"); } - $r->print(&Apache::loncommon::end_data_table_row()); } } $r->print(&Apache::loncommon::end_data_table().'
'); @@ -3258,20 +3359,20 @@ sub tool_changes { (ref($newaccess) eq 'HASH') && (ref($newaccesstext) eq 'HASH'))) { return; } + my %reqdisplay = &requestchange_display(); if ($context eq 'reqcrsotherdom') { my @options = ('approval','validate','autolimit'); my $optregex = join('|',@options); - my %reqdisplay = &courserequest_display(); my $cdom = $env{'request.role.domain'}; foreach my $tool (@{$usertools}) { - $oldaccesstext->{$tool} = &mt('No'); + $oldaccesstext->{$tool} = &mt("availability set to 'off'"); $newaccesstext->{$tool} = $oldaccesstext->{$tool}; $changeHash->{$context.'.'.$tool} = $userenv->{$context.'.'.$tool}; - my $newop; + my ($newop,$limit); if ($env{'form.'.$context.'_'.$tool}) { $newop = $env{'form.'.$context.'_'.$tool}; if ($newop eq 'autolimit') { - my $limit = $env{'form.'.$context.'_'.$tool.'_limit'}; + $limit = $env{'form.'.$context.'_'.$tool.'_limit'}; $limit =~ s/\D+//g; $newop .= '='.$limit; } @@ -3281,7 +3382,15 @@ sub tool_changes { $changed->{$tool}=&tool_admin($tool,$cdom.':'.$newop, $changeHash,$context); if ($changed->{$tool}) { - $newaccesstext->{$tool} = &mt('Yes'); + if ($newop =~ /^autolimit/) { + if ($limit) { + $newaccesstext->{$tool} = &mt('available with automatic approval, up to limit of [quant,_1,request] per user',$limit); + } else { + $newaccesstext->{$tool} = &mt('available with automatic approval (unlimited)'); + } + } else { + $newaccesstext->{$tool} = $reqdisplay{$newop}; + } } else { $newaccesstext->{$tool} = $oldaccesstext->{$tool}; } @@ -3292,8 +3401,17 @@ sub tool_changes { my $changedoms; foreach my $req (@curr) { if ($req =~ /^\Q$cdom\E\:($optregex\=?\d*)$/) { - $oldaccesstext->{$tool} = &mt('Yes'); my $oldop = $1; + if ($oldop =~ /^autolimit=(\d*)/) { + my $limit = $1; + if ($limit) { + $oldaccesstext->{$tool} = &mt('available with automatic approval, up to limit of [quant,_1,request] per user',$limit); + } else { + $oldaccesstext->{$tool} = &mt('available with automatic approval (unlimited)'); + } + } else { + $oldaccesstext->{$tool} = $reqdisplay{$oldop}; + } if ($oldop ne $newop) { $changedoms = 1; foreach my $item (@curr) { @@ -3327,15 +3445,15 @@ sub tool_changes { my $limit = $env{'form.'.$context.'_'.$tool.'_limit'}; $limit =~ s/\D+//g; if ($limit) { - $newaccesstext->{$tool} = &mt('Yes, up to limit of [quant,_1,request] per user.',$limit); + $newaccesstext->{$tool} = &mt('available with automatic approval, up to limit of [quant,_1,request] per user',$limit); } else { - $newaccesstext->{$tool} = &mt('Yes, processed automatically'); + $newaccesstext->{$tool} = &mt('available with automatic approval (unlimited)'); } } else { $newaccesstext->{$tool} = $reqdisplay{$env{'form.'.$context.'_'.$tool}}; } } else { - $newaccesstext->{$tool} = &mt('No'); + $newaccesstext->{$tool} = &mt("availability set to 'off'"); } } } @@ -3344,12 +3462,14 @@ sub tool_changes { return; } foreach my $tool (@{$usertools}) { - my ($newval,$envkey); + my ($newval,$limit,$envkey); $envkey = $context.'.'.$tool; if ($context eq 'requestcourses') { $newval = $env{'form.crsreq_'.$tool}; if ($newval eq 'autolimit') { - $newval .= '='.$env{'form.crsreq_'.$tool.'_limit'}; + $limit = $env{'form.crsreq_'.$tool.'_limit'}; + $limit =~ s/\D+//g; + $newval .= '='.$limit; } } elsif ($context eq 'requestauthor') { $newval = $env{'form.'.$context}; @@ -3359,10 +3479,25 @@ sub tool_changes { } if ($userenv->{$envkey} ne '') { $oldaccess->{$tool} = &mt('custom'); - if ($userenv->{$envkey}) { - $oldaccesstext->{$tool} = &mt("availability set to 'on'"); + if (($context eq 'requestcourses') || ($context eq 'requestauthor')) { + if ($userenv->{$envkey} =~ /^autolimit=(\d*)$/) { + my $currlimit = $1; + if ($currlimit eq '') { + $oldaccesstext->{$tool} = &mt('available with automatic approval (unlimited)'); + } else { + $oldaccesstext->{$tool} = &mt('available with automatic approval, up to limit of [quant,_1,request] per user',$currlimit); + } + } elsif ($userenv->{$envkey}) { + $oldaccesstext->{$tool} = $reqdisplay{$userenv->{$envkey}}; + } else { + $oldaccesstext->{$tool} = &mt("availability set to 'off'"); + } } else { - $oldaccesstext->{$tool} = &mt("availability set to 'off'"); + if ($userenv->{$envkey}) { + $oldaccesstext->{$tool} = &mt("availability set to 'on'"); + } else { + $oldaccesstext->{$tool} = &mt("availability set to 'off'"); + } } $changeHash->{$envkey} = $userenv->{$envkey}; if ($env{'form.custom'.$tool} == 1) { @@ -3371,17 +3506,45 @@ sub tool_changes { $context); if ($changed->{$tool}) { $newaccess->{$tool} = &mt('custom'); - if ($newval) { - $newaccesstext->{$tool} = &mt("availability set to 'on'"); + if (($context eq 'requestcourses') || ($context eq 'requestauthor')) { + if ($newval =~ /^autolimit/) { + if ($limit) { + $newaccesstext->{$tool} = &mt('available with automatic approval, up to limit of [quant,_1,request] per user',$limit); + } else { + $newaccesstext->{$tool} = &mt('available with automatic approval (unlimited)'); + } + } elsif ($newval) { + $newaccesstext->{$tool} = $reqdisplay{$newval}; + } else { + $newaccesstext->{$tool} = &mt("availability set to 'off'"); + } } else { - $newaccesstext->{$tool} = &mt("availability set to 'off'"); + if ($newval) { + $newaccesstext->{$tool} = &mt("availability set to 'on'"); + } else { + $newaccesstext->{$tool} = &mt("availability set to 'off'"); + } } } else { $newaccess->{$tool} = $oldaccess->{$tool}; - if ($userenv->{$context.'.'.$tool}) { - $newaccesstext->{$tool} = &mt("availability set to 'on'"); + if (($context eq 'requestcourses') || ($context eq 'requestauthor')) { + if ($newval =~ /^autolimit/) { + if ($limit) { + $newaccesstext->{$tool} = &mt('available with automatic approval, up to limit of [quant,_1,request] per user',$limit); + } else { + $newaccesstext->{$tool} = &mt('available with automatic approval (unlimited)'); + } + } elsif ($newval) { + $newaccesstext->{$tool} = $reqdisplay{$newval}; + } else { + $newaccesstext->{$tool} = &mt("availability set to 'off'"); + } } else { - $newaccesstext->{$tool} = &mt("availability set to 'off'"); + if ($userenv->{$context.'.'.$tool}) { + $newaccesstext->{$tool} = &mt("availability set to 'on'"); + } else { + $newaccesstext->{$tool} = &mt("availability set to 'off'"); + } } } } else { @@ -3394,10 +3557,24 @@ sub tool_changes { $newaccess->{$tool} = &mt('default'); } else { $newaccess->{$tool} = $oldaccess->{$tool}; - if ($userenv->{$context.'.'.$tool}) { - $newaccesstext->{$tool} = &mt("availability set to 'on'"); + if (($context eq 'requestcourses') || ($context eq 'requestauthor')) { + if ($newval =~ /^autolimit/) { + if ($limit) { + $newaccesstext->{$tool} = &mt('available with automatic approval, up to limit of [quant,_1,request] per user',$limit); + } else { + $newaccesstext->{$tool} = &mt('available with automatic approval (unlimited)'); + } + } elsif ($newval) { + $newaccesstext->{$tool} = $reqdisplay{$newval}; + } else { + $newaccesstext->{$tool} = &mt("availability set to 'off'"); + } } else { - $newaccesstext->{$tool} = &mt("availability set to 'off'"); + if ($userenv->{$context.'.'.$tool}) { + $newaccesstext->{$tool} = &mt("availability set to 'on'"); + } else { + $newaccesstext->{$tool} = &mt("availability set to 'off'"); + } } } } @@ -3408,10 +3585,24 @@ sub tool_changes { $context); if ($changed->{$tool}) { $newaccess->{$tool} = &mt('custom'); - if ($newval) { - $newaccesstext->{$tool} = &mt("availability set to 'on'"); + if (($context eq 'requestcourses') || ($context eq 'requestauthor')) { + if ($newval =~ /^autolimit/) { + if ($limit) { + $newaccesstext->{$tool} = &mt('available with automatic approval, up to limit of [quant,_1,request] per user',$limit); + } else { + $newaccesstext->{$tool} = &mt('available with automatic approval (unlimited)'); + } + } elsif ($newval) { + $newaccesstext->{$tool} = $reqdisplay{$newval}; + } else { + $newaccesstext->{$tool} = &mt("availability set to 'off'"); + } } else { - $newaccesstext->{$tool} = &mt("availability set to 'off'"); + if ($newval) { + $newaccesstext->{$tool} = &mt("availability set to 'on'"); + } else { + $newaccesstext->{$tool} = &mt("availability set to 'off'"); + } } } else { $newaccess->{$tool} = $oldaccess->{$tool}; @@ -3816,7 +4007,7 @@ sub enroll_single_student { } $r->print('.
'.$showstart.'; '.$showend); if ($startdate <= $now && !$newuser) { - $r->print('

'); + $r->print('

'); if ($crstype eq 'Community') { $r->print(&mt('If the member is currently logged-in to LON-CAPA, the new role will be available when the member next logs in.')); } else { @@ -3834,14 +4025,14 @@ sub get_defaultquota_text { my ($settingstatus) = @_; my $defquotatext; if ($settingstatus eq '') { - $defquotatext = &mt('(default)'); + $defquotatext = &mt('default'); } else { my ($usertypes,$order) = &Apache::lonnet::retrieve_inst_usertypes($env{'form.ccdomain'}); if ($usertypes->{$settingstatus} eq '') { - $defquotatext = &mt('(default)'); + $defquotatext = &mt('default'); } else { - $defquotatext = &mt('(default for [_1])',$usertypes->{$settingstatus}); + $defquotatext = &mt('default for [_1]',$usertypes->{$settingstatus}); } } return $defquotatext; @@ -3866,8 +4057,8 @@ sub update_result_form { $outcome .= ''."\n"; } $outcome .= ''."\n". - ''."\n". - ''."\n". + ''."\n". + ''."\n". ''; return $outcome; } @@ -4307,25 +4498,43 @@ sub set_custom_role { $sysrole.=':'.$item; } } - $r->print('
Defining Role: '. - &Apache::lonnet::definerole($rolename,$sysrole,$domrole,$courole)); + # Assign role; Compile and show result + my $errmsg; + my $result = + &Apache::lonnet::definerole($rolename,$sysrole,$domrole,$courole); + if ($result ne 'ok') { + $errmsg = ': '.$result; + } + my $message = + &Apache::lonhtmlcommon::confirm_success( + &mt('Defining Role').$errmsg, ($result eq 'ok' ? 0 : 1)); if ($env{'request.course.id'}) { my $url='/'.$env{'request.course.id'}; $url=~s/\_/\//g; - $r->print('
'.&mt('Assigning Role to Self').': '. - &Apache::lonnet::assigncustomrole($env{'user.domain'}, - $env{'user.name'}, - $url, - $env{'user.domain'}, - $env{'user.name'}, - $rolename,undef,undef,undef,$context)); + $result = + &Apache::lonnet::assigncustomrole( + $env{'user.domain'},$env{'user.name'}, + $url, + $env{'user.domain'},$env{'user.name'}, + $rolename,undef,undef,undef,$context); + if ($result ne 'ok') { + $errmsg = ': '.$result; + } + $message .= + '
' + .&Apache::lonhtmlcommon::confirm_success( + &mt('Assigning Role to Self').$errmsg, ($result eq 'ok' ? 0 : 1)); } $r->print( - '

' - .&mt('Create or edit another custom role') - .'

' + &Apache::loncommon::confirmwrapper($message) + .'
' + .&Apache::lonhtmlcommon::actionbox([ + '' + .&mt('Create or edit another custom role') + .'']) .'
' - .&Apache::lonhtmlcommon::echo_form_input([]).'
' + .&Apache::lonhtmlcommon::echo_form_input([]) + .'' ); } @@ -4349,12 +4558,12 @@ sub handler { &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['action','state','callingform','roletype','showrole','bulkaction','popup','phase', - 'username','domain','srchterm','srchdomain','srchin','srchby','srchtype']); + 'username','domain','srchterm','srchdomain','srchin','srchby','srchtype','queue']); &Apache::lonhtmlcommon::clear_breadcrumbs(); my $args; my $brcrum = []; my $bread_crumbs_component = 'User Management'; - if ($env{'form.action'} ne 'dateselect') { + if (($env{'form.action'} ne 'dateselect') && ($env{'form.action'} ne 'displayuserreq')) { $brcrum = [{href=>"/adm/createuser", text=>"User Management", help=>'Course_Create_Class_List,Course_Change_Privileges,Course_View_Class_List,Course_Editing_Custom_Roles,Course_Add_Student,Course_Drop_Student,Course_Automated_Enrollment,Course_Self_Enrollment,Course_Manage_Group'} @@ -4509,7 +4718,7 @@ sub handler { (&Apache::lonnet::allowed('cau',$env{'request.role.domain'}))) { push(@{$brcrum}, {href => '/adm/createuser?action=processauthorreq', - text => 'Authoring space requests', + text => 'Authoring Space requests', help => 'Domain_Role_Approvals'}); $bread_crumbs_component = 'Authoring requests'; if ($env{'form.state'} eq 'done') { @@ -4521,7 +4730,8 @@ sub handler { } $args = { bread_crumbs => $brcrum, bread_crumbs_component => $bread_crumbs_component}; - $r->print(&header(undef,$args)); + my $js = &usernamerequest_javascript(); + $r->print(&header(&add_script($js),$args)); if (!exists($env{'form.state'})) { $r->print(&Apache::loncoursequeueadmin::display_queued_requests('requestauthor', $env{'request.role.domain'})); @@ -4530,6 +4740,103 @@ sub handler { $r->print(&Apache::loncoursequeueadmin::update_request_queue('requestauthor', $env{'request.role.domain'})); } + } elsif (($env{'form.action'} eq 'processusernamereq') && + ($permission->{'cusr'}) && + (&Apache::lonnet::allowed('cau',$env{'request.role.domain'}))) { + push(@{$brcrum}, + {href => '/adm/createuser?action=processusernamereq', + text => 'LON-CAPA account requests', + help => 'Domain_Username_Approvals'}); + $bread_crumbs_component = 'Account requests'; + if ($env{'form.state'} eq 'done') { + push(@{$brcrum}, + {href => '/adm/createuser?action=usernamereqqueue', + text => 'Result', + help => 'Domain_Username_Approvals'}); + $bread_crumbs_component = 'LON-CAPA account request result'; + } + $args = { bread_crumbs => $brcrum, + bread_crumbs_component => $bread_crumbs_component}; + my $js = &usernamerequest_javascript(); + $r->print(&header(&add_script($js),$args)); + if (!exists($env{'form.state'})) { + $r->print(&Apache::loncoursequeueadmin::display_queued_requests('requestusername', + $env{'request.role.domain'})); + } elsif ($env{'form.state'} eq 'done') { + $r->print('

'.&mt('LON-CAPA account request processing').'

'."\n"); + $r->print(&Apache::loncoursequeueadmin::update_request_queue('requestusername', + $env{'request.role.domain'})); + } + } elsif (($env{'form.action'} eq 'displayuserreq') && + ($permission->{'cusr'})) { + my $dom = $env{'form.domain'}; + my $uname = $env{'form.username'}; + my $warning; + if (($dom =~ /^$match_domain$/) && (&Apache::lonnet::domain($dom) ne '')) { + if (($dom eq $env{'request.role.domain'}) && (&Apache::lonnet::allowed('ccc',$dom))) { + if (($uname =~ /^$match_username$/) && ($env{'form.queue'} eq 'approval')) { + my $uhome = &Apache::lonnet::homeserver($uname,$dom); + if ($uhome eq 'no_host') { + my $queue = $env{'form.queue'}; + my $reqkey = &escape($uname).'_'.$queue; + my $namespace = 'usernamequeue'; + my $domconfig = &Apache::lonnet::get_domainconfiguser($dom); + my %queued = + &Apache::lonnet::get($namespace,[$reqkey],$dom,$domconfig); + unless ($queued{$reqkey}) { + $warning = &mt('No information was found for this LON-CAPA account request.'); + } + } else { + $warning = &mt('A LON-CAPA account already exists for the requested username and domain.'); + } + } else { + $warning = &mt('LON-CAPA account request status check is for an invalid username.'); + } + } else { + $warning = &mt('You do not have rights to view LON-CAPA account requests in the domain specified.'); + } + } else { + $warning = &mt('LON-CAPA account request status check is for an invalid domain.'); + } + my $args = { only_body => 1 }; + $r->print(&header(undef,$args). + '

'.&mt('LON-CAPA Account Request Details').'

'); + if ($warning ne '') { + $r->print('
'.$warning.'
'); + } else { + my ($infofields,$infotitles) = &Apache::loncommon::emailusername_info(); + my $domconfiguser = &Apache::lonnet::get_domainconfiguser($dom); + my %domconfig = &Apache::lonnet::get_dom('configuration',['usercreation'],$dom); + if (ref($domconfig{'usercreation'}) eq 'HASH') { + if (ref($domconfig{'usercreation'}{'cancreate'}) eq 'HASH') { + if (ref($domconfig{'usercreation'}{'cancreate'}{'emailusername'}) eq 'HASH') { + my $count = scalar(keys(%{$domconfig{'usercreation'}{'cancreate'}{'emailusername'}})); + my %info = + &Apache::lonnet::get('nohist_requestedusernames',[$uname],$dom,$domconfiguser); + if (ref($info{$uname}) eq 'HASH') { + if ((ref($infofields) eq 'ARRAY') && (ref($infotitles) eq 'HASH')) { + $r->print('
'.&Apache::lonhtmlcommon::start_pick_box()); + my $num; + foreach my $field (@{$infofields}) { + next unless ($domconfig{'usercreation'}{'cancreate'}{'emailusername'}{$field}); + next unless ($infotitles->{$field}); + $r->print(&Apache::lonhtmlcommon::row_title($infotitles->{$field}). + $info{$uname}{$field}); + $num ++; + if ($count == $num) { + $r->print(&Apache::lonhtmlcommon::row_closure(1)); + } else { + $r->print(&Apache::lonhtmlcommon::row_closure()); + } + } + $r->print(&Apache::lonhtmlcommon::end_pick_box().'
'); + } + } + } + } + } + $r->print(&close_popup_form()); + } } elsif (($env{'form.action'} eq 'listusers') && ($permission->{'view'} || $permission->{'cusr'})) { if ($env{'form.phase'} eq 'bulkchange') { @@ -4729,6 +5036,32 @@ sub add_script { .''."\n"; } +sub usernamerequest_javascript { + my $js = <
+ +

+END +} + sub verify_user_display { my ($context) = @_; my %lt = &Apache::lonlocal::texthash ( @@ -4804,6 +5137,7 @@ function updateCols(caller) { document.getElementById('showcolrole').disabled = 'disabled'; } if (context == 'domain') { + var quotausageshow = 0; if ((document.studentform.roletype.options[document.studentform.roletype.selectedIndex].value == 'course') || (document.studentform.roletype.options[document.studentform.roletype.selectedIndex].value == 'community')) { document.getElementById('showcolstatus').checked = false; @@ -4823,6 +5157,16 @@ function updateCols(caller) { document.getElementById('showcolextent').checked = 'false'; document.getElementById('showextent').style.display='none'; document.getElementById('showcoltextextent').innerHTML = ''; + if ((document.studentform.showrole.options[document.studentform.showrole.selectedIndex].value == 'au') || + (document.studentform.showrole.options[document.studentform.showrole.selectedIndex].value == 'Any')) { + if (document.getElementById('showcolauthorusage')) { + document.getElementById('showcolauthorusage').disabled = ''; + } + if (document.getElementById('showcolauthorquota')) { + document.getElementById('showcolauthorquota').disabled = ''; + } + quotausageshow = 1; + } } else { document.getElementById('showextent').style.display='block'; document.getElementById('showextent').style.textAlign='left'; @@ -4841,6 +5185,16 @@ function updateCols(caller) { } } } + if (quotausageshow == 0) { + if (document.getElementById('showcolauthorusage')) { + document.getElementById('showcolauthorusage').checked = false; + document.getElementById('showcolauthorusage').disabled = 'disabled'; + } + if (document.getElementById('showcolauthorquota')) { + document.getElementById('showcolauthorquota').checked = false; + document.getElementById('showcolauthorquota').disabled = 'disabled'; + } + } } } return; @@ -4961,6 +5315,14 @@ sub print_main_menu { linktitle => 'Approve or reject author role requests', }, { + linktext => 'LON-CAPA Account Requests', + icon => 'list-add.png', + #help => 'Domain_Username_Approvals', + url => '/adm/createuser?action=processusernamereq', + permission => $permission->{'cusr'}, + linktitle => 'Approve or reject LON-CAPA account requests', + }, + { linktext => 'Change Log', icon => 'document-properties.png', #help => 'Course_User_Logs', @@ -6828,22 +7190,22 @@ sub course_level_dc { my $otheritems = &Apache::loncommon::start_data_table_row()."\n". '
'. $courseform.(' ' x4).''."\n". - '
'."\n"; foreach my $role (@roles) { my $plrole=&Apache::lonnet::plaintext($role); - $otheritems .= ' '; } if ( keys %customroles > 0) { foreach my $cust (sort keys %customroles) { my $custrole='cr_cr_'.$env{'user.domain'}. '_'.$env{'user.name'}.'_'.$cust; - $otheritems .= ' '; } } $otheritems .= ''. ''. ''. + ' '. ''. '
'.$lt{'exs'}.'
   '.$lt{'new'}.'
'. ''.