Diff for /loncom/interface/loncreateuser.pm between versions 1.76 and 1.82

version 1.76, 2004/01/15 03:18:19 version 1.82, 2004/05/07 22:04:16
Line 250  ENDFORMINFO Line 250  ENDFORMINFO
             '<option value="default" selected>default</option>'."\n".              '<option value="default" selected>default</option>'."\n".
                 &Apache::loncommon::home_server_option_list($ccdomain);                  &Apache::loncommon::home_server_option_list($ccdomain);
                   
     my %lt=&Apache::lonlocal::texthash(   my %lt=&Apache::lonlocal::texthash(
                     'cnu'  => "Create New User",                      'cnu'  => "Create New User",
                     'nu'   => "New User",                      'nu'   => "New User",
                     'id'   => "in domain",                      'id'   => "in domain",
Line 263  ENDFORMINFO Line 263  ENDFORMINFO
                     'hs'   => "Home Server",                      'hs'   => "Home Server",
                     'lg'   => "Login Data"                      'lg'   => "Login Data"
        );         );
    my $genhelp=&Apache::loncommon::help_open_topic('Generation');
  $r->print(<<ENDNEWUSER);   $r->print(<<ENDNEWUSER);
 $dochead  $dochead
 <h1>$lt{'cnu'}</h1>  <h1>$lt{'cnu'}</h1>
Line 281  $loginscript Line 282  $loginscript
     <td><input type='text' name='cmiddle' size='15' /></td></tr>      <td><input type='text' name='cmiddle' size='15' /></td></tr>
 <tr><td>$lt{'ln'}   </td>  <tr><td>$lt{'ln'}   </td>
     <td><input type='text' name='clast'   size='15' /></td></tr>      <td><input type='text' name='clast'   size='15' /></td></tr>
 <tr><td>$lt{'gen'}  </td>  <tr><td>$lt{'gen'}$genhelp</td>
     <td><input type='text' name='cgen'    size='5'  /></td></tr>      <td><input type='text' name='cgen'    size='5'  /></td></tr>
 </table>  </table>
 $lt{'idsn'} <input type='text' name='cstid'   size='15' /></p>  $lt{'idsn'} <input type='text' name='cstid'   size='15' /></p>
