[LON-CAPA-cvs] cvs: loncom /interface loncreateuser.pm

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 15 Apr 2004 22:35:52 -0000


albertel		Thu Apr 15 18:35:52 2004 EDT

  Modified files:              
    /loncom/interface	loncreateuser.pm 
  Log:
  - BUG#2550, Re-Enable check box on CUSR form
  
  
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.80 loncom/interface/loncreateuser.pm:1.81
--- loncom/interface/loncreateuser.pm:1.80	Thu Mar  4 21:14:34 2004
+++ loncom/interface/loncreateuser.pm	Thu Apr 15 18:35:51 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.80 2004/03/05 02:14:34 www Exp $
+# $Id: loncreateuser.pm,v 1.81 2004/04/15 22:35:51 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -345,6 +345,7 @@
 		    'rer'  => "Revoke Existing Roles",
                     'rev'  => "Revoke",                    
                     'del'  => "Delete",
+		    'ren'  => "Re-Enable",
                     'rol'  => "Role",
                     'ext'  => "Extent",
                     'sta'  => "Start",
@@ -354,7 +355,7 @@
 <hr />
 <h3>$lt{'rer'}</h3>
 <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
            my (%roletext,%sortrole,%roleclass);
 	   foreach my $area (sort { my $a1=join('_',(split('_',$a))[1,0]);
@@ -466,6 +467,12 @@
 		   }
                }
 	       $row.='</td><td>';
+               if ($allowed && !$active) {
+                   $row.= '<input type="checkbox" name="ren:'.$thisrole.'">';
+               } else {
+                   $row.='&nbsp;';
+               }
+	       $row.='</td><td>';
                if ($delallowed) {
                    $row.= '<input type="checkbox" name="del:'.$thisrole.'">';
                } else {
@@ -955,6 +962,27 @@
                              $ENV{'form.ccdomain'}).'='.
                          &Apache::lonnet::escape($now.':'),
 	                     $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/) {