--- loncom/interface/loncreateuser.pm 2010/03/11 15:48:33 1.329.2.2 +++ loncom/interface/loncreateuser.pm 2010/01/14 20:08:13 1.332 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.329.2.2 2010/03/11 15:48:33 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.332 2010/01/14 20:08:13 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -219,7 +219,7 @@ END_SCRIPT sub build_tools_display { my ($ccuname,$ccdomain,$context) = @_; my (@usertools,%userenv,$output,@options,%validations,%reqtitles,%reqdisplay, - $colspan); + $colspan,$isadv,%domconfig); my %lt = &Apache::lonlocal::texthash ( 'blog' => "Personal User Blog", 'aboutme' => "Personal Information Page", @@ -243,6 +243,9 @@ sub build_tools_display { %reqtitles = &courserequest_titles(); %reqdisplay = &courserequest_display(); $colspan = ' colspan="2"'; + %domconfig = + &Apache::lonnet::get_dom('configuration',['requestcourses'],$ccdomain); + $isadv = &Apache::lonnet::is_advanced_user($ccuname,$ccdomain); } else { %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname, 'tools.aboutme','tools.portfolio','tools.blog'); @@ -289,7 +292,14 @@ sub build_tools_display { &Apache::loncommon::start_data_table_row()."\n"; if ($context eq 'requestcourses') { my ($curroption,$currlimit); - $curroption = $userenv{$context.'.'.$item}; + if ($userenv{$context.'.'.$item} ne '') { + $curroption = $userenv{$context.'.'.$item}; + } else { + my (@inststatuses); + $curroption = + &Apache::loncoursequeueadmin::get_processtype($ccuname,$ccdomain,$isadv,$ccdomain, + $item,\@inststatuses,\%domconfig); + } if (!$curroption) { $curroption = 'norequest'; } @@ -935,7 +945,7 @@ sub print_user_modification_page { ); my $response; if ($env{'form.origform'} eq 'crtusername') { - $response = ''.&mt('No match was found for the username ([_1]) in LON-CAPA domain: [_2]',$ccuname,$ccdomain). + $response = ''.&mt('No match found for the username [_1] in LON-CAPA domain: [_2]',''.$ccuname.'',$ccdomain). '
'; } $response .= '

' @@ -2680,8 +2690,7 @@ sub update_user_data { $newenvhash{'environment.requestcourses.'.$key} = $changeHash{'requestcourses.'.$key}; if ($changeHash{'requestcourses.'.$key} ne '') { - $newenvhash{'environment.canrequest.'.$key} = - $changeHash{'requestcourses.'.$key}; + $newenvhash{'environment.canrequest.'.$key} = 1; } else { $newenvhash{'environment.canrequest.'.$key} = &Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'}, @@ -4318,9 +4327,6 @@ END # Menu Phase One sub print_main_menu { my ($permission,$context,$crstype) = @_; - if (($context eq 'course') && (&Apache::loncommon::needs_gci_custom())) { - return &print_gci_main_menu($permission,$context,$crstype) - } my $linkcontext = $context; my $stuterm = lc(&Apache::lonnet::plaintext('st',$crstype)); if (($context eq 'course') && ($crstype eq 'Community')) { @@ -4542,82 +4548,6 @@ return Apache::lonhtmlcommon::generate_m # }); } -sub print_gci_main_menu { - my ($permission,$context,$crstype) = @_; - my $stuterm = lc(&Apache::lonnet::plaintext('st',$crstype)); - my ($cnum,$cdom) = &Apache::lonuserutils::get_course_identity(); - my %links = ( - course => { - single => 'Add/Modify a Student', - drop => 'Drop Students', - upload => 'Upload a File of Course Users', - singleuser => 'Add/Modify a Course User', - listusers => 'Manage Course Users', - }, - ); - my %linktitles = ( - course => { - singleuser => 'Add a user with a certain role to this course.', - listusers => 'Show and manage users in this course.', - single => 'Add a user with the role of student to this course', - drop => 'Remove a student from this course.', - upload => 'Upload a CSV or a text file containing users.', - }, - ); - my @menu = ( {categorytitle => 'Manage Users', - items => - [ - { - linktext => $links{$context}{'single'}, - #help => 'Course_Add_Student', - icon => 'list-add.png', - url => '/adm/createuser?action=singlestudent', - permission => $permission->{'cusr'}, - linktitle => $linktitles{$context}{'single'}, - - }, - { - linktext => $links{$context}{'drop'}, - icon => 'edit-undo.png', - #help => 'Course_Drop_Student', - url => '/adm/createuser?action=drop', - permission => $permission->{'cusr'}, - linktitle => $linktitles{$context}{'drop'}, - }, - { - linktext => $links{$context}{'upload'}, - icon => 'sctr.png', - #help => 'Course_Create_Class_List', - url => '/adm/createuser?action=upload', - permission => $permission->{'cusr'}, - linktitle => $linktitles{$context}{'upload'}, - }, - { - linktext => $links{$context}{'listusers'}, - icon => 'edit-find.png', - #help => 'Course_View_Class_List', - url => '/adm/createuser?action=listusers', - permission => ($permission->{'view'} || $permission->{'cusr'}), - linktitle => $linktitles{$context}{'listusers'}, - }, - ]}, - {categorytitle => 'Administration', - items => [ ]}, - ); - - push(@{ $menu[1]->{items} }, #Category: Administration - { - linktext => 'Change Log', - icon => 'document-properties.png', - #help => 'Course_User_Logs', - url => '/adm/createuser?action=changelogs', - permission => $permission->{'cusr'}, - linktitle => 'View change log.', - }, - ); - return Apache::lonhtmlcommon::generate_menu(@menu); -} - sub restore_prev_selections { my %saveable_parameters = ('srchby' => 'scalar', 'srchin' => 'scalar', @@ -5582,7 +5512,16 @@ sub role_display_filter { # Update Display button $output .= '

' .'' - .'


'; + .'

'; + + # Server version info + $output .= '

' + .&mt('Only changes made from servers running LON-CAPA [_1] or later are displayed.' + ,'2.6.99.0'); + if ($version) { + $output .= ' '.&mt('This LON-CAPA server is version [_1]',$version); + } + $output .= '


'; return $output; } @@ -5931,12 +5870,12 @@ sub build_search_response { my ($context,$srch,%srch_results) = @_; my ($currstate,$response,$forcenewuser); my %names = ( - 'uname' => 'username', - 'lastname' => 'last name', + 'uname' => 'username', + 'lastname' => 'last name', 'lastfirst' => 'last name, first name', - 'crs' => 'this course', - 'dom' => 'LON-CAPA domain: ', - 'instd' => 'the institutional directory for domain: ', + 'crs' => 'this course', + 'dom' => 'LON-CAPA domain', + 'instd' => 'the institutional directory for domain', ); my %single = ( @@ -5956,14 +5895,20 @@ sub build_search_response { $currstate = 'modify'; $response = &mt("$single{$srch->{'srchtype'}} was found for the $names{$srch->{'srchby'}} ([_1]) in $names{$srch->{'srchin'}}.",$srch->{'srchterm'}); if ($srch->{'srchin'} eq 'dom' || $srch->{'srchin'} eq 'instd') { - $response .= &display_domain_info($srch->{'srchdomain'}); + $response .= ': '.&display_domain_info($srch->{'srchdomain'}); } - } else { - $response = ''.&mt("$nomatch{$srch->{'srchtype'}} found for the $names{$srch->{'srchby'}} ([_1]) in $names{$srch->{'srchin'}}",$srch->{'srchterm'}); + } else { # Search has nothing found. Prepare message to user. + $response = ''; if ($srch->{'srchin'} eq 'dom' || $srch->{'srchin'} eq 'instd') { - $response .= &display_domain_info($srch->{'srchdomain'}); + $response .= &mt("$nomatch{$srch->{'srchtype'}} found for the $names{$srch->{'srchby'}} [_1] in $names{$srch->{'srchin'}}: [_2]", + ''.$srch->{'srchterm'}.'', + &display_domain_info($srch->{'srchdomain'})); + } else { + $response .= &mt("$nomatch{$srch->{'srchtype'}} found for the $names{$srch->{'srchby'}} [_1] in $names{$srch->{'srchin'}}.", + ''.$srch->{'srchterm'}.''); } $response .= ''; + if ($srch->{'srchin'} ne 'alc') { $forcenewuser = 1; my $cansrchinst = 0;