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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Thu, 29 May 2008 06:18:08 -0000


raeburn		Thu May 29 02:18:08 2008 EDT

  Modified files:              
    /loncom/interface	coursecatalog.pm 
  Log:
  - Construct category breadcrumbs trail, and set appropriate filter in cases where "Go" button is clicked when category selection is set to "Select".
  
  
Index: loncom/interface/coursecatalog.pm
diff -u loncom/interface/coursecatalog.pm:1.28 loncom/interface/coursecatalog.pm:1.29
--- loncom/interface/coursecatalog.pm:1.28	Thu May 29 00:29:33 2008
+++ loncom/interface/coursecatalog.pm	Thu May 29 02:18:07 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler for displaying the course catalog interface
 #
-# $Id: coursecatalog.pm,v 1.28 2008/05/29 04:29:33 raeburn Exp $
+# $Id: coursecatalog.pm,v 1.29 2008/05/29 06:18:07 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -350,7 +350,11 @@
     my $currcat_str;
     if ($env{'form.catalog_maxdepth'} ne '') {
         $currdepth = $env{'form.catalog_maxdepth'};
-        $deeper = $currdepth + 1;
+        if ($env{'form.currcat_'.$currdepth} eq '') {
+            $deeper = $currdepth;
+        } else {
+            $deeper = $currdepth + 1;
+        }
     }
     $currcat_str = '<input type="hidden" name="catalog_maxdepth" value="'.$deeper.'" /><input type="hidden" name="showdom" value="'.$dom.'" />';
     my $catlinks = '<td valign="top"><b>'.&mt('Catalog:').'</b></td><td><table><tr>';
@@ -406,7 +410,13 @@
             $env{'form.currcat_0'} = 'instcode::0';
         }
     } else {
-        my ($cat,$container,$depth) = map { &unescape($_); } split(/:/,$env{'form.currcat_'.$currdepth});
+        my ($cat,$container,$depth);
+        if ($env{'form.currcat_'.$currdepth} eq '') {
+            my $shallower = $currdepth - 1;
+            ($cat,$container,$depth) = map { &unescape($_); } split(/:/,$env{'form.currcat_'.$shallower});
+        } else {
+            ($cat,$container,$depth) = map { &unescape($_); } split(/:/,$env{'form.currcat_'.$currdepth});
+        }
         my $deeper = $depth +1;
         my $currcat = $cat;
         if ($cat eq 'instcode') {
@@ -559,6 +569,10 @@
     my ($domain) = @_;
     my $cat_maxdepth = $env{'form.catalog_maxdepth'};
     my $filter = $env{'form.currcat_'.$cat_maxdepth};
+    if (($filter eq '') && ($cat_maxdepth > 0)) {
+        my $shallower = $cat_maxdepth - 1;
+        $filter = $env{'form.currcat_'.$shallower};
+    }
     my %courses;
     if ($filter ne '') {
         %courses = &Apache::lonnet::courseiddump($domain,'.',1,'.','.','.',