[LON-CAPA-cvs] cvs: loncom /interface loncreateuser.pm londropadd.pm
albertel
lon-capa-cvs-allow@mail.lon-capa.org
Thu, 11 Oct 2007 02:16:27 -0000
albertel Wed Oct 10 22:16:27 2007 EDT
Modified files:
/loncom/interface londropadd.pm loncreateuser.pm
Log:
- remember last selections on user creations screens
Index: loncom/interface/londropadd.pm
diff -u loncom/interface/londropadd.pm:1.171 loncom/interface/londropadd.pm:1.172
--- loncom/interface/londropadd.pm:1.171 Tue Oct 9 13:33:57 2007
+++ loncom/interface/londropadd.pm Wed Oct 10 22:16:25 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to drop and add students in courses
#
-# $Id: londropadd.pm,v 1.171 2007/10/09 17:33:57 raeburn Exp $
+# $Id: londropadd.pm,v 1.172 2007/10/11 02:16:25 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2757,11 +2757,13 @@
my @search = ('srchterm','srchby','srchin','srchtype','srchdomain');
my ($jsback,$elements) = &Apache::loncreateuser::crumb_utilities();
my $jscript = '<script type="text/javascript">'.$jsback.'</script>';
+ &Apache::loncreateuser::restore_prev_selections();
+ my $srch;
+ foreach my $item (@search) {
+ $srch->{$item} = $env{'form.'.$item};
+ }
+
if ($env{'form.state'} eq 'gotusername') {
- my $srch;
- foreach my $item (@search) {
- $srch->{$item} = $env{'form.'.$item};
- }
if ($env{'form.phase'} eq 'get_user_info') {
my ($currstate,$response,$forcenewuser,$results) =
&Apache::loncreateuser::user_search_result($srch);
@@ -2811,7 +2813,7 @@
&print_enroll_single_student_form($r,$jscript,$ccuname,
$ccdomain,$srch);
} else {
- &get_student_username_domain_form($r,$elements);
+ &get_student_username_domain_form($r,$elements,undef,$srch);
}
} elsif ($env{'form.state'} eq 'enrolling') {
$r->print(&header($jscript));
@@ -2832,7 +2834,7 @@
'Course_Add_Student'));
&enroll_single_student($r,\@search);
} else {
- &get_student_username_domain_form($r,$elements);
+ &get_student_username_domain_form($r,$elements,undef,$srch);
}
} elsif ($env{'form.action'} eq 'classlist' && $permission->{'view'}) {
$r->print(&header());
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.188 loncom/interface/loncreateuser.pm:1.189
--- loncom/interface/loncreateuser.pm:1.188 Tue Oct 9 13:33:57 2007
+++ loncom/interface/loncreateuser.pm Wed Oct 10 22:16:25 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.188 2007/10/09 17:33:57 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.189 2007/10/11 02:16:25 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2408,12 +2408,15 @@
my $phase = $env{'form.phase'};
my @search = ('srchterm','srchby','srchin','srchtype','srchdomain');
+
+ &Apache::loncreateuser::restore_prev_selections();
+ my $srch;
+ foreach my $item (@search) {
+ $srch->{$item} = $env{'form.'.$item};
+ }
if (($phase eq 'get_user_info') || ($phase eq 'userpicked')) {
- my $srch;
- foreach my $item (@search) {
- $srch->{$item} = $env{'form.'.$item};
- }
+
if ($env{'form.phase'} eq 'get_user_info') {
my ($currstate,$response,$forcenewuser,$results) =
&user_search_result($srch);
@@ -2456,7 +2459,7 @@
} elsif ($env{'form.phase'} eq 'set_custom_roles') {
&set_custom_role($r);
} else {
- &print_username_entry_form($r);
+ &print_username_entry_form($r,undef,$srch);
}
} else {
$env{'user.error.msg'}=
@@ -2466,6 +2469,17 @@
return OK;
}
+sub restore_prev_selections {
+ my %saveable_parameters = ('srchby' => 'scalar',
+ 'srchin' => 'scalar',
+ 'srchtype' => 'scalar',
+ );
+ &Apache::loncommon::store_settings('user','user_picker',
+ \%saveable_parameters);
+ &Apache::loncommon::restore_settings('user','user_picker',
+ \%saveable_parameters);
+}
+
#-------------------------------------------------- functions for &phase_two
sub user_search_result {
my ($srch) = @_;