Line 295  $lt{'hs'}: <select name="hserver" size=" Line 296  $lt{'hs'}: <select name="hserver" size="
 <p>$authformloc </p>  <p>$authformloc </p>
 ENDNEWUSER  ENDNEWUSER
     } else { # user already exists      } else { # user already exists
     my %lt=&Apache::lonlocal::texthash(   my %lt=&Apache::lonlocal::texthash(
                     'cup'  => "Change User Privileges",                      'cup'  => "Change User Privileges",
                     'usr'  => "User",                                          'usr'  => "User",                    
                     'id'   => "in domain",                      'id'   => "in domain",
Line 344  END Line 345  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 352  END Line 354  END
            $r->print(<<END);             $r->print(<<END);
 <hr />  <hr />
 <h3>$lt{'rer'}</h3>  <h3>$lt{'rer'}</h3>
 <table border=2>  <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);
    foreach my $area (sort { my $a1=join('_',(split('_',$a))[1,0]);     foreach my $area (sort { my $a1=join('_',(split('_',$a))[1,0]);
     my $b1=join('_',(split('_',$b))[1,0]);      my $b1=join('_',(split('_',$b))[1,0]);
     return $a1 cmp $b1;      return $a1 cmp $b1;
  } keys(%rolesdump)) {   } keys(%rolesdump)) {
                next if ($area =~ /^rolesdef/);                 next if ($area =~ /^rolesdef/);
          my $envkey=$area;
                my $role = $rolesdump{$area};                 my $role = $rolesdump{$area};
                my $thisrole=$area;                 my $thisrole=$area;
                $area =~ s/\_\w\w$//;                 $area =~ s/\_\w\w$//;
Line 371  END Line 375  END
                my $bgcol='ffffff';                 my $bgcol='ffffff';
                my $allowed=0;                 my $allowed=0;
                my $delallowed=0;                 my $delallowed=0;
          my $sortkey=$role_code;
          my $class='Unknown';
                if ($area =~ /^\/(\w+)\/(\d\w+)/ ) {                 if ($area =~ /^\/(\w+)\/(\d\w+)/ ) {
      $class='Course';
                    my ($coursedom,$coursedir) = ($1,$2);                     my ($coursedom,$coursedir) = ($1,$2);
      $sortkey.="\0$1";
                    # $1.'_'.$2 is the course id (eg. 103_12345abcef103l3).                     # $1.'_'.$2 is the course id (eg. 103_12345abcef103l3).
                    my %coursedata=                     my %coursedata=
                        &Apache::lonnet::coursedescription($1.'_'.$2);                         &Apache::lonnet::coursedescription($1.'_'.$2);
    my $carea;     my $carea;
    if (defined($coursedata{'description'})) {     if (defined($coursedata{'description'})) {
        $carea=&mt('Course').': '.$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('Syllabus',$coursedir,$coursedom);
          $sortkey.="\0".$coursedata{'description'};
    } else {     } else {
        $carea=&mt('Unavailable course').': '.$area;         $carea=&mt('Unavailable course').': '.$area;
          $sortkey.="\0".&mt('Unavailable course');
    }     }
                    $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 409  END Line 419  END
                    }                     }
                    $area=$carea;                     $area=$carea;
                } else {                 } else {
      $sortkey.="\0".$area;
                    # Determine if current user is able to revoke privileges                     # Determine if current user is able to revoke privileges
                    if ($area=~ /^\/(\w+)\//) {                     if ($area=~ /^\/(\w+)\//) {
                        if ((&Apache::lonnet::allowed('c'.$role_code,$1)) ||                         if ((&Apache::lonnet::allowed('c'.$role_code,$1)) ||
Line 425  END Line 436  END
                            $allowed=1;                             $allowed=1;
                        }                         }
                    }                     }
      if ($role_code eq 'ca' || $role_code eq 'au') {
          $class='Construction Space';
      } elsif ($role_code eq 'su') {
          $class='System';
      } else {
          $class='Domain';
      }
                }                 }
                if ($role_code eq 'ca') {                 if ($role_code eq 'ca') {
                    $area=~/\/(\w+)\/(\w+)/;                     $area=~/\/(\w+)\/(\w+)/;
Line 434  END Line 452  END
                        $allowed=0;                         $allowed=0;
                    }                     }
                }                 }
          $bgcol='77FF77';
                my $row = '';                 my $row = '';
                $row.='<tr bgcolor="#'.$bgcol.'"><td>';                 $row.='<tr bgcolor="#'.$bgcol.'"><td>';
                my $active=1;                 my $active=1;
Line 448  END Line 467  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 467  END Line 492  END
                       '</td><td>'.($role_end_time  ?localtime($role_end_time)                        '</td><td>'.($role_end_time  ?localtime($role_end_time)
                                                    : '&nbsp;' )                                                     : '&nbsp;' )
                       ."</td></tr>\n";                        ."</td></tr>\n";
                $r->print($row);         $sortrole{$sortkey}=$envkey;
          $roletext{$envkey}=$row;
          $roleclass{$envkey}=$class;
                  #$r->print($row);
            } # end of foreach        (table building loop)             } # end of foreach        (table building loop)
      foreach my $type ('Construction Space','Course','Domain','System','Unknown') {
          my $output;
          foreach my $which (sort {uc($a) cmp uc($b)} (keys(%sortrole))) {
      if ($roleclass{$sortrole{$which}} =~ /^\Q$type\E/) { 
          $output.=$roletext{$sortrole{$which}};
      }
          }
          if (defined($output)) {
      $r->print("<tr bgcolor='#BBffBB'>".
        "<td align='center' colspan='7'>".&mt($type)."</td>");
          }
          $r->print($output);
      }
    $r->print('</table>');     $r->print('</table>');
         }  # End of unless          }  # End of unless
  my $currentauth=&Apache::lonnet::queryauthenticate($ccuname,$ccdomain);   my $currentauth=&Apache::lonnet::queryauthenticate($ccuname,$ccdomain);
