--- loncom/interface/loncreateuser.pm	2005/04/07 06:56:23	1.101
+++ loncom/interface/loncreateuser.pm	2005/06/19 00:41:32	1.105
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.101 2005/04/07 06:56:23 albertel Exp $
+# $Id: loncreateuser.pm,v 1.105 2005/06/19 00:41:32 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -108,10 +108,8 @@ sub my_custom_roles {
 
 sub authorpriv {
     my ($auname,$audom)=@_;
-    if (($auname ne $env{'user.name'}) ||
-        (($audom ne $env{'user.domain'}) &&
-         ($audom ne $env{'request.role.domain'}))) { return ''; }
-    unless (&Apache::lonnet::allowed('cca',$audom)) { return ''; }
+    unless ((&Apache::lonnet::allowed('cca',$audom.'/'.$auname))
+         || (&Apache::lonnet::allowed('caa',$audom.'/'.$auname))) { return ''; }
     return 1;
 }
 
@@ -544,7 +542,7 @@ END
                    $bgcol=~s/[^7-9a-e]//g;
                    $bgcol=substr($bgcol.$bgcol.$bgcol.'ffffff',2,6);
                    if ($area=~/^\/(\w+)\/(\d\w+)\/(\w+)/) {
-                       $carea.='<br>Section/Group: '.$3;
+                       $carea.='<br />Section/Group: '.$3;
 		       $sortkey.="\0$3";
                    }
                    $area=$carea;
@@ -574,7 +572,7 @@ END
 		       $class='Domain';
 		   }
                }
-               if ($role_code eq 'ca') {
+               if (($role_code eq 'ca') || ($role_code eq 'aa')) {
                    $area=~/\/(\w+)\/(\w+)/;
 		   if (&authorpriv($2,$1)) {
 		       $allowed=1;
@@ -778,6 +776,7 @@ ENDOTHERAUTHS
                     'sta'  => "Start",
                     'end'  => "End",
                     'cau'  => "Co-Author",
+                    'caa'  => "Assistant Co-Author",
                     'ssd'  => "Set Start Date",
                     'sed'  => "Set End Date"
 				       );
@@ -796,6 +795,17 @@ ENDOTHERAUTHS
 <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>
 </tr>
+<tr>
+<td><input type=checkbox name="act_$cudom\_$cuname\_aa" /></td>
+<td>$lt{'caa'}</td>
+<td>$cudom\_$cuname</td>
+<td><input type=hidden name="start_$cudom\_$cuname\_aa" value='' />
+<a href=
+"javascript:pjump('date_start','Start Date Assistant Co-Author',document.cu.start_$cudom\_$cuname\_aa.value,'start_$cudom\_$cuname\_aa','cu.pres','dateset')">$lt{'ssd'}</a></td>
+<td><input type=hidden name="end_$cudom\_$cuname\_aa" value='' />
+<a href=
+"javascript:pjump('date_end','End Date Assistant Co-Author',document.cu.end_$cudom\_$cuname\_aa.value,'end_$cudom\_$cuname\_aa','cu.pres','dateset')">$lt{'sed'}</a></td>
+</tr>
 </table>
 ENDCOAUTH
     }
@@ -990,7 +1000,7 @@ ENDMODIFYUSERHEAD
                       &Apache::lonnet::modifyuserauth(
 		       $env{'form.ccdomain'},$env{'form.ccuname'},
                        $amode,$genpwd));
