Diff for /loncom/interface/loncreateuser.pm between versions 1.256 and 1.262

version 1.256, 2008/07/16 12:06:28 version 1.262, 2008/11/17 14:31:33
Line 833  ENDNOPORTPRIV Line 833  ENDNOPORTPRIV
                 $addrolesdisplay = $add_domainroles;                  $addrolesdisplay = $add_domainroles;
             }              }
             $r->print(&course_level_dc($env{'request.role.domain'},'Course'));              $r->print(&course_level_dc($env{'request.role.domain'},'Course'));
             $r->print('<br /><input type="button" value="'.&mt('Modify User').'" onClick="setCourse()" />'."\n");              $r->print('<br /><input type="button" value="'.&mt('Save').'" onClick="setCourse()" />'."\n");
         } elsif ($context eq 'author') {          } elsif ($context eq 'author') {
             if ($addrolesdisplay) {              if ($addrolesdisplay) {
                 $r->print('<br /><input type="button" value="'.&mt('Modify User').'"');                  $r->print('<br /><input type="button" value="'.&mt('Save').'"');
                 if ($newuser) {                  if ($newuser) {
                     $r->print(' onClick="auth_check()" \>'."\n");                      $r->print(' onClick="auth_check()" \>'."\n");
                 } else {                  } else {
Line 848  ENDNOPORTPRIV Line 848  ENDNOPORTPRIV
             }              }
         } else {          } else {
             $r->print(&course_level_table(%inccourses));              $r->print(&course_level_table(%inccourses));
             $r->print('<br /><input type="button" value="'.&mt('Modify User').'" onClick="setSections(this.form)" />'."\n");              $r->print('<br /><input type="button" value="'.&mt('Save').'" onClick="setSections(this.form)" />'."\n");
         }          }
     }      }
     $r->print(&Apache::lonhtmlcommon::echo_form_input(['phase','userrole','ccdomain','prevphase','currstate','ccuname','ccdomain']));      $r->print(&Apache::lonhtmlcommon::echo_form_input(['phase','userrole','ccdomain','prevphase','currstate','ccuname','ccdomain']));
