[LON-CAPA-cvs] cvs: loncom /interface loncreateuser.pm
banghart
lon-capa-cvs-allow@mail.lon-capa.org
Thu, 07 Jun 2007 22:23:13 -0000
banghart Thu Jun 7 18:23:13 2007 EDT
Modified files:
/loncom/interface loncreateuser.pm
Log:
Saving work in progress.
Rewrite a bunch of unless as if !.
Rename checkboxes to be javascript friendly.
Debug stuff is present.
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.149 loncom/interface/loncreateuser.pm:1.150
--- loncom/interface/loncreateuser.pm:1.149 Tue May 29 13:48:44 2007
+++ loncom/interface/loncreateuser.pm Thu Jun 7 18:23:11 2007
@@ -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 @@
$row.=' ';
}
my $plaintext='';
- unless ($croletitle) {
+ if (!$croletitle) {
$plaintext=&Apache::lonnet::plaintext($role_code,$class)
} else {
$plaintext=
@@ -1574,7 +1574,7 @@
} 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 @@
$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 = <<END_SCRIPT;
+ <script type="text/javascript">
+ function setchecks() {
+ document.form1.bre_c.checked = false;
+ }
+ </script>
+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 @@
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 @@
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 @@
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 @@
'prv' => "Privilege",
'crl' => "Course Level",
'dml' => "Domain Level",
- 'ssl' => "System Level"
- );
+ 'ssl' => "System Level");
+ $r->print('<form action=""><input type="button" onClick="setchecks()" value="Click" /></form>');
$r->print(<<ENDCCF);
-<form method="post">
+<form name=form1 method="post">
<input type="hidden" name="phase" value="set_custom_roles" />
<input type="hidden" name="rolename" value="$rolename" />
ENDCCF
@@ -1684,13 +1698,13 @@
my $privtext = &Apache::lonnet::plaintext($priv);
$r->print(&Apache::loncommon::start_data_table_row().
'<td>'.$privtext.'</td><td>'.
- ($courselevel{$priv}?'<input type="checkbox" name="'.$priv.':c" '.
+ ($courselevel{$priv}?'<input type="checkbox" name="'.$priv.'_c" '.
($courselevelcurrent{$priv}?'checked="1"':'').' />':' ').
'</td><td>'.
- ($domainlevel{$priv}?'<input type="checkbox" name="'.$priv.':d" '.
+ ($domainlevel{$priv}?'<input type="checkbox" name="'.$priv.'_d" '.
($domainlevelcurrent{$priv}?'checked="1"':'').' />':' ').
'</td><td>'.
- ($systemlevel{$priv}?'<input type="checkbox" name="'.$priv.':s" '.
+ ($systemlevel{$priv}?'<input type="checkbox" name="'.$priv.'_s" '.
($systemlevelcurrent{$priv}?'checked="1"':'').' />':' ').
'</td>'.
&Apache::loncommon::end_data_table_row());
@@ -1708,7 +1722,7 @@
$rolename=~s/[^A-Za-z0-9]//gs;
- unless ($rolename) {
+ if (!$rolename) {
&print_username_entry_form($r);
return;
}
@@ -1732,24 +1746,24 @@
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 @@
(&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') {