version 1.58, 2003/07/17 18:14:41
|
version 1.59, 2003/07/17 19:40:39
|
Line 83 BEGIN {
|
Line 83 BEGIN {
|
} |
} |
|
|
|
|
|
# ======================================================= Existing Custom Roles |
|
|
|
sub my_custom_roles { |
|
my %returnhash=(); |
|
my %rolehash=&Apache::lonnet::dump('roles'); |
|
foreach (keys %rolehash) { |
|
if ($_=~/^rolesdef\_(\w+)$/) { |
|
$returnhash{$_}=$_; |
|
} |
|
} |
|
return %returnhash; |
|
} |
|
|
# ==================================================== Figure out author access |
# ==================================================== Figure out author access |
|
|
Line 107 sub print_username_entry_form {
|
Line 119 sub print_username_entry_form {
|
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'); |
|
my %existingroles=&my_custom_roles(); |
|
my $choice=&Apache::loncommon::select_form('make new role','rolename', |
|
('make new role' => 'Generate new role ...',%existingroles)); |
$r->print(<<"ENDDOCUMENT"); |
$r->print(<<"ENDDOCUMENT"); |
<html> |
<html> |
<head> |
<head> |
Line 127 Domain:</td><td>$domform</td></tr>
|
Line 142 Domain:</td><td>$domform</td></tr>
|
<form action="/adm/createuser" method="post" name="docustom"> |
<form action="/adm/createuser" method="post" name="docustom"> |
<input type="hidden" name="phase" value="selected_custom_edit"> |
<input type="hidden" name="phase" value="selected_custom_edit"> |
<h2>Edit Custom Role Privileges</h2> |
<h2>Edit Custom Role Privileges</h2> |
Name of Role: <input type="text" size="15" name="rolename" /><br /> |
Name of Role: $choice <input type="text" size="15" name="newrolename" /><br /> |
<input name="customeditor" type="submit" value="Custom Role Editor" /> |
<input name="customeditor" type="submit" value="Custom Role Editor" /> |
</body> |
</body> |
</html> |
</html> |
Line 845 sub custom_role_editor {
|
Line 860 sub custom_role_editor {
|
my $r=shift; |
my $r=shift; |
my $rolename=$ENV{'form.rolename'}; |
my $rolename=$ENV{'form.rolename'}; |
|
|
|
if ($rolename eq 'make new role') { |
|
$rolename=$ENV{'form.newrolename'}; |
|
} |
|
|
$rolename=~s/\W//gs; |
$rolename=~s/\W//gs; |
|
|
unless ($rolename) { |
unless ($rolename) { |
Line 853 sub custom_role_editor {
|
Line 872 sub custom_role_editor {
|
} |
} |
|
|
$r->print(&Apache::loncommon::bodytag( |
$r->print(&Apache::loncommon::bodytag( |
'Create Users, Change User Privileges')); |
'Create Users, Change User Privileges').'<h2>'); |
$r->print('Not yet implemented.'); |
my ($rdummy,$roledef)= |
|
&Apache::lonnet::get('roles',["rolesdef_$rolename"]); |
|
if (($rdummy ne 'con_lost') && ($roledef ne '')) { |
|
$r->print('Existing Role "'); |
|
} else { |
|
$r->print('New Role "'); |
|
$roledef=''; |
|
} |
|
$r->print($rolename.'"</h2>'); |
|
$r->print('Not yet implemented.'); |
} |
} |
|
|
# ================================================================ Main Handler |
# ================================================================ Main Handler |