Line 967  sub display_existing_roles { Line 967  sub display_existing_roles {
                 if (defined($coursedata{'description'})) {                  if (defined($coursedata{'description'})) {
                     $carea=$coursedata{'description'}.                      $carea=$coursedata{'description'}.
                         '<br />'.&mt('Domain').': '.$coursedom.('&nbsp;'x8).                          '<br />'.&mt('Domain').': '.$coursedom.('&nbsp;'x8).
      &Apache::loncommon::syllabuswrapper('Syllabus',$coursedir,$coursedom);       &Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$coursedir,$coursedom);
                     $sortkey.="\0".$coursedata{'description'};                      $sortkey.="\0".$coursedata{'description'};
                     $class=$coursedata{'type'};                      $class=$coursedata{'type'};
                 } else {                  } else {
Line 1397  sub modify_login_block { Line 1397  sub modify_login_block {
   
 sub personal_data_display {  sub personal_data_display {
     my ($ccuname,$ccdomain,$newuser,$context,$inst_results,$rolesarray) = @_;      my ($ccuname,$ccdomain,$newuser,$context,$inst_results,$rolesarray) = @_;
     my ($output,$showforceid,%userenv,%canmodify,@inststatuses);      my ($output,$showforceid,%userenv,%canmodify);
     my @userinfo = ('firstname','middlename','lastname','generation',      my @userinfo = ('firstname','middlename','lastname','generation',
                     'permanentemail','id');                      'permanentemail','id');
     my $rowcount = 0;      my $rowcount = 0;
     my $editable = 0;      my $editable = 0;
     if ($context eq 'selfcreate') {  
         if (ref($inst_results) eq 'HASH') {  
             @inststatuses = &get_inststatuses($inst_results);  
             if (@inststatuses == 0) {  
                 @inststatuses = ('default');  
             }  
             $rolesarray = \@inststatuses;  
         }  
     }  
     if (!$newuser) {      if (!$newuser) {
         # Get the users information          # Get the users information
         %userenv = &Apache::lonnet::get('environment',          %userenv = &Apache::lonnet::get('environment',
                    ['firstname','middlename','lastname','generation',                     ['firstname','middlename','lastname','generation',
                     'permanentemail','id'],$ccdomain,$ccuname);                      'permanentemail','id'],$ccdomain,$ccuname);
     }  
     if ((!$newuser) || ($context eq 'selfcreate')) {  
         %canmodify =          %canmodify =
             &Apache::lonuserutils::can_modify_userinfo($context,$ccdomain,              &Apache::lonuserutils::can_modify_userinfo($context,$ccdomain,
                                                        \@userinfo,$rolesarray);                                                         \@userinfo,$rolesarray);
       } elsif ($context eq 'selfcreate') {
           %canmodify = &selfcreate_canmodify($context,$ccdomain,\@userinfo,
                                              $inst_results,$rolesarray);
     }      }
     my %lt=&Apache::lonlocal::texthash(      my %lt=&Apache::lonlocal::texthash(
                 'pd'             => "Personal Data",                  'pd'             => "Personal Data",
Line 1429  sub personal_data_display { Line 1421  sub personal_data_display {
                 'lastname'       => "Last Name",                  'lastname'       => "Last Name",
                 'generation'     => "Generation",                  'generation'     => "Generation",
                 'permanentemail' => "Permanent e-mail address",                  'permanentemail' => "Permanent e-mail address",
                 'id'             => "ID/Student Number",                  'id'             => "Student/Employee ID",
                 'lg'             => "Login Data"                  'lg'             => "Login Data"
     );      );
     my %textboxsize = (      my %textboxsize = (
Line 1506  sub personal_data_display { Line 1498  sub personal_data_display {
     }      }
 }  }
   
   sub selfcreate_canmodify {
       my ($context,$dom,$userinfo,$inst_results,$rolesarray) = @_;
       if (ref($inst_results) eq 'HASH') {
           my @inststatuses = &get_inststatuses($inst_results);
           if (@inststatuses == 0) {
               @inststatuses = ('default');
           }
           $rolesarray = \@inststatuses;
       }
       my %canmodify =
           &Apache::lonuserutils::can_modify_userinfo($context,$dom,$userinfo,
                                                      $rolesarray);
       return %canmodify;
   }
   
 sub get_inststatuses {  sub get_inststatuses {
     my ($insthashref) = @_;      my ($insthashref) = @_;
     my @inststatuses = ();      my @inststatuses = ();
Line 1840  sub update_user_data { Line 1847  sub update_user_data {
                 $env{'form.c'.$item} = $userenv{$item};                  $env{'form.c'.$item} = $userenv{$item};
             }              }
         }          }
         # Check to see if we can change the ID/student number          # Check to see if we can change the Student/Employee ID
         my $forceid = $env{'form.forceid'};          my $forceid = $env{'form.forceid'};
         my $recurseid = $env{'form.recurseid'};          my $recurseid = $env{'form.recurseid'};
         my (%alerts,%rulematch,%idinst_results,%curr_rules,%got_rules);          my (%alerts,%rulematch,%idinst_results,%curr_rules,%got_rules);
Line 1851  sub update_user_data { Line 1858  sub update_user_data {
             (!$forceid)) {              (!$forceid)) {
             if ($env{'form.cid'} ne $uidhash{$env{'form.ccuname'}}) {              if ($env{'form.cid'} ne $uidhash{$env{'form.ccuname'}}) {
                 $env{'form.cid'} = $userenv{'id'};                  $env{'form.cid'} = $userenv{'id'};
                 $no_forceid_alert = &mt('New student/employeeID does not match existing ID for this user.').'<br />'.&mt('Change is not permitted without checking the \'Force ID change\' checkbox on the previous page.').'<br />'."\n";                          $no_forceid_alert = &mt('New Student/Employee ID does not match existing ID for this user.')
                                      .'<br />'
                                      .&mt("Change is not permitted without checking the 'Force ID change' checkbox on the previous page.")
                                      .'<br />'."\n";
             }              }
         }          }
         if ($env{'form.cid'} ne $userenv{'id'}) {          if ($env{'form.cid'} ne $userenv{'id'}) {
Line 1965  sub update_user_data { Line 1975  sub update_user_data {
                              'mddl' => "middle",                               'mddl' => "middle",
                              'lst'  => "last",                               'lst'  => "last",
      'gen'  => "generation",       'gen'  => "generation",
                              'id'   => "ID/Student number",                               'id'   => "Student/Employee ID",
                              'mail' => "permanent e-mail",                               'mail' => "permanent e-mail",
                              'disk' => "disk space allocated to portfolio files",                               'disk' => "disk space allocated to portfolio files",
                              'prvs' => "Previous",                               'prvs' => "Previous",
Line 2048  END Line 2058  END
             # They did not want to change the users name or quota but we can              # They did not want to change the users name or quota but we can
             # still tell them what the name and quota are               # still tell them what the name and quota are 
     my %lt=&Apache::lonlocal::texthash(      my %lt=&Apache::lonlocal::texthash(
                            'id'   => "ID/Student number",                             'id'   => "Student/Employee ID",
                            'mail' => "Permanent e-mail",                             'mail' => "Permanent e-mail",
                            'disk' => "Disk space allocated to user's portfolio files",                             'disk' => "Disk space allocated to user's portfolio files",
        );         );
Line 2091  END Line 2101  END
             $r->print('<span class="LC_cusr_emph">'.$rolestr.'</span><br />'.              $r->print('<span class="LC_cusr_emph">'.$rolestr.'</span><br />'.
                       &mt('Contact your <a href="[_1]">helpdesk</a> for more information.',"javascript:helpMenu('display')").'<br />');                        &mt('Contact your <a href="[_1]">helpdesk</a> for more information.',"javascript:helpMenu('display')").'<br />');
         }          }
         $r->print($no_forceid_alert.          $r->print('<span class="LC_warning">'
                   &Apache::lonuserutils::print_namespacing_alerts($env{'form.ccdomain'},\%alerts,\%curr_rules));                    .$no_forceid_alert
                     .&Apache::lonuserutils::print_namespacing_alerts($env{'form.ccdomain'},\%alerts,\%curr_rules)
                     .'</span>');
     }      }
     if ($env{'form.action'} eq 'singlestudent') {      if ($env{'form.action'} eq 'singlestudent') {
         &enroll_single_student($r,$uhome,$amode,$genpwd,$now,$newuser,$context);          &enroll_single_student($r,$uhome,$amode,$genpwd,$now,$newuser,$context);
Line 3597  sub visible_in_cat { Line 3609  sub visible_in_cat {
                    dc_chgcat => 'Ask a domain coordinator to change the category assigned to the course, as the one currently assigned is no longer used in the domain',                     dc_chgcat => 'Ask a domain coordinator to change the category assigned to the course, as the one currently assigned is no longer used in the domain',
                    dc_addcat => 'Ask a domain coordinator to assign a category to the course.',                     dc_addcat => 'Ask a domain coordinator to assign a category to the course.',
     );      );
     $visactions{'unhide'} = &mt('Use [_1]Set course environment[_2] to change the "Exclude from course catalog" setting.','<a href="/adm/parmset?action=crsenv">','</a>');      $visactions{'unhide'} = &mt('Use [_1]Set course environment[_2] to change the "Exclude from course catalog" setting.','"<a href="/adm/parmset?action=crsenv">','</a>"');
     $visactions{'chgcat'} = &mt('Use [_1]Set course environment[_2] to change the category assigned to the course, as the one currently assigned is no longer used in the domain.','<a href="/adm/parmset?action=crsenv">','</a>');      $visactions{'chgcat'} = &mt('Use [_1]Set course environment[_2] to change the category assigned to the course, as the one currently assigned is no longer used in the domain.','"<a href="/adm/parmset?action=crsenv">','</a>"');
     $visactions{'addcat'} = &mt('Use [_1]Set course environment[_2] to assign a category to the course.','<a href="/adm/parmset?action=crsenv">','</a>');      $visactions{'addcat'} = &mt('Use [_1]Set course environment[_2] to assign a category to the course.','"<a href="/adm/parmset?action=crsenv">','</a>"');
     if (ref($domconf{'coursecategories'}) eq 'HASH') {      if (ref($domconf{'coursecategories'}) eq 'HASH') {
         if ($domconf{'coursecategories'}{'togglecats'} eq 'crs') {          if ($domconf{'coursecategories'}{'togglecats'} eq 'crs') {
             $settable{'togglecats'} = 1;              $settable{'togglecats'} = 1;
Line 3609  sub visible_in_cat { Line 3621  sub visible_in_cat {
         }          }
         $cathash = $domconf{'coursecategories'}{'cats'};          $cathash = $domconf{'coursecategories'}{'cats'};
     }      }
     if ($settable{'togglecats'} && $settable{'categories'}) {      if ($settable{'togglecats'} && $settable{'categorize'}) {
         $cansetvis = &mt('You are able to both assign a course category and choose to exclude this course from the catalog.');             $cansetvis = &mt('You are able to both assign a course category and choose to exclude this course from the catalog.');   
     } elsif ($settable{'togglecats'}) {      } elsif ($settable{'togglecats'}) {
         $cansetvis = &mt('You are able to choose to exclude this course from the catalog, but only a Domain Coordinator may assign a course category.');           $cansetvis = &mt('You are able to choose to exclude this course from the catalog, but only a Domain Coordinator may assign a course category.'); 
     } elsif ($settable{'categories'}) {      } elsif ($settable{'categorize'}) {
         $cansetvis = &mt('You may assign a course category, but only a Domain Coordinator may choose to exclude this course from the catalog.');            $cansetvis = &mt('You may assign a course category, but only a Domain Coordinator may choose to exclude this course from the catalog.');  
     } else {      } else {
         $cansetvis = &mt('Only a Domain Coordinator may assign a course category or choose to exclude this course from the catalog.');           $cansetvis = &mt('Only a Domain Coordinator may assign a course category or choose to exclude this course from the catalog.'); 
Line 3667  sub visible_in_cat { Line 3679  sub visible_in_cat {
                         }                          }
                     }                      }
                     if (!$matched) {                      if (!$matched) {
                         if ($settable{'categories'}) {                           if ($settable{'categorize'}) { 
                             push(@vismsgs,'chgcat');                              push(@vismsgs,'chgcat');
                         } else {                          } else {
                             push(@vismsgs,'dc_chgcat');                              push(@vismsgs,'dc_chgcat');
Line 3680  sub visible_in_cat { Line 3692  sub visible_in_cat {
         if (ref($cathash) eq 'HASH') {          if (ref($cathash) eq 'HASH') {
             if ((keys(%{$cathash}) > 1) ||               if ((keys(%{$cathash}) > 1) || 
                 (keys(%{$cathash}) == 1) && ($cathash->{'instcode::0'} eq '')) {                  (keys(%{$cathash}) == 1) && ($cathash->{'instcode::0'} eq '')) {
                 if ($settable{'categories'}) {                  if ($settable{'categorize'}) {
                     push(@vismsgs,'addcat');                      push(@vismsgs,'addcat');
                 } else {                  } else {
                     push(@vismsgs,'dc_addcat');                      push(@vismsgs,'dc_addcat');
Line 3738  sub selfenroll_inst_types { Line 3750  sub selfenroll_inst_types {
                 $output .= '</tr><tr>';                  $output .= '</tr><tr>';
             }              }
             if (defined($usertypes->{$type})) {              if (defined($usertypes->{$type})) {
                   my $esc_type = &escape($type);
                 $output .= '<td><span class="LC_nobreak"><label><input type = "checkbox" value="'.                  $output .= '<td><span class="LC_nobreak"><label><input type = "checkbox" value="'.
                            $type.'" ';                             $esc_type.'" ';
                 if (ref($currinsttypes) eq 'ARRAY') {                  if (ref($currinsttypes) eq 'ARRAY') {
                     if (@{$currinsttypes} > 0) {                      if (@{$currinsttypes} > 0) {
                         if (grep(/^any$/,@{$currinsttypes})) {                          if (grep(/^any$/,@{$currinsttypes})) {
                             $output .= 'checked="checked"';                              $output .= 'checked="checked"';
                         } elsif (grep(/^\Q$type\E$/,@{$currinsttypes})) {                          } elsif (grep(/^\Q$esc_type\E$/,@{$currinsttypes})) {
                             $output .= 'checked="checked"';                              $output .= 'checked="checked"';
                         }                          }
                     } else {                      } else {
Line 4734  sub update_selfenroll_config { Line 4747  sub update_selfenroll_config {
                             my $othervalue = 'any';                              my $othervalue = 'any';
                             if ((ref($types) eq 'ARRAY') && (ref($usertypes) eq 'HASH')) {                              if ((ref($types) eq 'ARRAY') && (ref($usertypes) eq 'HASH')) {
                                 if (@{$types} > 0) {                                  if (@{$types} > 0) {
                                       my @esc_types = map { &escape($_); } @{$types};
                                     $othervalue = 'other';                                      $othervalue = 'other';
                                     $typestr = join(',',(@{$types},$othervalue));                                      $typestr = join(',',(@esc_types,$othervalue));
                                 }                                  }
                                 $typestr = $othervalue;                                  $typestr = $othervalue;
                             } else {                              } else {

Removed from v.1.256  
changed lines
  Added in v.1.262


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