[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm loncreateuser.pm
raeburn
raeburn@source.lon-capa.org
Mon, 18 May 2009 16:08:07 -0000
raeburn Mon May 18 16:08:07 2009 EDT
Modified files:
/loncom/interface loncommon.pm loncreateuser.pm
Log:
- &compare_arrays() moved from loncreateuser.pm to loncommon.pm to permit reuse
(used in courseprefs.pm)
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.819 loncom/interface/loncommon.pm:1.820
--- loncom/interface/loncommon.pm:1.819 Sat May 16 18:06:41 2009
+++ loncom/interface/loncommon.pm Mon May 18 16:08:07 2009
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.819 2009/05/16 18:06:41 tempelho Exp $
+# $Id: loncommon.pm,v 1.820 2009/05/18 16:08:07 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -10212,6 +10212,22 @@
return join('/',@urlslices).'/'.$lastitem;
}
+sub compare_arrays {
+ my ($arrayref1,$arrayref2) = @_;
+ my (@difference,%count);
+ @difference = ();
+ %count = ();
+ if ((ref($arrayref1) eq 'ARRAY') && (ref($arrayref2) eq 'ARRAY')) {
+ foreach my $element (@{$arrayref1}, @{$arrayref2}) { $count{$element}++; }
+ foreach my $element (keys(%count)) {
+ if ($count{$element} == 1) {
+ push(@difference,$element);
+ }
+ }
+ }
+ return @difference;
+}
+
# -------------------------------------------------------- Initialize user login
sub init_user_environment {
my ($r, $username, $domain, $authhost, $form, $args) = @_;
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.294 loncom/interface/loncreateuser.pm:1.295
--- loncom/interface/loncreateuser.pm:1.294 Thu May 14 14:23:56 2009
+++ loncom/interface/loncreateuser.pm Mon May 18 16:08:07 2009
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.294 2009/05/14 14:23:56 bisitz Exp $
+# $Id: loncreateuser.pm,v 1.295 2009/05/18 16:08:07 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -5773,7 +5773,7 @@
}
} else {
my @differences =
- &compare_arrays(\@currnotified,\@newnotified);
+ &Apache::loncommon::compare_arrays(\@currnotified,\@newnotified);
if (@differences > 0) {
if (@newnotified > 0) {
$changes{'internal.selfenroll_notifylist'} = join(',',@newnotified);
@@ -5783,7 +5783,7 @@
}
}
} else {
- my @differences = &compare_arrays(\@currnotified,\@newnotified);
+ my @differences = &Apache::loncommon::compare_arrays(\@currnotified,\@newnotified);
if (@differences > 0) {
if (@newnotified > 0) {
$changes{'internal.selfenroll_notifylist'} = join(',',@newnotified);
@@ -5973,22 +5973,6 @@
return;
}
-sub compare_arrays {
- my ($arrayref1,$arrayref2) = @_;
- my (@difference,%count);
- @difference = ();
- %count = ();
- if ((ref($arrayref1) eq 'ARRAY') && (ref($arrayref2) eq 'ARRAY')) {
- foreach my $element (@{$arrayref1}, @{$arrayref2}) { $count{$element}++; }
- foreach my $element (keys(%count)) {
- if ($count{$element} == 1) {
- push(@difference,$element);
- }
- }
- }
- return @difference;
-}
-
sub get_selfenroll_titles {
my @row = ('types','registered','enroll_dates','access_dates','section',
'approval','limit');