[LON-CAPA-cvs] cvs: loncom /interface coursecatalog.pm courseclassifier.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Fri, 15 Feb 2008 02:30:15 -0000


raeburn		Thu Feb 14 21:30:15 2008 EDT

  Modified files:              
    /loncom/interface	courseclassifier.pm coursecatalog.pm 
  Log:
  - courseclassifier.pm
    - support cases where displayed values differ from corresponding keys in oursenumber options. (Useful if institutional code uses specific characters to separate components).
      e.g., for code: ACCT-202-2007Fall, cousenumber 202 maps to -202-
  
  - coursecatalog.pm
    - check for array reference to avoid an ISE in the case where no coursecodes are defined even though categories exist in a customized localenroll::instcode_format().
  
  
Index: loncom/interface/courseclassifier.pm
diff -u loncom/interface/courseclassifier.pm:1.3 loncom/interface/courseclassifier.pm:1.4
--- loncom/interface/courseclassifier.pm:1.3	Sat Oct  6 00:32:49 2007
+++ loncom/interface/courseclassifier.pm	Thu Feb 14 21:30:14 2008
@@ -117,7 +117,8 @@
                 }
             } else {
                 %{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}} = ();
-                %{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}} = ();                @{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}{$$codes{$cid}{$$codetitles[3]}}} = ("$$codes{$cid}{$$codetitles[4]}");
+                %{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}} = ();
+                @{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}{$$codes{$cid}{$$codetitles[3]}}} = ("$$codes{$cid}{$$codetitles[4]}");
             }
         } else {
             %{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}} = ();
@@ -214,7 +215,7 @@
                         $$idlist{$$codetitles[3]}{$key_a}{$key_b}{$key_c} = join('","',@sorted_c);
                         $$idnums{$$codetitles[3]}{$key_a}{$key_b}{$key_c} = scalar(@sorted_c);
                         if (defined($$cat_titles{$$codetitles[3]})) {
-                            $$idlist_titles{$$codetitles[2]}{$key_a}{$key_b} = join('","',@sorted_c_titles);
+                            $$idlist_titles{$$codetitles[3]}{$key_a}{$key_b}{$key_c} = join('","',@sorted_c_titles);
                         }
                     }
                 }
@@ -238,6 +239,9 @@
                             }
                             $$idlist{$$codetitles[4]}{$key_a}{$key_b}{$key_c}{$key_d} = join('","',@sorted_d);
                             $$idnums{$$codetitles[4]}{$key_a}{$key_b}{$key_c}{$key_d} = scalar(@sorted_d);
+                            if (defined($$cat_titles{$$codetitles[4]})) {
+                                $$idlist_titles{$$codetitles[3]}{$key_a}{$key_b}{$key_c}{$key_d} = join('","',@sorted_d_titles);
+                            }
                         }
                     }
                 }
Index: loncom/interface/coursecatalog.pm
diff -u loncom/interface/coursecatalog.pm:1.25 loncom/interface/coursecatalog.pm:1.26
--- loncom/interface/coursecatalog.pm:1.25	Sat Jan 12 17:32:04 2008
+++ loncom/interface/coursecatalog.pm	Thu Feb 14 21:30:14 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler for displaying the course catalog interface
 #
-# $Id: coursecatalog.pm,v 1.25 2008/01/12 22:32:04 raeburn Exp $
+# $Id: coursecatalog.pm,v 1.26 2008/02/15 02:30:14 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -231,8 +231,10 @@
             $r->print(&mt('<b>Choose which course(s) to list.</b><br />'));
             $r->print('<table><tr>');
             for (my $k=0; $k<$lasttitle-1; $k++) {
-                my @unsorted = @{$cat_items{$codetitles[$k]}};
-                my @items;
+                my (@items,@unsorted);
+                if (ref($cat_items{$codetitles[$k]}) eq 'ARRAY') {
+                    @unsorted = @{$cat_items{$codetitles[$k]}};
+                }
                 &Apache::courseclassifier::sort_cats($k,\%cat_order,\@codetitles,\@unsorted,\@items);
                 my @longitems;
                 if (defined($cat_titles{$codetitles[$k]})) {