[LON-CAPA-cvs] cvs: loncom(version_2_7_X) /interface loncreateuser.pm
raeburn
lon-capa-cvs-allow@mail.lon-capa.org
Fri, 18 Jul 2008 02:15:33 -0000
raeburn Thu Jul 17 22:15:33 2008 EDT
Modified files: (Branch: version_2_7_X)
/loncom/interface loncreateuser.pm
Log:
- backport 1.27, 1.258
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.249.2.4 loncom/interface/loncreateuser.pm:1.249.2.5
--- loncom/interface/loncreateuser.pm:1.249.2.4 Wed Jul 16 08:32:11 2008
+++ loncom/interface/loncreateuser.pm Thu Jul 17 22:15:32 2008
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.249.2.4 2008/07/16 12:32:11 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.249.2.5 2008/07/18 02:15:32 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1397,30 +1397,22 @@
sub personal_data_display {
my ($ccuname,$ccdomain,$newuser,$context,$inst_results,$rolesarray) = @_;
- my ($output,$showforceid,%userenv,%canmodify,@inststatuses);
+ my ($output,$showforceid,%userenv,%canmodify);
my @userinfo = ('firstname','middlename','lastname','generation',
'permanentemail','id');
my $rowcount = 0;
my $editable = 0;
- if ($context eq 'selfcreate') {
- if (ref($inst_results) eq 'HASH') {
- @inststatuses = &get_inststatuses($inst_results);
- if (@inststatuses == 0) {
- @inststatuses = ('default');
- }
- $rolesarray = \@inststatuses;
- }
- }
if (!$newuser) {
# Get the users information
%userenv = &Apache::lonnet::get('environment',
['firstname','middlename','lastname','generation',
'permanentemail','id'],$ccdomain,$ccuname);
- }
- if ((!$newuser) || ($context eq 'selfcreate')) {
%canmodify =
&Apache::lonuserutils::can_modify_userinfo($context,$ccdomain,
\@userinfo,$rolesarray);
+ } elsif ($context eq 'selfcreate') {
+ %canmodify = &selfcreate_canmodify($context,$ccdomain,\@userinfo,
+ $inst_results,$rolesarray);
}
my %lt=&Apache::lonlocal::texthash(
'pd' => "Personal Data",
@@ -1506,6 +1498,21 @@
}
}
+sub selfcreate_canmodify {
+ my ($context,$dom,$userinfo,$inst_results,$rolesarray) = @_;
+ if (ref($inst_results) eq 'HASH') {
+ my @inststatuses = &get_inststatuses($inst_results);
+ if (@inststatuses == 0) {
+ @inststatuses = ('default');
+ }
+ $rolesarray = \@inststatuses;
+ }
+ my %canmodify =
+ &Apache::lonuserutils::can_modify_userinfo($context,$dom,$userinfo,
+ $rolesarray);
+ return %canmodify;
+}
+
sub get_inststatuses {
my ($insthashref) = @_;
my @inststatuses = ();
@@ -3738,13 +3745,14 @@
$output .= '</tr><tr>';
}
if (defined($usertypes->{$type})) {
+ my $esc_type = &escape($type);
$output .= '<td><span class="LC_nobreak"><label><input type = "checkbox" value="'.
- $type.'" ';
+ $esc_type.'" ';
if (ref($currinsttypes) eq 'ARRAY') {
if (@{$currinsttypes} > 0) {
if (grep(/^any$/,@{$currinsttypes})) {
$output .= 'checked="checked"';
- } elsif (grep(/^\Q$type\E$/,@{$currinsttypes})) {
+ } elsif (grep(/^\Q$esc_type\E$/,@{$currinsttypes})) {
$output .= 'checked="checked"';
}
} else {
@@ -4734,8 +4742,9 @@
my $othervalue = 'any';
if ((ref($types) eq 'ARRAY') && (ref($usertypes) eq 'HASH')) {
if (@{$types} > 0) {
+ my @esc_types = map { &escape($_); } @{$types};
$othervalue = 'other';
- $typestr = join(',',(@{$types},$othervalue));
+ $typestr = join(',',(@esc_types,$othervalue));
}
$typestr = $othervalue;
} else {