-            $r->print('<br>'.&mt('Home server').': '.&Apache::lonnet::homeserver
+            $r->print('<br />'.&mt('Home server').': '.&Apache::lonnet::homeserver
 		  ($env{'form.ccuname'},$env{'form.ccdomain'}));
 	} else {
 	    # Okay, this is a non-fatal error.
@@ -1088,7 +1098,7 @@ END
 # Revoke standard role
 	        $r->print(&mt('Revoking').' '.$2.' in '.$1.': <b>'.
                      &Apache::lonnet::revokerole($env{'form.ccdomain'},
-                     $env{'form.ccuname'},$1,$2).'</b><br>');
+                     $env{'form.ccuname'},$1,$2).'</b><br />');
 		if ($2 eq 'st') {
 		    $1=~/^\/(\w+)\/(\w+)/;
 		    my $cid=$1.'_'.$2;
@@ -1099,7 +1109,7 @@ END
                          &Apache::lonnet::escape($env{'form.ccuname'}.':'.
                              $env{'form.ccdomain'}).'='.
                          &Apache::lonnet::escape($now.':'),
-	                     $env{'course.'.$cid.'.home'}).'</b><br>');
+	                     $env{'course.'.$cid.'.home'}).'</b><br />');
 		}
 	    } 
 	    if ($_=~/^form\.rev\:([^\_]+)\_cr\.cr\/(\w+)\/(\w+)\/(\w+)$/) {
@@ -1108,13 +1118,13 @@ END
                       ' '.$4.' by '.$3.'@'.$2.' in '.$1.': <b>'.
                       &Apache::lonnet::revokecustomrole($env{'form.ccdomain'},
 				  $env{'form.ccuname'},$1,$2,$3,$4).
-		'</b><br>');
+		'</b><br />');
 	    }
 	} elsif ($_=~/^form\.del/) {
 	    if ($_=~/^form\.del\:([^\_]+)\_([^\_]+)$/) {
 	        $r->print(&mt('Deleting').' '.$2.' in '.$1.': '.
                      &Apache::lonnet::assignrole($env{'form.ccdomain'},
-                     $env{'form.ccuname'},$1,$2,$now,0,1).'<br>');
+                     $env{'form.ccuname'},$1,$2,$now,0,1).'<br />');
 		if ($2 eq 'st') {
 		    $1=~/^\/(\w+)\/(\w+)/;
 		    my $cid=$1.'_'.$2;
@@ -1125,7 +1135,7 @@ END
                          &Apache::lonnet::escape($env{'form.ccuname'}.':'.
                              $env{'form.ccdomain'}).'='.
                          &Apache::lonnet::escape($now.':'),
-	                     $env{'course.'.$cid.'.home'}).'</b><br>');
+	                     $env{'course.'.$cid.'.home'}).'</b><br />');
 		}
 	    } 
 	} elsif ($_=~/^form\.ren/) {
@@ -1245,12 +1255,13 @@ END
                     }
                 }
 	    } else {
-		$r->print('<p>'.&mt('ERROR').': '.&mt('Unknown command').' <tt>'.$_.'</tt></p><br>');
+		$r->print('<p>'.&mt('ERROR').': '.&mt('Unknown command').' <tt>'.$_.'</tt></p><br />');
             }
 	} 
     } # End of foreach (keys(%env))
 # Flush the course logs so reverse user roles immediately updated
     &Apache::lonnet::flushcourselogs();
+    $r->print('<p><a href="/adm/createuser">Create/Modify Another User</a></p>');
     $r->print('</body></html>');
 }
 
@@ -1261,7 +1272,7 @@ sub commit_customrole {
                          ($end?', ending '.localtime($end):'').': <b>'.
               &Apache::lonnet::assigncustomrole(
                  $udom,$uname,$url,$three,$four,$five,$end,$start).
-                 '</b><br>';
+                 '</b><br />';
     return $output;
 }
 
@@ -1286,7 +1297,7 @@ sub commit_standardrole {
                ($end?', '.&mt('ending').' '.localtime($end):'').': <b>'.
                &Apache::lonnet::assignrole(
                    $udom,$uname,$url,$three,$end,$start).
-                   '</b><br>';
+                   '</b><br />';
     }
     return $output;
 }
@@ -1552,7 +1563,7 @@ sub handler {
         (&Apache::lonnet::allowed('cin',$env{'request.course.id'})) || 
         (&Apache::lonnet::allowed('ccr',$env{'request.course.id'})) || 
         (&Apache::lonnet::allowed('cep',$env{'request.course.id'})) ||
-        (&Apache::lonnet::allowed('cca',$env{'request.role.domain'})) ||
+	(&authorpriv($env{'user.name'},$env{'request.role.domain'})) ||
         (&Apache::lonnet::allowed('mau',$env{'request.role.domain'}))) {
        &Apache::loncommon::content_type($r,'text/html');
        $r->send_http_header;