Diff for /loncom/interface/loncreateuser.pm between versions 1.329.2.4 and 1.332

version 1.329.2.4, 2010/09/19 16:44:44 version 1.332, 2010/01/14 20:08:13
Line 219  END_SCRIPT Line 219  END_SCRIPT
 sub build_tools_display {  sub build_tools_display {
     my ($ccuname,$ccdomain,$context) = @_;      my ($ccuname,$ccdomain,$context) = @_;
     my (@usertools,%userenv,$output,@options,%validations,%reqtitles,%reqdisplay,      my (@usertools,%userenv,$output,@options,%validations,%reqtitles,%reqdisplay,
         $colspan);          $colspan,$isadv,%domconfig);
     my %lt = &Apache::lonlocal::texthash (      my %lt = &Apache::lonlocal::texthash (
                    'blog'       => "Personal User Blog",                     'blog'       => "Personal User Blog",
                    'aboutme'    => "Personal Information Page",                     'aboutme'    => "Personal Information Page",
Line 243  sub build_tools_display { Line 243  sub build_tools_display {
         %reqtitles = &courserequest_titles();          %reqtitles = &courserequest_titles();
         %reqdisplay = &courserequest_display();          %reqdisplay = &courserequest_display();
         $colspan = ' colspan="2"';          $colspan = ' colspan="2"';
           %domconfig =
               &Apache::lonnet::get_dom('configuration',['requestcourses'],$ccdomain);
           $isadv = &Apache::lonnet::is_advanced_user($ccuname,$ccdomain);
     } else {      } else {
         %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,          %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,
                           'tools.aboutme','tools.portfolio','tools.blog');                            'tools.aboutme','tools.portfolio','tools.blog');
Line 289  sub build_tools_display { Line 292  sub build_tools_display {
                    &Apache::loncommon::start_data_table_row()."\n";                     &Apache::loncommon::start_data_table_row()."\n";
         if ($context eq 'requestcourses') {          if ($context eq 'requestcourses') {
             my ($curroption,$currlimit);              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) {              if (!$curroption) {
                 $curroption = 'norequest';                  $curroption = 'norequest';
             }              }
Line 472  sub print_username_entry_form { Line 482  sub print_username_entry_form {
     my ($r,$context,$response,$srch,$forcenewuser,$crstype) = @_;      my ($r,$context,$response,$srch,$forcenewuser,$crstype) = @_;
     my $defdom=$env{'request.role.domain'};      my $defdom=$env{'request.role.domain'};
     my $formtoset = 'crtuser';      my $formtoset = 'crtuser';
     my $is_custom = &Apache::loncommon::needs_gci_custom();  
     if (exists($env{'form.startrolename'})) {      if (exists($env{'form.startrolename'})) {
         $formtoset = 'docustom';          $formtoset = 'docustom';
         $env{'form.rolename'} = $env{'form.startrolename'};          $env{'form.rolename'} = $env{'form.startrolename'};
Line 498  sub print_username_entry_form { Line 507  sub print_username_entry_form {
                 'onload' => "javascript:setFormElements(document.$formtoset)",                  'onload' => "javascript:setFormElements(document.$formtoset)",
                     );                      );
     my %breadcrumb_text = &singleuser_breadcrumb($crstype);      my %breadcrumb_text = &singleuser_breadcrumb($crstype);
     my $title = 'User Management';  
     if ($context eq 'course') {  
         if ($is_custom) {  
             $title = 'Enrollment and Student Activity';  
         }  
     }  
     my $start_page =      my $start_page =
  &Apache::loncommon::start_page($title,   &Apache::loncommon::start_page('User Management',
        $jscript,{'add_entries' => \%loaditems,});         $jscript,{'add_entries' => \%loaditems,});
     if ($env{'form.action'} eq 'custom') {      if ($env{'form.action'} eq 'custom') {
         &Apache::lonhtmlcommon::add_breadcrumb          &Apache::lonhtmlcommon::add_breadcrumb
Line 523  sub print_username_entry_form { Line 526  sub print_username_entry_form {
     } elsif ($env{'form.action'} eq 'singlestudent') {      } elsif ($env{'form.action'} eq 'singlestudent') {
         $helpitem = 'Course_Add_Student';          $helpitem = 'Course_Add_Student';
     }      }
     my $crumbs = &Apache::lonhtmlcommon::breadcrumbs($title,      my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('User Management',
                                                      $helpitem);                                                       $helpitem);
     my %lt=&Apache::lonlocal::texthash(      my %lt=&Apache::lonlocal::texthash(
                     'srst' => 'Search for a user and enroll as a student',                      'srst' => 'Search for a user and enroll as a student',
Line 667  $userpicker Line 670  $userpicker
 ENDBLOCK  ENDBLOCK
     if ($env{'form.phase'} eq '') {      if ($env{'form.phase'} eq '') {
         my $defdom=$env{'request.role.domain'};          my $defdom=$env{'request.role.domain'};
         my $domform = &Apache::loncommon::select_dom_form($defdom,'srchdomain','',1);          my $domform = &Apache::loncommon::select_dom_form($defdom,'srchdomain');
         my %lt=&Apache::lonlocal::texthash(          my %lt=&Apache::lonlocal::texthash(
                   'enro' => 'Enroll one student',                    'enro' => 'Enroll one student',
                   'enrm' => 'Enroll one member',                    'enrm' => 'Enroll one member',
Line 716  $showresponse Line 719  $showresponse
 <table>  <table>
  <tr>   <tr>
   <td>$lt{'usr'}:</td>    <td>$lt{'usr'}:</td>
   <td><input type="text" size="25" name="srchterm" /></td>    <td><input type="text" size="15" name="srchterm" /></td>
   <td>&nbsp;$lt{'dom'}:</td><td>$domform</td>    <td>&nbsp;$lt{'dom'}:</td><td>$domform</td>
   <td>&nbsp;$sellink&nbsp;</td>    <td>&nbsp;$sellink&nbsp;</td>
   <td>&nbsp;<input name="userrole" type="submit" value="$buttontext" /></td>    <td>&nbsp;<input name="userrole" type="submit" value="$buttontext" /></td>
Line 761  sub print_user_selection_page { Line 764  sub print_user_selection_page {
     my ($r,$response,$srch,$srch_results,$srcharray,$context,$opener_elements,$crstype) = @_;      my ($r,$response,$srch,$srch_results,$srcharray,$context,$opener_elements,$crstype) = @_;
     my @fields = ('username','domain','lastname','firstname','permanentemail');      my @fields = ('username','domain','lastname','firstname','permanentemail');
     my $sortby = $env{'form.sortby'};      my $sortby = $env{'form.sortby'};
     my $is_custom = &Apache::loncommon::needs_gci_custom();  
   
     if (!grep(/^\Q$sortby\E$/,@fields)) {      if (!grep(/^\Q$sortby\E$/,@fields)) {
         $sortby = 'lastname';          $sortby = 'lastname';
Line 800  ENDSCRIPT Line 802  ENDSCRIPT
     if ($context eq 'requestcrs') {      if ($context eq 'requestcrs') {
         $r->print('<div>');          $r->print('<div>');
     } else {      } else {
         my $title = 'User Management';          $r->print(&Apache::loncommon::start_page('User Management',$jscript));
         if ($context eq 'course') {  
             if ($is_custom) {  
                 $title = 'Enrollment and Student Activity';  
             }  
         }  
         $r->print(&Apache::loncommon::start_page($title,$jscript));  
   
         my %breadcrumb_text = &singleuser_breadcrumb($crstype);          my %breadcrumb_text = &singleuser_breadcrumb($crstype);
         &Apache::lonhtmlcommon::add_breadcrumb          &Apache::lonhtmlcommon::add_breadcrumb
Line 817  ENDSCRIPT Line 813  ENDSCRIPT
               text=>$breadcrumb_text{'userpicked'},                text=>$breadcrumb_text{'userpicked'},
               faq=>282,bug=>'Instructor Interface',});                faq=>282,bug=>'Instructor Interface',});
         if ($env{'form.action'} eq 'singleuser') {          if ($env{'form.action'} eq 'singleuser') {
             $r->print(&Apache::lonhtmlcommon::breadcrumbs($title,              $r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management',
                                                           'Course_Change_Privileges'));                                                            'Course_Change_Privileges'));
             $r->print("<b>$lt{'usrch'}</b><br />");              $r->print("<b>$lt{'usrch'}</b><br />");
             $r->print(&entry_form($srch->{'srchdomain'},$srch,undef,$context,undef,$crstype));              $r->print(&entry_form($srch->{'srchdomain'},$srch,undef,$context,undef,$crstype));
             $r->print('<h3>'.$lt{'usel'}.'</h3>');              $r->print('<h3>'.$lt{'usel'}.'</h3>');
         } elsif ($env{'form.action'} eq 'singlestudent') {          } elsif ($env{'form.action'} eq 'singlestudent') {
             $r->print(&Apache::lonhtmlcommon::breadcrumbs($title,              $r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management',
                                                           'Course_Add_Student'));                                                            'Course_Add_Student'));
             $r->print($jscript."<b>");              $r->print($jscript."<b>");
             if ($crstype eq 'Community') {              if ($crstype eq 'Community') {
Line 932  sub print_user_modification_page { Line 928  sub print_user_modification_page {
     my %abv_auth = &auth_abbrev();      my %abv_auth = &auth_abbrev();
     my (%rulematch,%inst_results,$newuser,%alerts,%curr_rules,%got_rules);      my (%rulematch,%inst_results,$newuser,%alerts,%curr_rules,%got_rules);
     my $uhome=&Apache::lonnet::homeserver($ccuname,$ccdomain);      my $uhome=&Apache::lonnet::homeserver($ccuname,$ccdomain);
     my $is_custom = &Apache::loncommon::needs_gci_custom();  
     if ($is_custom) {  
         if ($uhome eq 'no_host') {  
             my $lc_ccuname = lc($ccuname);  
             if ($lc_ccuname ne $ccuname) {  
                 $uhome = &Apache::lonnet::homeserver($lc_ccuname,$ccdomain);  
                 $ccuname = $lc_ccuname;  
             }  
         }  
     }  
     if ($uhome eq 'no_host') {      if ($uhome eq 'no_host') {
           my $usertype;
         my ($rules,$ruleorder) =          my ($rules,$ruleorder) =
             &Apache::lonnet::inst_userrules($ccdomain,'username');              &Apache::lonnet::inst_userrules($ccdomain,'username');
         my $usertype =              $usertype =
             &Apache::lonuserutils::check_usertype($ccdomain,$ccuname,$rules);                  &Apache::lonuserutils::check_usertype($ccdomain,$ccuname,$rules);
         my $cancreate =          my $cancreate =
             &Apache::lonuserutils::can_create_user($ccdomain,$context,              &Apache::lonuserutils::can_create_user($ccdomain,$context,
                                                    $usertype);                                                     $usertype);
Line 956  sub print_user_modification_page { Line 943  sub print_user_modification_page {
                 official   => 'institutional',                  official   => 'institutional',
                 unofficial => 'non-institutional',                  unofficial => 'non-institutional',
             );              );
             if ($ccdomain eq 'gci') {  
                 $usertypetext{'unofficial'} = 'institutional',  
             }  
             my $response;              my $response;
             if ($env{'form.origform'} eq 'crtusername') {              if ($env{'form.origform'} eq 'crtusername') {
                 if ($is_custom) {                  $response =  '<span class="LC_warning">'.&mt('No match found for the username [_1] in LON-CAPA domain: [_2]','<b>'.$ccuname.'</b>',$ccdomain).
                     $response = '<span class="LC_warning">'.&mt('Invalid format for username for new user: [_1]','<b>'.$ccuname.'</b>').                              '</span><br />';
                                 '</span><br />';  
                 } else {  
                     $response =  '<span class="LC_warning">'.&mt('No match was found for the username ([_1]) in LON-CAPA domain: [_2]',$ccuname,$ccdomain).'</span><br />';  
                 }  
             }              }
             $response .= '<p class="LC_warning">'              $response .= '<p class="LC_warning">'
                         .&mt("You are not authorized to create new $usertypetext{$usertype} users in this domain.")                          .&mt("You are not authorized to create new $usertypetext{$usertype} users in this domain.")
                         .'<br />';                          .' '
             if ($ccdomain eq 'gcitest') {                          .&mt('Please contact the [_1]helpdesk[_2] for assistance.'
                 $response .= &mt('Enter a valid e-mail address as the username for the new user.').' '.&mt('Please contact the [_1]helpdesk[_2] for assistance.'                              ,'<a href="'.$helplink.'">','</a>')
                              ,'<a href="'.$helplink.'">','</a>')                          .'</p><br />';
                              .'</p><br />';  
             }  
             $env{'form.phase'} = '';              $env{'form.phase'} = '';
             &print_username_entry_form($r,$context,$response,undef,undef,$crstype);              &print_username_entry_form($r,$context,$response,undef,undef,$crstype);
             return;              return;
Line 1026  sub print_user_modification_page { Line 1004  sub print_user_modification_page {
     if ($env{'form.popup'}) {      if ($env{'form.popup'}) {
        $args->{'no_nav_bar'} = 1;          $args->{'no_nav_bar'} = 1; 
     }      }
     my $title = 'User Management';  
     if ($context eq 'course') {  
         if ($is_custom) {  
             $title = 'Enrollment and Student Activity';  
         }  
     }  
     my $start_page =       my $start_page = 
  &Apache::loncommon::start_page($title,$js,$args);   &Apache::loncommon::start_page('User Management',$js,$args);
     my %breadcrumb_text = &singleuser_breadcrumb($crstype);      my %breadcrumb_text = &singleuser_breadcrumb($crstype);
     &Apache::lonhtmlcommon::add_breadcrumb      &Apache::lonhtmlcommon::add_breadcrumb
      ({href=>"javascript:backPage($form)",       ({href=>"javascript:backPage($form)",
Line 1054  sub print_user_modification_page { Line 1026  sub print_user_modification_page {
     if ($env{'form.action'} eq 'singlestudent') {      if ($env{'form.action'} eq 'singlestudent') {
         $helpitem = 'Course_Add_Student';          $helpitem = 'Course_Add_Student';
     }      }
     my $crumbs = &Apache::lonhtmlcommon::breadcrumbs($title,      my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('User Management',
                                                      $helpitem);                                                       $helpitem);
   
     my $forminfo =<<"ENDFORMINFO";      my $forminfo =<<"ENDFORMINFO";
Line 2189  sub get_inststatuses { Line 2161  sub get_inststatuses {
   
 # ================================================================= Phase Three  # ================================================================= Phase Three
 sub update_user_data {  sub update_user_data {
     my ($r,$context,$crstype) = @_;      my ($r,$context,$crstype) = @_; 
     my $is_custom = &Apache::loncommon::needs_gci_custom();  
     my $uhome=&Apache::lonnet::homeserver($env{'form.ccuname'},      my $uhome=&Apache::lonnet::homeserver($env{'form.ccuname'},
                                           $env{'form.ccdomain'});                                            $env{'form.ccdomain'});
     # Error messages      # Error messages
Line 2243  sub update_user_data { Line 2214  sub update_user_data {
     if ($env{'form.action'} eq 'singlestudent') {      if ($env{'form.action'} eq 'singlestudent') {
         $helpitem = 'Course_Add_Student';          $helpitem = 'Course_Add_Student';
     }      }
     my $title = 'User Management';      $r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management',
     if ($context eq 'course') {  
         if ($is_custom) {  
             $title = 'Enrollment and Student Activity';  
         }  
     }  
     $r->print(&Apache::lonhtmlcommon::breadcrumbs($title,  
                                                  $helpitem));                                                   $helpitem));
     $r->print(&update_result_form($uhome));      $r->print(&update_result_form($uhome));
     # Check Inputs      # Check Inputs
Line 2725  sub update_user_data { Line 2690  sub update_user_data {
                                 $newenvhash{'environment.requestcourses.'.$key} =                                  $newenvhash{'environment.requestcourses.'.$key} =
                                     $changeHash{'requestcourses.'.$key};                                      $changeHash{'requestcourses.'.$key};
                                 if ($changeHash{'requestcourses.'.$key} ne '') {                                  if ($changeHash{'requestcourses.'.$key} ne '') {
                                     $newenvhash{'environment.canrequest.'.$key} =                                      $newenvhash{'environment.canrequest.'.$key} = 1;
                                         $changeHash{'requestcourses.'.$key};  
                                 } else {                                  } else {
                                     $newenvhash{'environment.canrequest.'.$key} =                                      $newenvhash{'environment.canrequest.'.$key} =
           &Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'},            &Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'},
Line 2740  sub update_user_data { Line 2704  sub update_user_data {
                                         $changeHash{'tools.'.$key};                                          $changeHash{'tools.'.$key};
                                 } else {                                  } else {
                                     $newenvhash{'environment.availabletools.'.$key} =                                      $newenvhash{'environment.availabletools.'.$key} =
           &Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'},            &Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'},                                            $key,'reload','tools');
                                             $key,'reload','tools');  
                                 }                                  }
                             }                              }
                         }                          }
Line 3677  sub custom_role_editor { Line 3640  sub custom_role_editor {
         $context = 'domain';          $context = 'domain';
         $crstype = $env{'form.templatecrstype'};          $crstype = $env{'form.templatecrstype'};
     }      }
     my $is_custom = &Apache::loncommon::needs_gci_custom();  
     my $title = 'User Management';  
     if ($context eq 'course') {  
         if ($is_custom) {  
             $title = 'Enrollment and Student Activity';  
         }  
     }  
 # ------------------------------------------------------- What can be assigned?  # ------------------------------------------------------- What can be assigned?
     my %full=();      my %full=();
     my %courselevel=();      my %courselevel=();
Line 3799  sub custom_role_editor { Line 3755  sub custom_role_editor {
       {href=>"javascript:backPage(document.form1,'','')",        {href=>"javascript:backPage(document.form1,'','')",
          text=>"Edit custom role",           text=>"Edit custom role",
          faq=>282,bug=>'Instructor Interface',});           faq=>282,bug=>'Instructor Interface',});
     $r->print(&Apache::lonhtmlcommon::breadcrumbs($title,      $r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management',
                                                   'Course_Editing_Custom_Roles'));                                                    'Course_Editing_Custom_Roles'));
   
     $r->print($body_top);      $r->print($body_top);
Line 3952  sub set_custom_role { Line 3908  sub set_custom_role {
                  .$jsback."\n"                   .$jsback."\n"
                  .'// ]]>'."\n"                   .'// ]]>'."\n"
                  .'</script>'."\n";                   .'</script>'."\n";
     my $title = 'User Management';  
     my $is_custom = &Apache::loncommon::needs_gci_custom();  
     if ($context eq 'course') {  
         if ($is_custom) {  
             $title = 'Enrollment and Student Activity';  
         }  
     }  
     $r->print(&Apache::loncommon::start_page('Save Custom Role'),$jscript);      $r->print(&Apache::loncommon::start_page('Save Custom Role'),$jscript);
     &Apache::lonhtmlcommon::add_breadcrumb      &Apache::lonhtmlcommon::add_breadcrumb
         ({href=>"javascript:backPage(document.customresult,'pickrole','')",          ({href=>"javascript:backPage(document.customresult,'pickrole','')",
Line 3970  sub set_custom_role { Line 3920  sub set_custom_role {
          {href=>"javascript:backPage(document.customresult,'set_custom_roles','')",           {href=>"javascript:backPage(document.customresult,'set_custom_roles','')",
           text=>"Result",            text=>"Result",
           faq=>282,bug=>'Instructor Interface',});            faq=>282,bug=>'Instructor Interface',});
     $r->print(&Apache::lonhtmlcommon::breadcrumbs($title,      $r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management',
                                                   'Course_Editing_Custom_Roles'));                                                    'Course_Editing_Custom_Roles'));
   
     my ($rdummy,$roledef)=      my ($rdummy,$roledef)=
Line 4048  sub handler { Line 3998  sub handler {
     } else {      } else {
         $context = 'domain';          $context = 'domain';
     }      }
     my $title = 'User Management';  
     my $is_custom = &Apache::loncommon::needs_gci_custom();  
     if ($context eq 'course') {  
         if ($is_custom) {  
             $title = 'Enrollment and Student Activity';  
         }  
     }  
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
         ['action','state','callingform','roletype','showrole','bulkaction','popup','phase',          ['action','state','callingform','roletype','showrole','bulkaction','popup','phase',
          'username','domain','srchterm','srchdomain','srchin','srchby','srchtype']);           'username','domain','srchterm','srchdomain','srchin','srchby','srchtype']);
Line 4062  sub handler { Line 4005  sub handler {
     if ($env{'form.action'} ne 'dateselect') {      if ($env{'form.action'} ne 'dateselect') {
         &Apache::lonhtmlcommon::add_breadcrumb          &Apache::lonhtmlcommon::add_breadcrumb
             ({href=>"/adm/createuser",              ({href=>"/adm/createuser",
               text=>$title,                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'});                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'});
     }      }
     #SD Following files not added to help, because the corresponding .tex-files seem to      #SD Following files not added to help, because the corresponding .tex-files seem to
Line 4082  sub handler { Line 4025  sub handler {
     # Main switch on form.action and form.state, as appropriate      # Main switch on form.action and form.state, as appropriate
     if (! exists($env{'form.action'})) {      if (! exists($env{'form.action'})) {
         $r->print(&header());          $r->print(&header());
         $r->print(&Apache::lonhtmlcommon::breadcrumbs($title));          $r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management'));
         $r->print(&print_main_menu($permission,$context,$crstype));          $r->print(&print_main_menu($permission,$context,$crstype));
         $r->print(&Apache::loncommon::end_page());          $r->print(&Apache::loncommon::end_page());
     } elsif ($env{'form.action'} eq 'upload' && $permission->{'cusr'}) {      } elsif ($env{'form.action'} eq 'upload' && $permission->{'cusr'}) {
Line 4098  sub handler { Line 4041  sub handler {
         if (! exists($env{'form.state'})) {          if (! exists($env{'form.state'})) {
             &Apache::lonuserutils::print_first_users_upload_form($r,$context);              &Apache::lonuserutils::print_first_users_upload_form($r,$context);
         } elsif ($env{'form.state'} eq 'got_file') {          } elsif ($env{'form.state'} eq 'got_file') {
             my $formname;  
             if ($env{'form.caller'} eq 'requestcrs') {  
                 $formname = 'studentform';  
             }  
             &Apache::lonuserutils::print_upload_manager_form($r,$context,              &Apache::lonuserutils::print_upload_manager_form($r,$context,
                                                              $permission,$crstype,$formname);                                                               $permission,$crstype);
         } elsif ($env{'form.state'} eq 'enrolling') {          } elsif ($env{'form.state'} eq 'enrolling') {
             if ($env{'form.datatoken'}) {              if ($env{'form.datatoken'}) {
                 &Apache::lonuserutils::upfile_drop_add($r,$context,$permission);                  &Apache::lonuserutils::upfile_drop_add($r,$context,$permission);
Line 4126  sub handler { Line 4065  sub handler {
             if ($env{'form.phase'} eq 'createnewuser') {              if ($env{'form.phase'} eq 'createnewuser') {
                 my $response;                  my $response;
                 if ($env{'form.srchterm'} !~ /^$match_username$/) {                  if ($env{'form.srchterm'} !~ /^$match_username$/) {
                     my $response = '<p class="LC_warning">'.&mt('You must specify a valid username. Only the following are allowed: letters numbers - . @').'</p>';                      my $response = &mt('You must specify a valid username. Only the following are allowed: letters numbers - . @');
                     $env{'form.phase'} = '';                      $env{'form.phase'} = '';
                     &print_username_entry_form($r,$context,$response,$srch,undef,$crstype);                      &print_username_entry_form($r,$context,$response,$srch,undef,$crstype);
                 } else {                  } else {
Line 4342  sub handler { Line 4281  sub handler {
         $r->print(&Apache::loncommon::end_page());                  $r->print(&Apache::loncommon::end_page());        
     } else {      } else {
         $r->print(&header());          $r->print(&header());
         $r->print(&Apache::lonhtmlcommon::breadcrumbs($title));          $r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management'));
         $r->print(&print_main_menu($permission,$context,$crstype));          $r->print(&print_main_menu($permission,$context,$crstype));
         $r->print(&Apache::loncommon::end_page());          $r->print(&Apache::loncommon::end_page());
     }      }
Line 4388  END Line 4327  END
 #  Menu Phase One  #  Menu Phase One
 sub print_main_menu {  sub print_main_menu {
     my ($permission,$context,$crstype) = @_;      my ($permission,$context,$crstype) = @_;
     my $is_custom = &Apache::loncommon::needs_gci_custom();  
     if (($context eq 'course') && ($is_custom)) {  
         return &print_gci_main_menu($permission,$context,$crstype)  
     }  
     my $linkcontext = $context;      my $linkcontext = $context;
     my $stuterm = lc(&Apache::lonnet::plaintext('st',$crstype));      my $stuterm = lc(&Apache::lonnet::plaintext('st',$crstype));
     if (($context eq 'course') && ($crstype eq 'Community')) {      if (($context eq 'course') && ($crstype eq 'Community')) {
Line 4613  return Apache::lonhtmlcommon::generate_m Line 4548  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  => 'Concept Test Roster and Student Activity',  
                   },  
      );  
      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 {  sub restore_prev_selections {
     my %saveable_parameters = ('srchby'   => 'scalar',      my %saveable_parameters = ('srchby'   => 'scalar',
        'srchin'   => 'scalar',         'srchin'   => 'scalar',
Line 5653  sub role_display_filter { Line 5512  sub role_display_filter {
     # Update Display button      # Update Display button
     $output .= '<p>'      $output .= '<p>'
               .'<input type="submit" value="'.&mt('Update Display').'" />'                .'<input type="submit" value="'.&mt('Update Display').'" />'
               .'</p><hr />';                .'</p>';
   
       # Server version info
       $output .= '<p class="LC_info">'
                 .&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 .= '</p><hr />';
     return $output;      return $output;
 }  }
   
Line 5703  sub user_search_result { Line 5571  sub user_search_result {
     if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'instd')) {      if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'instd')) {
         if (($srch->{'srchdomain'} eq '') ||           if (($srch->{'srchdomain'} eq '') || 
     ! (&Apache::lonnet::domain($srch->{'srchdomain'}))) {      ! (&Apache::lonnet::domain($srch->{'srchdomain'}))) {
             $response = '<p class="LC_warning">'.&mt('You must specify a valid domain when searching in a domain or institutional directory.').'</p>';              $response = &mt('You must specify a valid domain when searching in a domain or institutional directory.')
         }          }
     }      }
     if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'crs') ||      if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'crs') ||
Line 5716  sub user_search_result { Line 5584  sub user_search_result {
                 }                  }
             }              }
             if ($unamecheck !~ /^$match_username$/) {              if ($unamecheck !~ /^$match_username$/) {
                 $response = '<p class="LC_warning">'.&mt('You must specify a valid username. Only the following are allowed: letters numbers - . @').'</p>';                  $response = &mt('You must specify a valid username. Only the following are allowed: letters numbers - . @');
             }              }
         }          }
     }      }
Line 5891  sub user_search_result { Line 5759  sub user_search_result {
                 ($currstate,$response,$forcenewuser) =                   ($currstate,$response,$forcenewuser) = 
                     &build_search_response($context,$srch,%srch_results);                      &build_search_response($context,$srch,%srch_results);
             } else {              } else {
                 my $showdom = &display_domain_info($srch->{'srchdomain'});                  my $showdom = &display_domain_info($srch->{'srchdomain'});                $response = '<span class="LC_warning">'.
                 $response = '<span class="LC_warning">'.  
                     &mt('Institutional directory search is not available in domain: [_1]',$showdom).                      &mt('Institutional directory search is not available in domain: [_1]',$showdom).
                     '</span><br />'.                      '</span><br />'.
                     &mt('You may want to search in the LON-CAPA domain instead of the institutional directory.').                      &mt('You may want to search in the LON-CAPA domain instead of the institutional directory.').
Line 6003  sub build_search_response { Line 5870  sub build_search_response {
     my ($context,$srch,%srch_results) = @_;      my ($context,$srch,%srch_results) = @_;
     my ($currstate,$response,$forcenewuser);      my ($currstate,$response,$forcenewuser);
     my %names = (      my %names = (
           'uname' => 'username',            'uname'     => 'username',
           'lastname' => 'last name',            'lastname'  => 'last name',
           'lastfirst' => 'last name, first name',            'lastfirst' => 'last name, first name',
           'crs' => 'this course',            'crs'       => 'this course',
           'dom' => 'LON-CAPA domain: ',            'dom'       => 'LON-CAPA domain',
           'instd' => 'the institutional directory for domain: ',            'instd'     => 'the institutional directory for domain',
     );      );
   
     my %single = (      my %single = (
Line 6028  sub build_search_response { Line 5895  sub build_search_response {
             $currstate = 'modify';              $currstate = 'modify';
             $response = &mt("$single{$srch->{'srchtype'}} was found for the $names{$srch->{'srchby'}} ([_1]) in $names{$srch->{'srchin'}}.",$srch->{'srchterm'});              $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') {              if ($srch->{'srchin'} eq 'dom' || $srch->{'srchin'} eq 'instd') {
                 $response .= &display_domain_info($srch->{'srchdomain'});                  $response .= ': '.&display_domain_info($srch->{'srchdomain'});
             }              }
         } else {          } else { # Search has nothing found. Prepare message to user.
             $response = '<span class="LC_warning">'.&mt("$nomatch{$srch->{'srchtype'}} found for the $names{$srch->{'srchby'}} ([_1]) in $names{$srch->{'srchin'}}",$srch->{'srchterm'});              $response = '<span class="LC_warning">';
             if ($srch->{'srchin'} eq 'dom' || $srch->{'srchin'} eq 'instd') {              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]",
                                    '<b>'.$srch->{'srchterm'}.'</b>',
                                    &display_domain_info($srch->{'srchdomain'}));
               } else {
                   $response .= &mt("$nomatch{$srch->{'srchtype'}} found for the $names{$srch->{'srchby'}} [_1] in $names{$srch->{'srchin'}}.",
                                    '<b>'.$srch->{'srchterm'}.'</b>');
             }              }
             $response .= '</span>';              $response .= '</span>';
   
             if ($srch->{'srchin'} ne 'alc') {              if ($srch->{'srchin'} ne 'alc') {
                 $forcenewuser = 1;                  $forcenewuser = 1;
                 my $cansrchinst = 0;                   my $cansrchinst = 0; 

Removed from v.1.329.2.4  
changed lines
  Added in v.1.332


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>