Line 585  ENDOTHERAUTHS Line 626  ENDOTHERAUTHS
                     'rol'  => "Role",                      'rol'  => "Role",
                     'ext'  => "Extent",                      'ext'  => "Extent",
                     'sta'  => "Start",                      'sta'  => "Start",
                     'end'  => "End".                      'end'  => "End",
                     'cau'  => "Co-Author",                      'cau'  => "Co-Author",
                     'ssd'  => "Set Start Date",                      'ssd'  => "Set Start Date",
                     'sed'  => "Set End Date"                      'sed'  => "Set End Date"
Line 595  ENDOTHERAUTHS Line 636  ENDOTHERAUTHS
 <table border=2><tr><th>$lt{'act'}</th><th>$lt{'rol'}</th><th>$lt{'ext'}</th>  <table border=2><tr><th>$lt{'act'}</th><th>$lt{'rol'}</th><th>$lt{'ext'}</th>
 <th>$lt{'sta'}</th><th>$lt{'end'}</th></tr>  <th>$lt{'sta'}</th><th>$lt{'end'}</th></tr>
 <tr>  <tr>
 <td><input type=checkbox name="act_$cudom\_$cuname\_ca"></td>  <td><input type=checkbox name="act_$cudom\_$cuname\_ca" /></td>
 <td>$lt{'cau'}</td>  <td>$lt{'cau'}</td>
 <td>$cudom\_$cuname</td>  <td>$cudom\_$cuname</td>
 <td><input type=hidden name="start_$cudom\_$cuname\_ca" value=''>  <td><input type=hidden name="start_$cudom\_$cuname\_ca" value='' />
 <a href=  <a href=
 "javascript:pjump('date_start','Start Date Co-Author',document.cu.start_$cudom\_$cuname\_ca.value,'start_$cudom\_$cuname\_ca','cu.pres','dateset')">$lt{'ssd'}</a></td>  "javascript:pjump('date_start','Start Date Co-Author',document.cu.start_$cudom\_$cuname\_ca.value,'start_$cudom\_$cuname\_ca','cu.pres','dateset')">$lt{'ssd'}</a></td>
 <td><input type=hidden name="end_$cudom\_$cuname\_ca" value=''>  <td><input type=hidden name="end_$cudom\_$cuname\_ca" value='' />
 <a href=  <a href=
 "javascript:pjump('date_end','End Date Co-Author',document.cu.end_$cudom\_$cuname\_ca.value,'end_$cudom\_$cuname\_ca','cu.pres','dateset')">$lt{'sed'}</a></td>  "javascript:pjump('date_end','End Date Co-Author',document.cu.end_$cudom\_$cuname\_ca.value,'end_$cudom\_$cuname\_ca','cu.pres','dateset')">$lt{'sed'}</a></td>
 </tr>  </tr>
Line 760  ENDNEWUSERHEAD Line 801  ENDNEWUSERHEAD
              $ENV{'form.cmiddle'},$ENV{'form.clast'},$ENV{'form.cgen'},               $ENV{'form.cmiddle'},$ENV{'form.clast'},$ENV{'form.cgen'},
              undef,$desiredhost               undef,$desiredhost
      );       );
  $r->print('Generating user: '.$result);   $r->print(&mt('Generating user').': '.$result);
         my $home = &Apache::lonnet::homeserver($ENV{'form.ccuname'},          my $home = &Apache::lonnet::homeserver($ENV{'form.ccuname'},
                                                $ENV{'form.ccdomain'});                                                 $ENV{'form.ccdomain'});
         $r->print('<br />'&mt('Home server').': '.$home.' '.          $r->print('<br />'.&mt('Home server').': '.$home.' '.
                   $Apache::lonnet::libserv{$home});                    $Apache::lonnet::libserv{$home});
     } elsif (($ENV{'form.login'} ne 'nochange') &&      } elsif (($ENV{'form.login'} ne 'nochange') &&
              ($ENV{'form.login'} ne ''        )) {               ($ENV{'form.login'} ne ''        )) {
Line 923  END Line 964  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+)_([^\_]+)$/) {
Line 1235  sub course_level_table { Line 1297  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 1242  sub course_level_table { Line 1305  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.76  
changed lines
  Added in v.1.82


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