--- loncom/interface/loncreateuser.pm 2007/06/11 19:41:35 1.153
+++ loncom/interface/loncreateuser.pm 2007/06/11 22:13:07 1.154
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.153 2007/06/11 19:41:35 banghart Exp $
+# $Id: loncreateuser.pm,v 1.154 2007/06/11 22:13:07 banghart Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1664,10 +1664,14 @@ sub custom_role_editor {
}
$full{$priv}=1;
}
-
+ my $button_code = "\n";
my $head_script = "\n";
$head_script .= ''."\n";
$r->print(&Apache::loncommon::start_page('Custom Role Editor',$head_script));
$r->print($body_top);
@@ -1677,7 +1681,9 @@ sub custom_role_editor {
'dml' => "Domain Level",
'ssl' => "System Level");
$r->print('Select a Template
');
- $r->print('
');
+ $r->print('');
$r->print(<
@@ -1704,7 +1710,7 @@ ENDCCF
&Apache::loncommon::end_data_table_row());
}
$r->print(&Apache::loncommon::end_data_table().
- ''.
+ ''.
&Apache::loncommon::end_page());
}
# --------------------------------------------------------
@@ -1722,7 +1728,7 @@ sub make_script_template {
my ($priv,$restrict)=split(/\&/,$item);
$full_d{$priv}=1;
}
- foreach my $item (split(/\:/,$Apache::lonnet::pr{'cr:d'})) {
+ foreach my $item (split(/\:/,$Apache::lonnet::pr{'cr:s'})) {
my ($priv,$restrict)=split(/\&/,$item);
$full_s{$priv}=1;
}
@@ -1741,16 +1747,44 @@ sub make_script_template {
$return_script .= "document.form1.$priv"."_c.checked = false;\n";
}
}
- my @role_d = split(/:/,$Apache::lonnet::pr{$role.':d'});
- foreach my $priv_item (@role_d) {
+ my %role_d;
+ @temp = split(/:/,$Apache::lonnet::pr{$role.':d'});
+ foreach my $priv(@temp) {
+ my ($priv_item, $dummy) = split(/\&/,$priv);
+ $role_d{$priv_item} = 1;
+ }
+ foreach my $priv_item (keys(%full_d)) {
my ($priv, $dummy) = split(/\&/,$priv_item);
- $return_script .= "document.form1.$priv"."_d.checked = true;\n";
+ if (exists($role_d{$priv})) {
+ $return_script .= "document.form1.$priv"."_d.checked = true;\n";
+ } else {
+ $return_script .= "document.form1.$priv"."_d.checked = false;\n";
+ }
+ }
+ my %role_s;
+ @temp = split(/:/,$Apache::lonnet::pr{$role.':s'});
+ foreach my $priv(@temp) {
+ my ($priv_item, $dummy) = split(/\&/,$priv);
+ $role_s{$priv_item} = 1;
+ }
+ foreach my $priv_item (keys(%full_s)) {
+ my ($priv, $dummy) = split(/\&/,$priv_item);
+ if (exists($role_s{$priv})) {
+ $return_script .= "document.form1.$priv"."_s.checked = true;\n";
+ } else {
+ $return_script .= "document.form1.$priv"."_s.checked = false;\n";
+ }
}
-
$return_script .= '}'."\n";
- return $return_script;
+ return ($return_script);
+}
+# ----------------------------------------------------------
+sub make_button_code {
+ my ($role) = @_;
+ my $label = &Apache::lonnet::plaintext($role);
+ my $button_code = '';
+ return ($button_code);
}
-
# ---------------------------------------------------------- Call to definerole
sub set_custom_role {
my ($r) = @_;