[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm loncoursedata.pm lonfeedback.pm lonpopulate.pm lonstatistics.pm

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 04 Oct 2005 18:27:34 -0000


This is a MIME encoded message

--albertel1128450454
Content-Type: text/plain

albertel		Tue Oct  4 14:27:34 2005 EDT

  Modified files:              
    /loncom/interface	loncommon.pm loncoursedata.pm lonfeedback.pm 
                     	lonpopulate.pm lonstatistics.pm 
  Log:
  - remove course_id as an argument to loncoursedata::get_classlist
  
  
--albertel1128450454
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20051004142734.txt"

Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.275 loncom/interface/loncommon.pm:1.276
--- loncom/interface/loncommon.pm:1.275	Tue Oct  4 12:34:40 2005
+++ loncom/interface/loncommon.pm	Tue Oct  4 14:27:32 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.275 2005/10/04 16:34:40 raeburn Exp $
+# $Id: loncommon.pm,v 1.276 2005/10/04 18:27:32 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3018,11 +3018,10 @@
 sub get_sections {
     my ($cdom,$cnum,$sectioncount,$possible_roles) = @_;
     if (!($cdom && $cnum)) { return 0; }
-    my $cid = $cdom.'_'.$cnum;
     my $numsections = 0;
 
     if (!defined($possible_roles) || (grep/^st$/,@$possible_roles)) {
-	my ($classlist) = &Apache::loncoursedata::get_classlist($cid,$cdom,$cnum);
+	my ($classlist) = &Apache::loncoursedata::get_classlist($cdom,$cnum);
 	my $sec_index = &Apache::loncoursedata::CL_SECTION();
 	my $status_index = &Apache::loncoursedata::CL_STATUS();
 	while (my ($student,$data) = each %$classlist) {
@@ -3083,7 +3082,7 @@
         my $statusidx = &Apache::loncoursedata::CL_STATUS;
         my $startidx = &Apache::loncoursedata::CL_START;
         my $endidx = &Apache::loncoursedata::CL_END;
-        my ($classlist,$keylist)=&Apache::loncoursedata::get_classlist($course_id,$cdom,$cnum);
+        my ($classlist,$keylist)=&Apache::loncoursedata::get_classlist($cdom,$cnum);
         foreach my $student (keys (%{$classlist})) {
             if (defined($$types{'active'})) {
                 if ($$classlist{$student}[$statusidx] eq 'Active') {
Index: loncom/interface/loncoursedata.pm
diff -u loncom/interface/loncoursedata.pm:1.149 loncom/interface/loncoursedata.pm:1.150
--- loncom/interface/loncoursedata.pm:1.149	Wed Jul 13 22:28:25 2005
+++ loncom/interface/loncoursedata.pm	Tue Oct  4 14:27:32 2005
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: loncoursedata.pm,v 1.149 2005/07/14 02:28:25 albertel Exp $
+# $Id: loncoursedata.pm,v 1.150 2005/10/04 18:27:32 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -869,7 +869,9 @@
     my $dbh = &Apache::lonmysql::get_dbh();
     my $request = 'INSERT IGNORE INTO '.$student_table.
         "(student,section,status) VALUES ";
-    my $classlist = &get_classlist($courseid);
+    my $cdom = $env{'course.'.$courseid.'.domain'};
+    my $cnum = $env{'course.'.$courseid.'.num'};
+    my $classlist = &get_classlist($cdom,$cnum);
     my $student_count=0;
     while (my ($student,$data) = each %$classlist) {
         my ($section,$status) = ($data->[&CL_SECTION()],
@@ -2697,9 +2699,9 @@
 information is returned from the classlist.db file and, if needed,
 from the students environment.
 
-Optional arguments are $cid, $cdom, and $cnum (course id, course domain,
-and course number, respectively).  Any omitted arguments will be taken 
-from the current environment ($env{'request.course.id'},
+Optional arguments are $cdom, and $cnum (course domain,
+and course number, respectively).  If either is ommitted the course
+will be taken from the current environment ($env{'request.course.id'},
 $env{'course.'.$cid.'.domain'}, and $env{'course.'.$cid.'.num'}).
 
 Returns a reference to a hash which contains:
@@ -2727,10 +2729,13 @@
 sub CL_LOCKEDTYPE   { return 9; }
 
 sub get_classlist {
-    my ($cid,$cdom,$cnum) = @_;
-    $cid = $cid || $env{'request.course.id'};
-    $cdom = $cdom || $env{'course.'.$cid.'.domain'};
-    $cnum = $cnum || $env{'course.'.$cid.'.num'};
+    my ($cdom,$cnum) = @_;
+    my $cid = $cdom.'_'.$cnum;
+    if (!defined($cdom) || !defined($cnum)) {
+	$cid =  $env{'request.course.id'};
+	$cdom = $env{'course.'.$cid.'.domain'};
+	$cnum = $env{'course.'.$cid.'.num'};
+    }
     my $now = time;
     #
     my %classlist=&Apache::lonnet::dump('classlist',$cdom,$cnum);
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.168 loncom/interface/lonfeedback.pm:1.169
--- loncom/interface/lonfeedback.pm:1.168	Tue Sep 20 03:52:03 2005
+++ loncom/interface/lonfeedback.pm	Tue Oct  4 14:27:32 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.168 2005/09/20 07:52:03 albertel Exp $
+# $Id: lonfeedback.pm,v 1.169 2005/10/04 18:27:32 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -113,7 +113,7 @@
     my $toggkey = $ressymb.'_readtoggle';
     my $readkey = $ressymb.'_read';
     $ressymb=$encsymb;
-    my %dischash = &Apache::lonnet::get('nohist_'.$env{'request.course.id'}.'_discuss',[$lastkey,$showkey,$markkey,$visitkey,$ondispkey,$userpickkey,$toggkey,$readkey],$env{'user.domain'},$env{'user.name'});
+    my %dischash = &Apache::lonnet::get('nohist_'.$cid.'_discuss',[$lastkey,$showkey,$markkey,$visitkey,$ondispkey,$userpickkey,$toggkey,$readkey],$env{'user.domain'},$env{'user.name'});
     my %discinfo = ();
     my $showonlyunread = 0;
     my $showunmark = 0; 
@@ -154,7 +154,9 @@
     my %roleshash = ();
     my %roleinfo = ();
     if ($env{'form.rolefilter'}) {
-        %roleshash = &Apache::lonnet::dump('nohist_userroles',$env{'course.'.$env{'request.course.id'}.'.domain'},$env{'course.'.$env{'request.course.id'}.'.num'});
+        %roleshash = &Apache::lonnet::dump('nohist_userroles',
+					   $env{'course.'.$cid.'.domain'},
+					   $env{'course.'.$cid.'.num'});
         foreach (keys %roleshash) {
             my ($role,$uname,$udom,$sec) = split/:/,$_;
             if ($role =~ /^cr/) {
@@ -171,9 +173,8 @@
             }
         }
         my ($classlist) = &Apache::loncoursedata::get_classlist(
-                              $env{'request.course.id'},
-                              $env{'course.'.$env{'request.course.id'}.'.domain'},
-                              $env{'course.'.$env{'request.course.id'}.'.num'});
+                              $env{'course.'.$cid.'.domain'},
+                              $env{'course.'.$cid.'.num'});
         my $sec_index = &Apache::loncoursedata::CL_SECTION();
         my $status_index = &Apache::loncoursedata::CL_STATUS();
         while (my ($student,$data) = each %$classlist) {
@@ -245,7 +246,7 @@
     my $now = time;
     $discinfo{$visitkey} = $visit;
 
-    &Apache::lonnet::put('nohist_'.$env{'request.course.id'}.'_discuss',\%discinfo,$env{'user.domain'},$env{'user.name'});
+    &Apache::lonnet::put('nohist_'.$cid.'_discuss',\%discinfo,$env{'user.domain'},$env{'user.name'});
     &build_posting_display(\%usernamesort,\%subjectsort,\%namesort,\%notshown,\%newitem,\%dischash,\%shown,\%alldiscussion,\%imsitems,\%imsfiles,\%roleinfo,\@discussionitems,\@replies,\@depth,\@posters,\$maxdepth,\$visible,\$newpostsflag,\$current,$status,$viewgrades,$seeid,$prevread,$sortposts,$encsymb,$target,$readkey,$showunmark,$showonlyunread,$totposters,\@rolefilter,\@sectionpick,$statusfilter,$toggkey,$outputtarget);
 
     my $discussion='';
Index: loncom/interface/lonpopulate.pm
diff -u loncom/interface/lonpopulate.pm:1.26 loncom/interface/lonpopulate.pm:1.27
--- loncom/interface/lonpopulate.pm:1.26	Fri Sep 16 12:01:18 2005
+++ loncom/interface/lonpopulate.pm	Tue Oct  4 14:27:32 2005
@@ -1,5 +1,5 @@
 # automated enrollment configuration handler
-# $Id: lonpopulate.pm,v 1.26 2005/09/16 16:01:18 raeburn Exp $
+# $Id: lonpopulate.pm,v 1.27 2005/10/04 18:27:32 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2222,7 +2222,7 @@
     my %otherdom = ();
     my %lockchg = ();
     my %nolockchg = ();
-    my $classlist = &Apache::loncoursedata::get_classlist($cid,$dom,$crs);
+    my $classlist = &Apache::loncoursedata::get_classlist($dom,$crs);
     my $endidx = &Apache::loncoursedata::CL_END;
     my $startidx = &Apache::loncoursedata::CL_START;
     my $ididx=&Apache::loncoursedata::CL_ID;
@@ -2304,7 +2304,7 @@
     }
     if ($chgtotal > 0) {
         $response = "You requested a change in enrollment type for $chgtotal students.<br /><br />\n";
-        $classlist = &Apache::loncoursedata::get_classlist($cid,$dom,$crs);
+        $classlist = &Apache::loncoursedata::get_classlist($dom,$crs);
         if ($chgok > 0) {
             $response .= "The following $chgok changes were successful:<br />";
             $response .= &enrolltype_result(\%chg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx);
@@ -2321,7 +2321,7 @@
     }
     if ($locktotal > 0) {
         $response .= "You requested locking/unlocking for $locktotal manually enrolled students.<br /><br />\n";
-        $classlist = &Apache::loncoursedata::get_classlist($cid,$dom,$crs);
+        $classlist = &Apache::loncoursedata::get_classlist($dom,$crs);
         if ($lockok > 0) {
             $response .= "The following $lockok changes were successful:<br />";
             $response .= &enrolltype_result(\%lockchg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx,$lockedidx);
Index: loncom/interface/lonstatistics.pm
diff -u loncom/interface/lonstatistics.pm:1.124 loncom/interface/lonstatistics.pm:1.125
--- loncom/interface/lonstatistics.pm:1.124	Thu Apr  7 03:34:52 2005
+++ loncom/interface/lonstatistics.pm	Tue Oct  4 14:27:32 2005
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstatistics.pm,v 1.124 2005/04/07 07:34:52 albertel Exp $
+# $Id: lonstatistics.pm,v 1.125 2005/10/04 18:27:32 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -197,8 +197,8 @@
     my $cid  = $env{'request.course.id'};
     my $cdom = $env{'course.'.$cid.'.domain'};
     my $cnum = $env{'course.'.$cid.'.num'};
-    my ($classlist,$field_names) = &Apache::loncoursedata::get_classlist($cid,
-                                                                  $cdom,$cnum);
+    my ($classlist,$field_names) = &Apache::loncoursedata::get_classlist($cdom,
+									$cnum);
     my @selected_sections = &get_selected_sections();
     #
     # Deal with instructors with restricted section access

--albertel1128450454--