Diff for /loncom/interface/loncreateuser.pm between versions 1.268.2.8 and 1.269

version 1.268.2.8, 2009/03/18 15:31:46 version 1.269, 2008/12/15 00:12:38
Line 213  END_SCRIPT Line 213  END_SCRIPT
                     $tool_on = '';                      $tool_on = '';
                 }                  }
             }              }
               $curr_access = &Apache::lonnet::usertools_access($ccuname,$ccdomain,$item);
             $output .= '  <tr class="LC_info_row">'."\n".              $output .= '  <tr class="LC_info_row">'."\n".
                        '   <td>'.$lt{$item}.'</td>'."\n".                         '   <td>'.$lt{$item}.'</td>'."\n".
                        '  </tr>'."\n".                         '  </tr>'."\n".
Line 769  $lt{'hs'}: $home_server_pick Line 770  $lt{'hs'}: $home_server_pick
                     my $authtype = $rules->{$matchedrule}{'authtype'};                      my $authtype = $rules->{$matchedrule}{'authtype'};
                     if ($authtype !~ /^(krb4|krb5|int|fsys|loc)$/) {                      if ($authtype !~ /^(krb4|krb5|int|fsys|loc)$/) {
                         $r->print(&Apache::lonuserutils::set_login($ccdomain,$authformkrb,$authformint,$authformloc));                          $r->print(&Apache::lonuserutils::set_login($ccdomain,$authformkrb,$authformint,$authformloc));
                     } else {                      } else { 
                         my $authparm = $rules->{$matchedrule}{'authparm'};                          my $authparm = $rules->{$matchedrule}{'authparm'};
                         $authmsg = $rules->{$matchedrule}{'authmsg'};  
                         if ($authtype =~ /^krb(4|5)$/) {                          if ($authtype =~ /^krb(4|5)$/) {
                             my $ver = $1;                              my $ver = $1;
                             if ($authparm ne '') {                              if ($authparm ne '') {
Line 780  $lt{'hs'}: $home_server_pick Line 780  $lt{'hs'}: $home_server_pick
 <input type="hidden" name="krbver" value="$ver" />  <input type="hidden" name="krbver" value="$ver" />
 <input type="hidden" name="krbarg" value="$authparm" />  <input type="hidden" name="krbarg" value="$authparm" />
 KERB  KERB
                                   $authmsg = $rules->{$matchedrule}{'authmsg'};    
                             }                              }
                         } else {                          } else {
                             $fixedauth =                               $fixedauth = 
Line 788  KERB Line 789  KERB
                                 $fixedauth .=                                      $fixedauth .=    
 '<input type="hidden" name="'.$authtype.'arg" value="'.$authparm.'" />'."\n";  '<input type="hidden" name="'.$authtype.'arg" value="'.$authparm.'" />'."\n";
                             } else {                              } else {
                                 if ($authtype eq 'int') {                                  $varauth =  
                                     $varauth = '<br />'.  
 &mt('[_1] Internally authenticated (with initial password [_2])','','<input type="password" size="10" name="intarg" value="" />')."<label><input type=\"checkbox\" name=\"visible\" onClick='if (this.checked) { this.form.intarg.type=\"text\" } else { this.form.intarg.type=\"password\" }' />".&mt('Visible input').'</label>';  
                                 } elsif ($authtype eq 'loc') {  
                                     $varauth = '<br />'.  
 &mt('[_1] Local Authentication with argument [_2]','','<input type="text" name="'.$authtype.'arg" value="" />')."\n";  
                                 } else {  
                                     $varauth =  
 '<input type="text" name="'.$authtype.'arg" value="" />'."\n";  '<input type="text" name="'.$authtype.'arg" value="" />'."\n";
                                 }  
                             }                              }
                         }                          }
                     }                      }
