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

www lon-capa-cvs@mail.lon-capa.org
Thu, 17 Jul 2003 18:14:41 -0000


www		Thu Jul 17 14:14:41 2003 EDT

  Modified files:              
    /loncom/interface	loncreateuser.pm 
  Log:
  Start work on bug #795: custom role editor
  
  
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.57 loncom/interface/loncreateuser.pm:1.58
--- loncom/interface/loncreateuser.pm:1.57	Thu Jul 17 14:10:53 2003
+++ loncom/interface/loncreateuser.pm	Thu Jul 17 14:14:41 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.57 2003/07/17 18:10:53 matthew Exp $
+# $Id: loncreateuser.pm,v 1.58 2003/07/17 18:14:41 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -46,7 +46,7 @@
 # 05/10,10/16 Gerd Kortemeyer 
 # 02/11/02 Matthew Hall
 #
-# $Id: loncreateuser.pm,v 1.57 2003/07/17 18:10:53 matthew Exp $
+# $Id: loncreateuser.pm,v 1.58 2003/07/17 18:14:41 www Exp $
 ###
 
 package Apache::loncreateuser;
@@ -116,15 +116,19 @@
 $bodytag
 <form action="/adm/createuser" method="post" name="crtuser">
 <input type="hidden" name="phase" value="get_user_info">
-<p>
+<h2>Set Individual User Roles</h2>
 <table>
 <tr><td>Username:</td><td><input type="text" size="15" name="ccuname">
 </td><td rowspan="2">$sellink</td></tr><tr><td>
 Domain:</td><td>$domform</td></tr>
-</table> 
-</p>
-<input type="submit" value="Continue">
+</table>
+<input name="userrole" type="submit" value="User Roles" />
 </form>
+<form action="/adm/createuser" method="post" name="docustom">
+<input type="hidden" name="phase" value="selected_custom_edit">
+<h2>Edit Custom Role Privileges</h2>
+Name of Role: <input type="text" size="15" name="rolename" /><br />
+<input name="customeditor" type="submit" value="Custom Role Editor" />
 </body>
 </html>
 ENDDOCUMENT
@@ -136,6 +140,14 @@
     my $ccuname=$ENV{'form.ccuname'};
     my $ccdomain=$ENV{'form.ccdomain'};
 
+    $ccuname=~s/\W//gs;
+    $ccdomain=~s/\W//gs;
+
+    unless (($ccuname) && ($ccdomain)) {
+	&print_username_entry_form($r);
+        return;
+    }
+
     my $defdom=$ENV{'request.role.domain'};
 
     my ($krbdef,$krbdefdom) =
@@ -827,6 +839,24 @@
     $r->print('</body></html>');
 }
 
+# ========================================================== Custom Role Editor
+
+sub custom_role_editor {
+    my $r=shift;
+    my $rolename=$ENV{'form.rolename'};
+
+    $rolename=~s/\W//gs;
+
+    unless ($rolename) {
+	&print_username_entry_form($r);
+        return;
+    }
+
+    $r->print(&Apache::loncommon::bodytag(
+                                     'Create Users, Change User Privileges'));
+   $r->print('Not yet implemented.');
+}
+
 # ================================================================ Main Handler
 sub handler {
     my $r = shift;
@@ -852,6 +882,8 @@
            &print_user_modification_page($r);
        } elsif ($ENV{'form.phase'} eq 'update_user_data') {
            &update_user_data($r);
+       } elsif ($ENV{'form.phase'} eq 'selected_custom_edit') {
+           &custom_role_editor($r);
        }
    } else {
       $ENV{'user.error.msg'}=