--- loncom/interface/loncreateuser.pm 2007/05/29 17:48:44 1.149 +++ loncom/interface/loncreateuser.pm 2007/06/07 22:23:11 1.150 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.149 2007/05/29 17:48:44 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.150 2007/06/07 22:23:11 banghart Exp $ # # Copyright Michigan State University Board of Trustees # @@ -751,7 +751,7 @@ END $row.=' '; } my $plaintext=''; - unless ($croletitle) { + if (!$croletitle) { $plaintext=&Apache::lonnet::plaintext($role_code,$class) } else { $plaintext= @@ -1574,7 +1574,7 @@ sub build_roles { } else { foreach my $sec (@secnums) { $sec =~ ~s/\W//g; - unless ($sec eq "") { + if (!($sec eq "")) { if (exists($$sections{$sec})) { $$sections{$sec} ++; } else { @@ -1607,15 +1607,23 @@ sub custom_role_editor { $rolename=~s/[^A-Za-z0-9]//gs; - unless ($rolename) { + if (!$rolename) { &print_username_entry_form($r); return; } - - $r->print(&Apache::loncommon::start_page('Custom Role Editor')); + my $head_script = < + function setchecks() { + document.form1.bre_c.checked = false; + } + +END_SCRIPT + + $r->print(&Apache::loncommon::start_page('Custom Role Editor',$head_script)); my $syspriv=''; my $dompriv=''; my $coursepriv=''; + my ($disp_dummy,$disp_roles) = &Apache::lonnet::get('roles',["st"]); my ($rdummy,$roledef)= &Apache::lonnet::get('roles',["rolesdef_$rolename"]); # ------------------------------------------------------- Does this role exist? @@ -1633,9 +1641,15 @@ sub custom_role_editor { my %full=(); my %courselevel=(); my %courselevelcurrent=(); + my @roles = ("st:c","st:d"); + foreach my $item (@roles) { + &Apache::lonnet::logthis(" roles for $item: ".$Apache::lonnet::pr{$item}); + } + foreach my $item (split(/\:/,$Apache::lonnet::pr{'cr:c'})) { + my ($priv,$restrict)=split(/\&/,$item); - unless ($restrict) { $restrict='F'; } + if (!$restrict) { $restrict='F'; } $courselevel{$priv}=$restrict; if ($coursepriv=~/\:$priv/) { $courselevelcurrent{$priv}=1; @@ -1646,7 +1660,7 @@ sub custom_role_editor { my %domainlevelcurrent=(); foreach my $item (split(/\:/,$Apache::lonnet::pr{'cr:d'})) { my ($priv,$restrict)=split(/\&/,$item); - unless ($restrict) { $restrict='F'; } + if (!$restrict) { $restrict='F'; } $domainlevel{$priv}=$restrict; if ($dompriv=~/\:$priv/) { $domainlevelcurrent{$priv}=1; @@ -1657,7 +1671,7 @@ sub custom_role_editor { my %systemlevelcurrent=(); foreach my $item (split(/\:/,$Apache::lonnet::pr{'cr:s'})) { my ($priv,$restrict)=split(/\&/,$item); - unless ($restrict) { $restrict='F'; } + if (!$restrict) { $restrict='F'; } $systemlevel{$priv}=$restrict; if ($syspriv=~/\:$priv/) { $systemlevelcurrent{$priv}=1; @@ -1668,10 +1682,10 @@ sub custom_role_editor { 'prv' => "Privilege", 'crl' => "Course Level", 'dml' => "Domain Level", - 'ssl' => "System Level" - ); + 'ssl' => "System Level"); + $r->print('
'); $r->print(< +
ENDCCF @@ -1684,13 +1698,13 @@ ENDCCF my $privtext = &Apache::lonnet::plaintext($priv); $r->print(&Apache::loncommon::start_data_table_row(). ''.$privtext.''. - ($courselevel{$priv}?'':' '). ''. - ($domainlevel{$priv}?'':' '). ''. - ($systemlevel{$priv}?'':' '). ''. &Apache::loncommon::end_data_table_row()); @@ -1708,7 +1722,7 @@ sub set_custom_role { $rolename=~s/[^A-Za-z0-9]//gs; - unless ($rolename) { + if (!$rolename) { &print_username_entry_form($r); return; } @@ -1732,24 +1746,24 @@ sub set_custom_role { foreach my $item (split(/\:/,$Apache::lonnet::pr{'cr:c'})) { my ($priv,$restrict)=split(/\&/,$item); - unless ($restrict) { $restrict=''; } - if ($env{'form.'.$priv.':c'}) { + if (!$restrict) { $restrict=''; } + if ($env{'form.'.$priv.'_c'}) { $courole.=':'.$item; } } foreach my $item (split(/\:/,$Apache::lonnet::pr{'cr:d'})) { my ($priv,$restrict)=split(/\&/,$item); - unless ($restrict) { $restrict=''; } - if ($env{'form.'.$priv.':d'}) { + if (!$restrict) { $restrict=''; } + if ($env{'form.'.$priv.'_d'}) { $domrole.=':'.$item; } } foreach my $item (split(/\:/,$Apache::lonnet::pr{'cr:s'})) { my ($priv,$restrict)=split(/\&/,$item); - unless ($restrict) { $restrict=''; } - if ($env{'form.'.$priv.':s'}) { + if (!$restrict) { $restrict=''; } + if ($env{'form.'.$priv.'_s'}) { $sysrole.=':'.$item; } } @@ -1788,7 +1802,7 @@ sub handler { (&Apache::lonnet::allowed('mau',$env{'request.role.domain'}))) { &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; - unless ($env{'form.phase'}) { + if (!$env{'form.phase'}) { &print_username_entry_form($r); } if ($env{'form.phase'} eq 'get_user_info') {