Line 1561  sub personal_data_display { Line 1554  sub personal_data_display {
                 }                  }
             } else {              } else {
                 if ($context eq 'selfcreate') {                  if ($context eq 'selfcreate') {
                     if (($item eq 'permanentemail') && ($newuser eq 'email')) {                      if ($canmodify{$item}) {
                         $row .= $ccuname;                          $row .= '<input type="text" name="c'.$item.'" size="'.$textboxsize{$item}.'" value="" />';
                           $editable ++;
                     } else {                      } else {
                         if ($canmodify{$item}) {                          $hiderow = 1;
                             $row .= '<input type="text" name="c'.$item.'" size="'.$textboxsize{$item}.'" value="" />';  
                             $editable ++;  
                         } else {  
                             $hiderow = 1;  
                         }  
                     }                      }
                 } else {                  } else {
                     $row .= '<input type="text" name="c'.$item.'" size="'.$textboxsize{$item}.'" value="" />';                      $row .= '<input type="text" name="c'.$item.'" size="'.$textboxsize{$item}.'" value="" />';
Line 1691  sub update_user_data { Line 1680  sub update_user_data {
     }      }
     if (  $env{'form.ccuname'} ne       if (  $env{'form.ccuname'} ne 
   &LONCAPA::clean_username($env{'form.ccuname'}) ) {    &LONCAPA::clean_username($env{'form.ccuname'}) ) {
  $r->print($error.&mt('Invalid login name.').'  '.   $r->print($error.&mt('Invalid login name').'.  '.
   &mt('Only letters, numbers, periods, dashes, @, and underscores are valid.').    &mt('Only letters, numbers, periods, dashes, @, and underscores are valid').'.'.
   $end.$rtnlink);    $end.$rtnlink);
  return;   return;
     }      }
Line 1702  sub update_user_data { Line 1691  sub update_user_data {
     }      }
     if (  $env{'form.ccdomain'} ne      if (  $env{'form.ccdomain'} ne
   &LONCAPA::clean_domain($env{'form.ccdomain'}) ) {    &LONCAPA::clean_domain($env{'form.ccdomain'}) ) {
  $r->print($error.&mt ('Invalid domain name.').'  '.   $r->print($error.&mt ('Invalid domain name').'.  '.
   &mt('Only letters, numbers, periods, dashes, and underscores are valid.').    &mt('Only letters, numbers, periods, dashes, and underscores are valid').'.'.
   $end.$rtnlink);    $end.$rtnlink);
  return;   return;
     }      }
Line 2082  sub update_user_data { Line 2071  sub update_user_data {
                     }                      }
                 } else {                  } else {
                     $changed{$tool} = &tool_admin($tool,'',\%changeHash);                      $changed{$tool} = &tool_admin($tool,'',\%changeHash);
                       print STDERR "for $tool - changed is $changed{$tool}\n";
                     if ($changed{$tool}) {                      if ($changed{$tool}) {
                         $newaccess{$tool} = &mt('default');                          $newaccess{$tool} = &mt('default');
                     } else {                      } else {
Line 2135  sub update_user_data { Line 2125  sub update_user_data {
                     &Apache::lonnet::put('environment',\%changeHash,                      &Apache::lonnet::put('environment',\%changeHash,
                                   $env{'form.ccdomain'},$env{'form.ccuname'});                                    $env{'form.ccdomain'},$env{'form.ccuname'});
                 if ($chgresult eq 'ok') {                  if ($chgresult eq 'ok') {
                       my %newenvhash;
                       my $hashid="$env{'form.ccuname'}:$env{'form.ccdomain'}";
                       foreach my $key (keys(%changed)) {
                           if ($key ne 'quota') {
                               &Apache::lonnet::devalidate_cache_new('usertools.'.$key,$hashid);
                               $newenvhash{'environment.tools.'.$key} = 
                                   $changeHash{'tools.'.$key};
                           }
                       }
                     if (($env{'user.name'} eq $env{'form.ccuname'}) &&                      if (($env{'user.name'} eq $env{'form.ccuname'}) &&
                         ($env{'user.domain'} eq $env{'form.ccdomain'})) {                          ($env{'user.domain'} eq $env{'form.ccdomain'})) {
                         my %newenvhash;                          &Apache::lonnet::appenv(\%newenvhash);
                         foreach my $key (keys(%changed)) {  
                             if ($key ne 'quota') {  
                                 $newenvhash{'environment.tools.'.$key} =   
                                     $changeHash{'tools.'.$key};  
                                 $newenvhash{'environment.availabletools.'.$key} =  
                                     $changeHash{'tools.'.$key};  
                             }  
                         }  
                         if (keys(%newenvhash)) {  
                             &Apache::lonnet::appenv(\%newenvhash);  
                         }  
                     }                      }
                 }                  }
             }              }
Line 3377  sub print_main_menu { Line 3365  sub print_main_menu {
                                    listusers => 'Display Co-authors and Manage Multiple Users',                                     listusers => 'Display Co-authors and Manage Multiple Users',
                                  },                                   },
                        course => {                         course => {
                                    upload => 'Upload a File of Course Users',                                     upload => 'File of Course Users',
                                    singleuser => 'Add/Modify a Single Course User',                                     singleuser => 'Single Course User',
                                    listusers => 'Display Class Lists and Manage Multiple Users',                                     listusers => 'Course User Lists',
                                  },                                   },
                      );                       );
     my @menu =    my @menu = ( {categorytitle => 'Add Users',
         (       items =>
           { text => $links{$context}{'upload'},       [{
             help => 'Course_Create_Class_List',           linktext => $links{$context}{'upload'},
             action => 'upload',           icon => 'sctr.png',
             permission => $permission->{'cusr'},           #help => 'Course_Create_Class_List',
             },           url => '/adm/createuser?action=upload',
           { text => $links{$context}{'singleuser'},           permission => $permission->{'cusr'},
             help => 'Course_Change_Privileges',           linktitle => 'Upload a CSV or a text file containing users.',
             action => 'singleuser',       },
             permission => $permission->{'cusr'},       {
             },           linktext => $links{$context}{'singleuser'},
           { text => $links{$context}{'listusers'},           icon => 'edit-redo.png',
             help => 'Course_View_Class_List',           #help => 'Course_Change_Privileges',
             action => 'listusers',           url => '/adm/createuser?action=singleuser',
             permission => ($permission->{'view'} || $permission->{'cusr'}),           permission => $permission->{'cusr'},
           },           linktitle => 'Add a user with a certain role to this course.',
         );       }]},
     if ($context eq 'domain' || $context eq 'course') {       {categorytitle => 'Administration',
         my $customlink =  { text => 'Edit Custom Roles',       items =>
                             help => 'Course_Editing_Custom_Roles',       [{
                             action => 'custom',           linktext => $links{$context}{'listusers'},
                             permission => $permission->{'custom'},                   icon => 'edit-find.png',
                           };                   #help => 'Course_View_Class_List',
         push(@menu,$customlink);                   url => '/adm/createuser?action=listusers',
     }           permission => ($permission->{'view'} || $permission->{'cusr'}),
     if ($context eq 'course') {           linktitle => 'Show and manage users of this course.',
         my ($cnum,$cdom) = &Apache::lonuserutils::get_course_identity();       }]},
         my @courselinks =       {categorytitle => 'Configuration',
             (       items =>
               { text => 'Enroll a Single Student',       [
                  help => 'Course_Add_Student',       ]},
                  action => 'singlestudent',     );
                  permission => $permission->{'cusr'},  
                  },      if ($context eq 'domain'){
               { text => 'Drop Students',  
                 help => 'Course_Drop_Student',   push(@{ $menu[1]->{items} },
                 action => 'drop',   { linktext => 'Custom Roles',
                 permission => $permission->{'cusr'},   icon => 'emblem-photos.png',
               });   #help => 'Course_Editing_Custom_Roles',
         if (!exists($permission->{'cusr_section'})) {   url => '/adm/createuser?action=custom',
             push(@courselinks,   permission => $permission->{'custom'},
                { text => 'Automated Enrollment Manager',   linktitle => 'Configure a custom role.',
                  help => 'Course_Automated_Enrollment',   });
                  permission => (&Apache::lonnet::auto_run($cnum,$cdom)  
                                 && $permission->{'cusr'}),      }elsif ($context eq 'course'){
                  url  => '/adm/populate',      my ($cnum,$cdom) = &Apache::lonuserutils::get_course_identity();
                  },  
                { text => 'Configure User Self-enrollment',          push(@{ $menu[0]->{items} },
                  help => 'Course_Self_Enrollment',   { linktext => 'Single Student',
                  action => 'selfenroll',              #help => 'Course_Add_Student',
                  permission => $permission->{'cusr'},   icon => 'list-add.png',
                });              url => '/adm/createuser?action=singlestudent',
         }   permission => $permission->{'cusr'},
         push(@courselinks,              linktitle => 'Add a user with the role student to this course.',
                { text => 'Manage Course Groups',          });
                  help => 'Course_Manage_Group',  
                  permission => $permission->{'grp_manage'},          push(@{ $menu[1]->{items} },  
                  url => '/adm/coursegroups?refpage=cusr',   { linktext => 'Drop Students',
                },   icon => 'edit-undo.png',
                { text => 'View Change Logs',              #help => 'Course_Drop_Student',
                  help => 'Course_User_Logs',              url => '/adm/createuser?action=drop',
                  action => 'changelogs',   permission => $permission->{'cusr'},
                  permission => $permission->{'cusr'},              linktitle =>'Remove a student from this course.',
                },);          },
    { linktext => 'Custom Roles',
    icon => 'emblem-photos.png',
               #help => 'Course_Editing_Custom_Roles',
               url => '/adm/createuser?action=custom',
    permission => $permission->{'custom'},
    linktitle => 'Configure a custom role.',
           });
   
           if (!exists($permission->{'cusr_section'})){
          
    push(@{ $menu[2]->{items} },
    { linktext => 'Automated Enrollment',
    icon => 'roles.png',
             #help => 'Course_Automated_Enrollment',
           permission => (&Apache::lonnet::auto_run($cnum,$cdom)
                                   && $permission->{'cusr'}),
    url  => '/adm/populate',
    linktitle => 'Automated enrollment manager.',
    },
    { linktext => 'User Self-Enrollment',
    icon => 'cstr.png',
          #help => 'Course_Self_Enrollment',
    url => '/adm/createuser?action=selfenroll',
    permission => $permission->{'cusr'},
    linktitle => 'Configure user self enrollment.',
           });
   
    }
   
    push(@{ $menu[2]->{items} },
    { linktext => 'Course Groups',
    icon => 'conf.png',
           #help => 'Course_Manage_Group',
               url => '/adm/coursegroups?refpage=cusr',
    permission => $permission->{'grp_manage'},
    linktitle => 'Manage course groups.',
           },
           { linktext => 'Change Logs',
    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);
 #               { text => 'View Log-in History',  #               { text => 'View Log-in History',
 #                 help => 'Course_User_Logins',  #                 help => 'Course_User_Logins',
 #                 action => 'logins',  #                 action => 'logins',
 #                 permission => $permission->{'cusr'},  #                 permission => $permission->{'cusr'},
 #               });  #               });
         push(@menu,@courselinks);  
     }  
     my $menu_html = '';  
     foreach my $menu_item (@menu) {  
         next if (! $menu_item->{'permission'});  
         $menu_html.='<p>';  
         if (exists($menu_item->{'help'})) {  
             $menu_html.=  
                 &Apache::loncommon::help_open_topic($menu_item->{'help'});  
         }  
         $menu_html.='<font size="+1">';  
         if (exists($menu_item->{'url'})) {  
             $menu_html.=qq{<a href="$menu_item->{'url'}">};  
         } else {  
             $menu_html.=  
                 qq{<a href="/adm/createuser?action=$menu_item->{'action'}">};        }  
         $menu_html.= &mt($menu_item->{'text'}).'</a></font>';  
         $menu_html.='</p>';  
     }  
     return $menu_html;  
 }  }
   
 sub restore_prev_selections {  sub restore_prev_selections {
Line 3674  ENDSCRIPT Line 3688  ENDSCRIPT
     my ($visible,$cansetvis,$vismsgs,$visactions) = &visible_in_cat($cdom,$cnum);      my ($visible,$cansetvis,$vismsgs,$visactions) = &visible_in_cat($cdom,$cnum);
     if (ref($visactions) eq 'HASH') {      if (ref($visactions) eq 'HASH') {
         if ($visible) {          if ($visible) {
             $output .= '<p class="LC_info">'.$visactions->{'vis'}.'</p>';              $output .= '<p>'.$visactions->{'vis'}.'</p>';
         } else {          } else {
             $output .= '<p class="LC_warning">'.$visactions->{'miss'}.'</p>'              $output .= $visactions->{'miss'}.'<br />'.$visactions->{'yous'}.
                        .$visactions->{'yous'}.  
                        '<p>'.$visactions->{'gen'}.'<br />'.$visactions->{'coca'};                         '<p>'.$visactions->{'gen'}.'<br />'.$visactions->{'coca'};
             if (ref($vismsgs) eq 'ARRAY') {              if (ref($vismsgs) eq 'ARRAY') {
                 $output .= '<br />'.$visactions->{'make'}.'<ul>';                  $output .= '<br />'.$visactions->{'make'}.'<ul>';

Removed from v.1.268.2.8  
changed lines
  Added in v.1.269


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