Diff for /loncom/interface/loncreateuser.pm between versions 1.249.2.1 and 1.264

version 1.249.2.1, 2008/07/08 04:27:51 version 1.264, 2008/11/27 15:15:06
Line 33  package Apache::loncreateuser; Line 33  package Apache::loncreateuser;
   
 =head1 NAME  =head1 NAME
   
 Apache::loncreateuser - handler to create users and custom roles  Apache::loncreateuser.pm
   
 =head1 SYNOPSIS  =head1 SYNOPSIS
   
 Apache::loncreateuser provides an Apache handler for creating users,      Handler to create users and custom roles
   
       Provides an Apache handler for creating users,
     editing their login parameters, roles, and removing roles, and      editing their login parameters, roles, and removing roles, and
     also creating and assigning custom roles.      also creating and assigning custom roles.
   
Line 833  ENDNOPORTPRIV Line 835  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 850  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 969  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 1396  sub modify_login_block { Line 1398  sub modify_login_block {
 }  }
   
 sub personal_data_display {  sub personal_data_display {
     my ($ccuname,$ccdomain,$newuser,$context,$inst_results) = @_;      my ($ccuname,$ccdomain,$newuser,$context,$inst_results,$rolesarray) = @_;
     my ($output,$showforceid,%userenv,%canmodify);      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 $editable = 0;
     if (!$newuser) {      if (!$newuser) {
         # Get the users information          # Get the users information
         %userenv = &Apache::lonnet::get('environment',          %userenv = &Apache::lonnet::get('environment',
Line 1407  sub personal_data_display { Line 1411  sub personal_data_display {
                     'permanentemail','id'],$ccdomain,$ccuname);                      'permanentemail','id'],$ccdomain,$ccuname);
         %canmodify =          %canmodify =
             &Apache::lonuserutils::can_modify_userinfo($context,$ccdomain,              &Apache::lonuserutils::can_modify_userinfo($context,$ccdomain,
                                                        \@userinfo);                                                         \@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 1416  sub personal_data_display { Line 1423  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 1432  sub personal_data_display { Line 1439  sub personal_data_display {
               &Apache::lonhtmlcommon::start_pick_box();                &Apache::lonhtmlcommon::start_pick_box();
     foreach my $item (@userinfo) {      foreach my $item (@userinfo) {
         my $rowtitle = $lt{$item};          my $rowtitle = $lt{$item};
           my $hiderow = 0;
         if ($item eq 'generation') {          if ($item eq 'generation') {
             $rowtitle = $genhelp.$rowtitle;              $rowtitle = $genhelp.$rowtitle;
         }          }
         $output .= &Apache::lonhtmlcommon::row_title($rowtitle,undef,'LC_oddrow_value')."\n";          my $row = &Apache::lonhtmlcommon::row_title($rowtitle,undef,'LC_oddrow_value')."\n";
         if ($newuser) {          if ($newuser) {
             if (ref($inst_results) eq 'HASH') {              if (ref($inst_results) eq 'HASH') {
                 if ($inst_results->{$item} ne '') {                  if ($inst_results->{$item} ne '') {
                     $output .= '<input type="hidden" name="c'.$item.'" value="'.$inst_results->{$item}.'" />'.$inst_results->{$item};                      $row .= '<input type="hidden" name="c'.$item.'" value="'.$inst_results->{$item}.'" />'.$inst_results->{$item};
                 } else {                  } else {
                     $output .= '<input type="text" name="c'.$item.'" size="'.$textboxsize{$item}.'" value="" />';                      if ($context eq 'selfcreate') {
                           if ($canmodify{$item}) { 
                               $row .= '<input type="text" name="c'.$item.'" size="'.$textboxsize{$item}.'" value="" />';
                               $editable ++;
                           } else {
                               $hiderow = 1;
                           }
                       } else {
                           $row .= '<input type="text" name="c'.$item.'" size="'.$textboxsize{$item}.'" value="" />';
                       }
                 }                  }
             } else {              } else {
                 $output .= '<input type="text" name="c'.$item.'" size="'.$textboxsize{$item}.'" value="" />';                  if ($context eq 'selfcreate') {
                       if ($canmodify{$item}) {
                           $row .= '<input type="text" name="c'.$item.'" size="'.$textboxsize{$item}.'" value="" />';
                           $editable ++;
                       } else {
                           $hiderow = 1;
                       }
                   } else {
                       $row .= '<input type="text" name="c'.$item.'" size="'.$textboxsize{$item}.'" value="" />';
                   }
             }              }
         } else {          } else {
             if ($canmodify{$item}) {              if ($canmodify{$item}) {
                 $output .= '<input type="text" name="c'.$item.'" size="'.$textboxsize{$item}.'" value="'.$userenv{$item}.'" />';                  $row .= '<input type="text" name="c'.$item.'" size="'.$textboxsize{$item}.'" value="'.$userenv{$item}.'" />';
             } else {              } else {
                 $output .= $userenv{$item};                  $row .= $userenv{$item};
             }              }
             if ($item eq 'id') {              if ($item eq 'id') {
                 $showforceid = $canmodify{$item};                  $showforceid = $canmodify{$item};
             }              }
         }          }
         $output .= &Apache::lonhtmlcommon::row_closure(1);          $row .= &Apache::lonhtmlcommon::row_closure(1);
           if (!$hiderow) {
               $output .= $row;
               $rowcount ++;
           }
     }      }
     $output .= &Apache::lonhtmlcommon::end_pick_box();      $output .= &Apache::lonhtmlcommon::end_pick_box();
     if (wantarray) {      if (wantarray) {
         return ($output,$showforceid);          if ($context eq 'selfcreate') {
               return($output,$rowcount,$editable);
           } else {
               return ($output,$showforceid);
           }
     } else {      } else {
         return $output;          return $output;
     }      }
 }  }
   
   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 {
       my ($insthashref) = @_;
       my @inststatuses = ();
       if (ref($insthashref) eq 'HASH') {
           if (ref($insthashref->{'inststatus'}) eq 'ARRAY') {
               @inststatuses = @{$insthashref->{'inststatus'}};
           }
       }
       return @inststatuses;
   }
   
 # ================================================================= Phase Three  # ================================================================= Phase Three
 sub update_user_data {  sub update_user_data {
     my ($r,$context) = @_;       my ($r,$context) = @_; 
Line 1789  sub update_user_data { Line 1849  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 1800  sub update_user_data { Line 1860  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 1914  sub update_user_data { Line 1977  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 1997  END Line 2060  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 2040  END Line 2103  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 2542  sub custom_role_editor { Line 2607  sub custom_role_editor {
     my @template_roles = ("cc","in","ta","ep","st");      my @template_roles = ("cc","in","ta","ep","st");
     foreach my $role (@template_roles) {      foreach my $role (@template_roles) {
         $head_script .= &make_script_template($role);          $head_script .= &make_script_template($role);
         $button_code .= &make_button_code($role);          $button_code .= &make_button_code($role).' ';
     }      }
     $head_script .= "\n".$jsback."\n".'</script>'."\n";      $head_script .= "\n".$jsback."\n".'</script>'."\n";
     $r->print(&Apache::loncommon::start_page('Custom Role Editor',$head_script));      $r->print(&Apache::loncommon::start_page('Custom Role Editor',$head_script));
Line 2562  sub custom_role_editor { Line 2627  sub custom_role_editor {
     'crl'  => "Course Level",      'crl'  => "Course Level",
                     'dml'  => "Domain Level",                      'dml'  => "Domain Level",
                     'ssl'  => "System Level");                      'ssl'  => "System Level");
     $r->print(&mt('Select a Template').'<br />');  
     $r->print('<form action="">');      $r->print('<div>'
     $r->print($button_code);               .'<form action=""><fieldset>'
     $r->print('</form>');               .'<legend>'.&mt('Select a Template').'</legend>'
                .$button_code
                .'</fieldset></form>'
                .'</div>'
       );
   
     $r->print(<<ENDCCF);      $r->print(<<ENDCCF);
 <form name="form1" method="post">  <form name="form1" method="post">
 <input type="hidden" name="phase" value="set_custom_roles" />  <input type="hidden" name="phase" value="set_custom_roles" />
Line 2668  sub make_script_template { Line 2738  sub make_script_template {
 sub make_button_code {  sub make_button_code {
     my ($role) = @_;      my ($role) = @_;
     my $label = &Apache::lonnet::plaintext($role);      my $label = &Apache::lonnet::plaintext($role);
     my $button_code = '<input type="button" onClick="set_'.$role.'()" value="'.$label.'" />';          my $button_code = '<input type="button" onClick="set_'.$role.'()" value="'.$label.'" />';
     return ($button_code);      return ($button_code);
 }  }
 # ---------------------------------------------------------- Call to definerole  # ---------------------------------------------------------- Call to definerole
Line 3349  function getIndexByName(item) { Line 3419  function getIndexByName(item) {
     return -1;      return -1;
 }  }
 ENDSCRIPT  ENDSCRIPT
       my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
       my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
   
     my $output = '<script type="text/javascript">'."\n".      my $output = '<script type="text/javascript">'."\n".
                  $setsec_js."\n".$selfenroll_js."\n".                   $setsec_js."\n".$selfenroll_js."\n".
                  '</script>'."\n".                   '</script>'."\n".
                  '<h3>'.$lt->{'selfenroll'}.'</h3>'."\n".                   '<h3>'.$lt->{'selfenroll'}.'</h3>'."\n";
                  '<form name="'.$formname.'" method="post" action="/adm/createuser">'."\n".      my ($visible,$cansetvis,$vismsgs,$visactions) = &visible_in_cat($cdom,$cnum);
                  &Apache::lonhtmlcommon::start_pick_box();      if (ref($visactions) eq 'HASH') {
     my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};          if ($visible) {
     my $cnum = $env{'course.'.$env{'request.course.id'},'.num'};              $output .= '<p>'.$visactions->{'vis'}.'</p>';
           } else {
               $output .= $visactions->{'miss'}.'<br />'.$visactions->{'yous'}.
                          '<p>'.$visactions->{'gen'}.'<br />'.$visactions->{'coca'};
               if (ref($vismsgs) eq 'ARRAY') {
                   $output .= '<br />'.$visactions->{'make'}.'<ul>';
                   foreach my $item (@{$vismsgs}) {
                       $output .= '<li>'.$visactions->{$item}.'</li>';
                   }
                   $output .= '</ul>';
               }
               $output .= '</p>';
           }
       }
       $output .= '<form name="'.$formname.'" method="post" action="/adm/createuser">'."\n".
                  &Apache::lonhtmlcommon::start_pick_box();
     if (ref($row) eq 'ARRAY') {      if (ref($row) eq 'ARRAY') {
         foreach my $item (@{$row}) {          foreach my $item (@{$row}) {
             my $title = $item;               my $title = $item; 
Line 3508  ENDSCRIPT Line 3596  ENDSCRIPT
     return;      return;
 }  }
   
   sub visible_in_cat {
       my ($cdom,$cnum) = @_;
       my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$cdom);
       my ($cathash,%settable,@vismsgs,$cansetvis);
       my %visactions = &Apache::lonlocal::texthash(
                      vis => 'Your course currently appears in the Course Catalog for this domain.',
                      gen => 'Courses can be both self-cataloging, based on an institutional code (e.g., fs08phy231), or can be assigned categories from a hierarchy defined for the domain.',
                      miss => 'Your course does not currently appear in the Course Catalog for this domain.',
                      yous => 'You should remedy this if you plan to allow self-enrollment, otherwise students will have difficulty finding your course.',
                      coca => 'Courses can be absent from the Catalog, because they do not have an institutional code, have no assigned category, or have been specifically excluded.',
                      make => 'Make any changes to self-enrollment settings below, click "Save changes", then take action to include the course in the Catalog:',
                      take => 'Take the following action to ensure the course appears in the Catalog:',
                      dc_unhide  => 'Ask a domain coordinator to change the "Exclude from course catalog" setting.',
                      dc_addinst => 'Ask a domain coordinator to enable display the catalog of "Official courses (with institutional codes)".',
                      dc_instcode => 'Ask a domain coordinator to assign an institutional code (if this is an official course).',
                      dc_catalog  => 'Ask a domain coordinator to enable or create at least one course category in the domain.',
                      dc_categories => 'Ask a domain coordinator to create a hierarchy of categories and sub categories for courses 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.',
       );
       $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{'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 ($domconf{'coursecategories'}{'togglecats'} eq 'crs') {
               $settable{'togglecats'} = 1;
           }
           if ($domconf{'coursecategories'}{'categorize'} eq 'crs') {
               $settable{'categorize'} = 1;
           }
           $cathash = $domconf{'coursecategories'}{'cats'};
       }
       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.');   
       } 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.'); 
       } 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.');  
       } else {
           $cansetvis = &mt('Only a Domain Coordinator may assign a course category or choose to exclude this course from the catalog.'); 
       }
        
       my %currsettings =
           &Apache::lonnet::get('environment',['hidefromcat','categories','internal.coursecode'],
                                $cdom,$cnum);
       my $visible = 0;
       if ($currsettings{'internal.coursecode'} ne '') {
           if (ref($domconf{'coursecategories'}) eq 'HASH') {
               $cathash = $domconf{'coursecategories'}{'cats'};
               if (ref($cathash) eq 'HASH') {
                   if ($cathash->{'instcode::0'} eq '') {
                       push(@vismsgs,'dc_addinst'); 
                   } else {
                       $visible = 1;
                   }
               } else {
                   $visible = 1;
               }
           } else {
               $visible = 1;
           }
       } else {
           if (ref($cathash) eq 'HASH') {
               if ($cathash->{'instcode::0'} ne '') {
                   push(@vismsgs,'dc_instcode');
               }
           } else {
               push(@vismsgs,'dc_instcode');
           }
       }
       if ($currsettings{'categories'} ne '') {
           my $cathash;
           if (ref($domconf{'coursecategories'}) eq 'HASH') {
               $cathash = $domconf{'coursecategories'}{'cats'};
               if (ref($cathash) eq 'HASH') {
                   if (keys(%{$cathash}) == 0) {
                       push(@vismsgs,'dc_catalog');
                   } elsif ((keys(%{$cathash}) == 1) && ($cathash->{'instcode::0'} ne '')) {
                       push(@vismsgs,'dc_categories');
                   } else {
                       my @currcategories = split('&',$currsettings{'categories'});
                       my $matched = 0;
                       foreach my $cat (@currcategories) {
                           if ($cathash->{$cat} ne '') {
                               $visible = 1;
                               $matched = 1;
                               last;
                           }
                       }
                       if (!$matched) {
                           if ($settable{'categorize'}) { 
                               push(@vismsgs,'chgcat');
                           } else {
                               push(@vismsgs,'dc_chgcat');
                           }
                       }
                   }
               }
           }
       } else {
           if (ref($cathash) eq 'HASH') {
               if ((keys(%{$cathash}) > 1) || 
                   (keys(%{$cathash}) == 1) && ($cathash->{'instcode::0'} eq '')) {
                   if ($settable{'categorize'}) {
                       push(@vismsgs,'addcat');
                   } else {
                       push(@vismsgs,'dc_addcat');
                   }
               }
           }
       }
       if ($currsettings{'hidefromcat'} eq 'yes') {
           $visible = 0;
           if ($settable{'togglecats'}) {
               unshift(@vismsgs,'unhide');
           } else {
               unshift(@vismsgs,'dc_unhide')
           }
       }
       return ($visible,$cansetvis,\@vismsgs,\%visactions);
   }
   
 sub new_selfenroll_dom_row {  sub new_selfenroll_dom_row {
     my ($newdom,$num) = @_;      my ($newdom,$num) = @_;
     my $domdesc = &Apache::lonnet::domain($newdom);      my $domdesc = &Apache::lonnet::domain($newdom);
Line 3538  sub selfenroll_inst_types { Line 3748  sub selfenroll_inst_types {
     my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($currdom);      my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($currdom);
     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 (keys(%{$usertypes}) > 0) {
             $othervalue = 'other';              $othervalue = 'other';
         }          }
         $output .= '<table><tr>';          $output .= '<table><tr>';
Line 3547  sub selfenroll_inst_types { Line 3757  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 3655  sub print_userchangelogs_display { Line 3866  sub print_userchangelogs_display {
                    &mt('Context').'</th><th>'.&mt('Start').'</th><th>'.&mt('End').'</th>'.                     &mt('Context').'</th><th>'.&mt('Start').'</th><th>'.&mt('End').'</th>'.
                    &Apache::loncommon::end_data_table_header_row();                     &Apache::loncommon::end_data_table_header_row();
     my ($minshown,$maxshown);      my ($minshown,$maxshown);
     my $minshown = 1;      $minshown = 1;
     my $count = 0;      my $count = 0;
     if ($curr{'show'} ne &mt('all')) {       if ($curr{'show'} ne &mt('all')) { 
         $maxshown = $curr{'page'} * $curr{'show'};          $maxshown = $curr{'page'} * $curr{'show'};
Line 4543  sub update_selfenroll_config { Line 4754  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 {
Line 4666  sub update_selfenroll_config { Line 4878  sub update_selfenroll_config {
     } else {      } else {
         $r->print(&mt('No changes were made to the existing self-enrollment settings in this course.'));          $r->print(&mt('No changes were made to the existing self-enrollment settings in this course.'));
     }      }
       my ($visible,$cansetvis,$vismsgs,$visactions) = &visible_in_cat($cdom,$cnum);
       if (ref($visactions) eq 'HASH') {
           if (!$visible) {
               $r->print('<br />'.$visactions->{'miss'}.'<br />'.$visactions->{'yous'}.
                         '<br />');
               if (ref($vismsgs) eq 'ARRAY') {
                   $r->print('<br />'.$visactions->{'take'}.'<ul>');
                   foreach my $item (@{$vismsgs}) {
                       $r->print('<li>'.$visactions->{$item}.'</li>');
                   }
                   $r->print('</ul>');
               }
               $r->print($cansetvis);
           }
       } 
     return;      return;
 }  }
   
Line 4675  sub get_selfenroll_titles { Line 4902  sub get_selfenroll_titles {
                 types        => 'Users allowed to self-enroll in this course',                  types        => 'Users allowed to self-enroll in this course',
                 registered   => 'Restrict self-enrollment to students officially registered for the course',                  registered   => 'Restrict self-enrollment to students officially registered for the course',
                 enroll_dates => 'Dates self-enrollment available',                  enroll_dates => 'Dates self-enrollment available',
                 access_dates => 'Course access dates for self-enrolled users',                  access_dates => 'Course access dates assigned to self-enrolling users',
                 section      => 'Section assigned to self-enrolled users',                  section      => 'Section assigned to self-enrolling users',
              );               );
     return (\@row,\%lt);      return (\@row,\%lt);
 }  }

Removed from v.1.249.2.1  
changed lines
  Added in v.1.264


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