Diff for /loncom/interface/loncreateuser.pm between versions 1.80 and 1.86

version 1.80, 2004/03/05 02:14:34 version 1.86, 2004/08/24 23:50:15
Line 123  sub print_username_entry_form { Line 123  sub print_username_entry_form {
     my $defdom=$ENV{'request.role.domain'};      my $defdom=$ENV{'request.role.domain'};
     my @domains = &Apache::loncommon::get_domains();      my @domains = &Apache::loncommon::get_domains();
     my $domform = &Apache::loncommon::select_dom_form($defdom,'ccdomain');      my $domform = &Apache::loncommon::select_dom_form($defdom,'ccdomain');
     my $bodytag =&Apache::loncommon::bodytag(      my $bodytag =&Apache::loncommon::bodytag('Create Users, Change User Privileges').&Apache::loncommon::help_open_menu('',undef,undef,'',282,'Instructor Interface');
                                   'Create Users, Change User Privileges').  
   &Apache::loncommon::help_open_faq(282).  
   &Apache::loncommon::help_open_bug('Instructor Interface');  
     my $selscript=&Apache::loncommon::studentbrowser_javascript();      my $selscript=&Apache::loncommon::studentbrowser_javascript();
     my $sellink=&Apache::loncommon::selectstudent_link      my $sellink=&Apache::loncommon::selectstudent_link
                                         ('crtuser','ccuname','ccdomain');                                          ('crtuser','ccuname','ccdomain');
Line 177  sub print_user_modification_page { Line 174  sub print_user_modification_page {
     my $ccuname=$ENV{'form.ccuname'};      my $ccuname=$ENV{'form.ccuname'};
     my $ccdomain=$ENV{'form.ccdomain'};      my $ccdomain=$ENV{'form.ccdomain'};
   
     $ccuname=~s/\W//gs;      $ccuname=~s/[\W|_]//gs;
     $ccdomain=~s/\W//gs;      $ccdomain=~s/[\W|_]//gs;
   
     unless (($ccuname) && ($ccdomain)) {      unless (($ccuname) && ($ccdomain)) {
  &print_username_entry_form($r);   &print_username_entry_form($r);
Line 345  END Line 342  END
     'rer'  => "Revoke Existing Roles",      'rer'  => "Revoke Existing Roles",
                     'rev'  => "Revoke",                                          'rev'  => "Revoke",                    
                     'del'  => "Delete",                      'del'  => "Delete",
       'ren'  => "Re-Enable",
                     'rol'  => "Role",                      'rol'  => "Role",
                     'ext'  => "Extent",                      'ext'  => "Extent",
                     'sta'  => "Start",                      'sta'  => "Start",
Line 354  END Line 352  END
 <hr />  <hr />
 <h3>$lt{'rer'}</h3>  <h3>$lt{'rer'}</h3>
 <table>  <table>
 <tr><th>$lt{'rev'}</th><th>$lt{'del'}</th><th>$lt{'rol'}</th><th>$lt{'ext'}</th><th>$lt{'sta'}</th><th>$lt{'end'}</th>  <tr><th>$lt{'rev'}</th><th>$lt{'ren'}</th><th>$lt{'del'}</th><th>$lt{'rol'}</th><th>$lt{'ext'}</th><th>$lt{'sta'}</th><th>$lt{'end'}</th>
 END  END
            my (%roletext,%sortrole,%roleclass);             my (%roletext,%sortrole,%roleclass);
    foreach my $area (sort { my $a1=join('_',(split('_',$a))[1,0]);     foreach my $area (sort { my $a1=join('_',(split('_',$a))[1,0]);
Line 391  END Line 389  END
        $sortkey.="\0".$coursedata{'description'};         $sortkey.="\0".$coursedata{'description'};
    } else {     } else {
        $carea=&mt('Unavailable course').': '.$area;         $carea=&mt('Unavailable course').': '.$area;
        $sortkey.="\0".&mt('Unavailable course');         $sortkey.="\0".&mt('Unavailable course').': '.$area;
    }     }
                    $inccourses{$1.'_'.$2}=1;                     $inccourses{$1.'_'.$2}=1;
                    if ((&Apache::lonnet::allowed('c'.$role_code,$1.'/'.$2)) ||                     if ((&Apache::lonnet::allowed('c'.$role_code,$1.'/'.$2)) ||
Line 466  END Line 464  END
    }     }
                }                 }
        $row.='</td><td>';         $row.='</td><td>';
                  if ($allowed && !$active) {
                      $row.= '<input type="checkbox" name="ren:'.$thisrole.'">';
                  } else {
                      $row.='&nbsp;';
                  }
          $row.='</td><td>';
                if ($delallowed) {                 if ($delallowed) {
                    $row.= '<input type="checkbox" name="del:'.$thisrole.'">';                     $row.= '<input type="checkbox" name="del:'.$thisrole.'">';
                } else {                 } else {
Line 957  END Line 961  END
                      $ENV{'course.'.$cid.'.home'}).'</b><br>');                       $ENV{'course.'.$cid.'.home'}).'</b><br>');
  }   }
     }       } 
    } elsif ($_=~/^form\.ren/) {
       if ($_=~/^form\.ren\:([^\_]+)\_([^\_]+)$/) {
    my $result=&Apache::lonnet::assignrole($ENV{'form.ccdomain'},
    $ENV{'form.ccuname'},$1,$2,0,$now);
    $r->print(&mt('Re-Enabling [_1] in [_2]: [_3]',
         $2,$1,$result).'<br />');
    if ($2 eq 'st') {
       $1=~/^\/(\w+)\/(\w+)/;
       my $cid=$1.'_'.$2;
       $r->print(&mt('Add to classlist').': <b>'.
         &Apache::lonnet::critical(
     'put:'.$ENV{'course.'.$cid.'.domain'}.':'.
                              $ENV{'course.'.$cid.'.num'}.':classlist:'.
                                      &Apache::lonnet::escape(
                                          $ENV{'form.ccuname'}.':'.
                                          $ENV{'form.ccdomain'} ).'='.
                                      &Apache::lonnet::escape(':'.$now),
          $ENV{'course.'.$cid.'.home'})
         .'</b><br>');
    }
       } 
  } elsif ($_=~/^form\.act/) {   } elsif ($_=~/^form\.act/) {
     if       if ($_=~/^form\.act\_([^\_]+)\_([^\_]+)\_cr_cr_([^\_]+)_(\w+)_([^\_]+)$/) {
 ($_=~/^form\.act\_([^\_]+)\_([^\_]+)\_cr_cr_([^\_]+)_(\w+)_([^\_]+)$/) {  
                 # Activate a custom role                  # Activate a custom role
  my $url='/'.$1.'/'.$2;   my ($one,$two,$three,$four,$five)=($1,$2,$3,$4,$5);
  my $full=$1.'_'.$2.'_cr_cr_'.$3.'_'.$4.'_'.$5;   my $url='/'.$one.'/'.$two;
    my $full=$one.'_'.$two.'_cr_cr_'.$three.'_'.$four.'_'.$five;
    $ENV{'form.sec_'.$full}=~s/\W//g;
  if ($ENV{'form.sec_'.$full}) {   if ($ENV{'form.sec_'.$full}) {
     $url.='/'.$ENV{'form.sec_'.$full};      $url.='/'.$ENV{'form.sec_'.$full};
  }   }
Line 974  END Line 1000  END
       $ENV{'form.end_'.$full} :        $ENV{'form.end_'.$full} :
       0 );        0 );
   
     $r->print(&mt('Assigning custom role').' "'.$5.'" by '.$4.'@'.$3.' in '.$url.      $r->print(&mt('Assigning custom role').' "'.$five.'" by '.$four.'@'.$three.' in '.$url.
                          ($start?', '.&mt('starting').' '.localtime($start):'').                           ($start?', '.&mt('starting').' '.localtime($start):'').
                          ($end?', ending '.localtime($end):'').': <b>'.                           ($end?', ending '.localtime($end):'').': <b>'.
       &Apache::lonnet::assigncustomrole(        &Apache::lonnet::assigncustomrole(
  $ENV{'form.ccdomain'},$ENV{'form.ccuname'},$url,$3,$4,$5,$end,$start).   $ENV{'form.ccdomain'},$ENV{'form.ccuname'},$url,$three,$four,$five,$end,$start).
       '</b><br>');        '</b><br>');
     } elsif ($_=~/^form\.act\_([^\_]+)\_([^\_]+)\_([^\_]+)$/) {      } elsif ($_=~/^form\.act\_([^\_]+)\_([^\_]+)\_([^\_]+)$/) {
  # Activate roles for sections with 3 id numbers   # Activate roles for sections with 3 id numbers
  # set start, end times, and the url for the class   # set start, end times, and the url for the class
    my ($one,$two,$three)=($1,$2,$3);
  my $start = ( $ENV{'form.start_'.$1.'_'.$2.'_'.$3} ?    my $start = ( $ENV{'form.start_'.$one.'_'.$two.'_'.$three} ? 
       $ENV{'form.start_'.$1.'_'.$2.'_'.$3} :         $ENV{'form.start_'.$one.'_'.$two.'_'.$three} : 
       $now );        $now );
  my $end   = ( $ENV{'form.end_'.$1.'_'.$2.'_'.$3} ?    my $end   = ( $ENV{'form.end_'.$one.'_'.$two.'_'.$three} ? 
       $ENV{'form.end_'.$1.'_'.$2.'_'.$3} :        $ENV{'form.end_'.$one.'_'.$two.'_'.$three} :
       0 );        0 );
  my $url='/'.$1.'/'.$2;   my $url='/'.$one.'/'.$two;
  if ($ENV{'form.sec_'.$1.'_'.$2.'_'.$3}) {   $ENV{'form.sec_'.$one.'_'.$two.'_'.$three}=~s/\W//g;
     $url.='/'.$ENV{'form.sec_'.$1.'_'.$2.'_'.$3};   if ($ENV{'form.sec_'.$one.'_'.$two.'_'.$three}) {
       $url.='/'.$ENV{'form.sec_'.$one.'_'.$two.'_'.$three};
  }   }
  # Assign the role and report it   # Assign the role and report it
  $r->print(&mt('Assigning').' '.$3.' in '.$url.   $r->print(&mt('Assigning').' '.$three.' in '.$url.
                          ($start?', '.&mt('starting').' '.localtime($start):'').                           ($start?', '.&mt('starting').' '.localtime($start):'').
                          ($end?', '.&mt('ending').' '.localtime($end):'').': <b>'.                           ($end?', '.&mt('ending').' '.localtime($end):'').': <b>'.
                           &Apache::lonnet::assignrole(                            &Apache::lonnet::assignrole(
                               $ENV{'form.ccdomain'},$ENV{'form.ccuname'},                                $ENV{'form.ccdomain'},$ENV{'form.ccuname'},
                               $url,$3,$end,$start).                                $url,$three,$end,$start).
   '</b><br>');    '</b><br>');
  # Handle students differently   # Handle students differently
  if ($3 eq 'st') {   if ($three eq 'st') {
     $url=~/^\/(\w+)\/(\w+)/;      $url=~/^\/(\w+)\/(\w+)/;
     my $cid=$1.'_'.$2;      my $cid=$one.'_'.$two;
     $r->print(&mt('Add to classlist').': <b>'.      $r->print(&mt('Add to classlist').': <b>'.
       &Apache::lonnet::critical(        &Apache::lonnet::critical(
   'put:'.$ENV{'course.'.$cid.'.domain'}.':'.    'put:'.$ENV{'course.'.$cid.'.domain'}.':'.
Line 1269  sub course_level_table { Line 1296  sub course_level_table {
  my $bgcol=$thiscourse;   my $bgcol=$thiscourse;
  $bgcol=~s/[^7-9a-e]//g;   $bgcol=~s/[^7-9a-e]//g;
  $bgcol=substr($bgcol.$bgcol.$bgcol.'ffffff',2,6);   $bgcol=substr($bgcol.$bgcol.$bgcol.'ffffff',2,6);
    my ($domain)=split(/\//,$thiscourse);
  foreach  ('st','ta','ep','ad','in','cc') {   foreach  ('st','ta','ep','ad','in','cc') {
     if (&Apache::lonnet::allowed('c'.$_,$thiscourse)) {      if (&Apache::lonnet::allowed('c'.$_,$thiscourse)) {
  my $plrole=&Apache::lonnet::plaintext($_);   my $plrole=&Apache::lonnet::plaintext($_);
Line 1276  sub course_level_table { Line 1304  sub course_level_table {
 <tr bgcolor="#$bgcol">  <tr bgcolor="#$bgcol">
 <td><input type="checkbox" name="act_$protectedcourse\_$_"></td>  <td><input type="checkbox" name="act_$protectedcourse\_$_"></td>
 <td>$plrole</td>  <td>$plrole</td>
 <td>$area</td>  <td>$area<br />Domain: $domain</td>
 ENDEXTENT  ENDEXTENT
         if ($_ ne 'cc') {          if ($_ ne 'cc') {
     $table .= <<ENDSECTION;      $table .= <<ENDSECTION;

Removed from v.1.80  
changed lines
  Added in v.1.86


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