[LON-CAPA-cvs] cvs: loncom(version_2_9_X) /interface loncreateuser.pm
raeburn
raeburn@source.lon-capa.org
Thu, 10 Sep 2009 23:14:29 -0000
This is a MIME encoded message
--raeburn1252624469
Content-Type: text/plain
raeburn Thu Sep 10 23:14:29 2009 EDT
Modified files: (Branch: version_2_9_X)
/loncom/interface loncreateuser.pm
Log:
- Backport 1.314.
--raeburn1252624469
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20090910231429.txt"
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.295.2.13 loncom/interface/loncreateuser.pm:1.295.2.14
--- loncom/interface/loncreateuser.pm:1.295.2.13 Mon Sep 7 13:23:23 2009
+++ loncom/interface/loncreateuser.pm Thu Sep 10 23:14:29 2009
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.295.2.13 2009/09/07 13:23:23 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.295.2.14 2009/09/10 23:14:29 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -229,7 +229,7 @@
'usde' => "Use default",
'uscu' => "Use custom",
'official' => 'Can request creation of official courses',
- 'unofficial' => 'Can request creation of unofficial courses',
+ 'unofficial' => 'Can request creation of unofficial courses',
);
if ($context eq 'requestcourses') {
%userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,
@@ -292,7 +292,11 @@
}
if ($curroption =~ /^autolimit=(\d*)$/) {
$currlimit = $1;
- $currdisp = &mt('Yes, up to [quant,_1,request]/user',$currlimit);
+ if ($currlimit eq '') {
+ $currdisp = &mt('Yes, automatic creation');
+ } else {
+ $currdisp = &mt('Yes, up to [quant,_1,request]/user',$currlimit);
+ }
} else {
$currdisp = $reqdisplay{$curroption};
}
@@ -326,9 +330,12 @@
if ($option eq 'autolimit') {
$custdisp .= '<input type="text" name="crsreq_'.
$item.'_limit" size="1" '.
- 'value="'.$currlimit.'" />';
+ 'value="'.$currlimit.'" /></span><br />'.
+ $reqtitles{'unlimited'};
+ } else {
+ $custdisp .= '</span>';
}
- $custdisp .= '</span></td></tr>';
+ $custdisp .= '</td></tr>';
}
$custdisp .= '</table>';
$custradio = '</span></td><td>'.&mt('Custom setting').'<br />'.$custdisp;
@@ -378,22 +385,27 @@
my ($curroption,$currlimit,$tooloff);
if ($userenv{'reqcrsotherdom.'.$item} ne '') {
my @curr = split(',',$userenv{'reqcrsotherdom.'.$item});
- if (grep(/^\Q$cdom\E:($optregex)=?(\d*)$/,@curr)) {
- $curroption = $1;
- $currlimit = $2;
- if (!$curroption) {
- $curroption = 'norequest';
+ foreach my $req (@curr) {
+ if ($req =~ /^\Q$cdom\E\:($optregex)=?(\d*)$/) {
+ $curroption = $1;
+ $currlimit = $2;
+ last;
}
}
+ if (!$curroption) {
+ $curroption = 'norequest';
+ $tooloff = ' checked="checked"';
+ }
} else {
$curroption = 'norequest';
$tooloff = ' checked="checked"';
}
$output.= &Apache::loncommon::start_data_table_row()."\n".
- ' <td><span class="LC_nobreak">'.$lt{$item}.': '.
+ ' <td><span class="LC_nobreak">'.$lt{$item}.': </span></td><td>'.
+ '<table><tr><td valign="top">'."\n".
'<label><input type="radio" name="reqcrsotherdom_'.$item.
- '" value="0"'.$tooloff.' />'.$reqtitles{'norequest'}.
- '</label> ';
+ '" value=""'.$tooloff.' />'.$reqtitles{'norequest'}.
+ '</label></td>';
foreach my $option (@options) {
if ($option eq 'validate') {
my $canvalidate = 0;
@@ -408,18 +420,21 @@
if ($option eq $curroption) {
$checked = ' checked="checked"';
}
- $output .= '<span class="LC_nobreak"><label>'.
+ $output .= '<td valign="top"><span class="LC_nobreak"><label>'.
'<input type="radio" name="reqcrsotherdom_'.$item.
'" value="'.$option.'"'.$checked.' />'.
- $reqtitles{$option}.'</label> ';
+ $reqtitles{$option}.'</label>';
if ($option eq 'autolimit') {
- $output .= '<input type="text" name="reqcrsotherdom_'.
+ $output .= ' <input type="text" name="reqcrsotherdom_'.
$item.'_limit" size="1" '.
- 'value="'.$currlimit.'" />';
+ 'value="'.$currlimit.'" /></span>'.
+ '<br />'.$reqtitles{'unlimited'};
+ } else {
+ $output .= '</span>';
}
- $output .= ' '
+ $output .= '</td>';
}
- $output .= '</span></td>'."\n".
+ $output .= '</td></tr></table></td>'."\n".
&Apache::loncommon::end_data_table_row()."\n";
}
return $output;
@@ -434,16 +449,17 @@
approval => 'Approval by Dom. Coord.',
validate => 'With validation',
autolimit => 'Numerical limit',
+ unlimited => '(blank for unlimited)',
);
- return %titles;
-}
-
+ return %titles;
+}
+
sub courserequest_display {
my %titles = &Apache::lonlocal::texthash (
approval => 'Yes, need approval',
validate => 'Yes, with validation',
norequest => 'No',
- );
+ );
return %titles;
}
@@ -709,13 +725,13 @@
faq=>282,bug=>'Instructor Interface',});
if ($env{'form.action'} eq 'singleuser') {
$r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management',
- 'Course_Change_Privileges'));
+ 'Course_Change_Privileges'));
$r->print("<b>$lt{'usrch'}</b><br />");
$r->print(&entry_form($srch->{'srchdomain'},$srch,undef,$context));
$r->print('<h3>'.$lt{'usel'}.'</h3>');
} elsif ($env{'form.action'} eq 'singlestudent') {
$r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management',
- 'Course_Add_Student'));
+ 'Course_Add_Student'));
$r->print($jscript."<b>$lt{'stusrch'}</b><br />");
$r->print(&entry_form($srch->{'srchdomain'},$srch,undef,$context));
$r->print('</form><h3>'.$lt{'stusel'}.'</h3>');
@@ -2446,7 +2462,6 @@
}
&tool_changes('tools',\@usertools,\%oldaccess,\%oldaccesstext,\%userenv,
\%changeHash,\%changed,\%newaccess,\%newaccesstext);
-
if ($env{'form.ccdomain'} eq $env{'request.role.domain'}) {
&tool_changes('requestcourses',\@requestcourses,\%oldaccess,\%oldaccesstext,
\%userenv,\%changeHash,\%changed,\%newaccess,\%newaccesstext);
@@ -2693,7 +2708,7 @@
'aboutme' => "Personal Information Page Availability",
'portfolio' => "Portfolio Availability",
'official' => "Can Request Official Courses",
- 'unofficial' => "Can Request Unofficial Course",
+ 'unofficial' => "Can Request Unofficial Courses",
'inststatus' => "Affiliation",
);
$r->print(<<"END");
@@ -2813,48 +2828,56 @@
my %reqdisplay = &courserequest_display();
my $cdom = $env{'request.role.domain'};
foreach my $tool (@{$usertools}) {
- $oldaccesstext->{$tool} = &mt('no');
+ $oldaccesstext->{$tool} = &mt('No');
+ $newaccesstext->{$tool} = $oldaccesstext->{$tool};
$changeHash->{$context.'.'.$tool} = $userenv->{$context.'.'.$tool};
+ my $newop;
+ if ($env{'form.'.$context.'_'.$tool}) {
+ $newop = $env{'form.'.$context.'_'.$tool};
+ if ($newop eq 'autolimit') {
+ my $limit = $env{'form.'.$context.'_'.$tool.'_limit'};
+ $limit =~ s/\D+//g;
+ $newop .= '='.$limit;
+ }
+ }
if ($userenv->{$context.'.'.$tool} eq '') {
- if ($env{'form.'.$context.'_'.$tool}) {
- $changed->{$tool}=&tool_admin($tool,$cdom,
+ if ($newop) {
+ $changed->{$tool}=&tool_admin($tool,$cdom.':'.$newop,
$changeHash,$context);
if ($changed->{$tool}) {
- $newaccesstext->{$tool} = &mt('yes');
+ $newaccesstext->{$tool} = &mt('Yes');
} else {
- $newaccesstext->{$tool} = $oldaccesstext->{$tool}; }
+ $newaccesstext->{$tool} = $oldaccesstext->{$tool};
+ }
}
} else {
my @curr = split(',',$userenv->{$context.'.'.$tool});
my @new;
my $changedoms;
- my $newop = $env{'form.'.$context.'_'.$tool};
- if ($newop eq 'autolimit') {
- $newop .= '=';
- unless ($env{'form.'.$context.'_'.$tool.'_limit'} =~ /\D/) {
- $newop .= $env{'form.'.$context.'_'.$tool.'_limit'};
- }
- }
- if (grep(/^\Q$cdom:($optregex\=?\d*)\E$/,@curr)) {
- $oldaccesstext->{$tool} = &mt('yes');
- my $oldop = $1;
- if ($oldop ne $newop) {
- $changedoms = 1;
- foreach my $dom (@curr) {
- unless ($dom eq $cdom) {
- push(@new,$dom);
+ foreach my $req (@curr) {
+ if ($req =~ /^\Q$cdom\E\:($optregex\=?\d*)$/) {
+ $oldaccesstext->{$tool} = &mt('Yes');
+ my $oldop = $1;
+ if ($oldop ne $newop) {
+ $changedoms = 1;
+ foreach my $item (@curr) {
+ my ($reqdom,$option) = split(':',$item);
+ unless ($reqdom eq $cdom) {
+ push(@new,$item);
+ }
}
+ if ($newop) {
+ push(@new,$cdom.':'.$newop);
+ }
+ @new = sort(@new);
}
- if ($newop) {
- push(@new,$cdom.':'.$newop);
- }
- @new = sort(@new);
+ last;
}
- } elsif ($env{'form.'.$context.'_'.$tool}) {
+ }
+ if ((!$changedoms) && ($newop)) {
$changedoms = 1;
@new = sort(@curr,$cdom.':'.$newop);
}
- $newaccesstext->{$tool} = $oldaccesstext->{$tool};
if ($changedoms) {
my $newdomstr;
if (@new) {
@@ -2865,10 +2888,12 @@
if ($changed->{$tool}) {
if ($env{'form.'.$context.'_'.$tool}) {
if ($env{'form.'.$context.'_'.$tool} eq 'autolimit') {
- if ($env{'form.'.$context.'_'.$tool.'_limit'} =~ /\D/) {
- $newaccesstext->{$tool} = &mt('Yes, processed automatically');
+ my $limit = $env{'form.'.$context.'_'.$tool.'_limit'};
+ $limit =~ s/\D+//g;
+ if ($limit) {
+ $newaccesstext->{$tool} = &mt('Yes, up to limit of [quant,_1,request] per user.',$limit);
} else {
- $newaccesstext->{$tool} = &mt('Yes, up to limit of [quant,_1,request] per user).',$env{'form.'.$context.'_'.$tool.'_limit'});
+ $newaccesstext->{$tool} = &mt('Yes, processed automatically');
}
} else {
$newaccesstext->{$tool} = $reqdisplay{$env{'form.'.$context.'_'.$tool}};
--raeburn1252624469--