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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Thu, 29 May 2008 19:58:33 -0000


raeburn		Thu May 29 15:58:33 2008 EDT

  Modified files:              
    /loncom/interface	coursecatalog.pm 
  Log:
  Display catalog header in case where official classes catalog is being displayed, but there are no courses within this category.  
  
  
Index: loncom/interface/coursecatalog.pm
diff -u loncom/interface/coursecatalog.pm:1.29 loncom/interface/coursecatalog.pm:1.30
--- loncom/interface/coursecatalog.pm:1.29	Thu May 29 02:18:07 2008
+++ loncom/interface/coursecatalog.pm	Thu May 29 15:58:32 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler for displaying the course catalog interface
 #
-# $Id: coursecatalog.pm,v 1.29 2008/05/29 06:18:07 raeburn Exp $
+# $Id: coursecatalog.pm,v 1.30 2008/05/29 19:58:32 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -154,6 +154,9 @@
     my $totcodes = 0;
     my $jscript = '';
     my ($numtitles,$lasttitle);
+    my %add_entries = (topmargin    => "0",
+                       marginheight => "0",);
+    my $js;
     $totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$codedom);
     if ($totcodes > 0) {
         $format_reply = &Apache::lonnet::auto_instcode_format($caller,$codedom,\%coursecodes,\%codes,\@codetitles,\%cat_titles,\%cat_order);
@@ -221,10 +224,8 @@
 }\n|;
             }
         }
-        my $js = '<script type"text/javascript">'."\n$jscript\n$catjs\n".
-                 '</script>';
-        my %add_entries = (topmargin    => "0",
-                           marginheight => "0",);
+        $js = '<script type"text/javascript">'."\n$jscript\n$catjs\n".
+              '</script>';
         if (($env{'form.state'} eq 'listing') && ($numtitles > 0)) {
             $add_entries{'onLoad'} = 'setElements()';
         }
@@ -298,7 +299,13 @@
             $r->print('<br />');
         }
     } else {
-        $r->print('<br />'.&mt('No official courses to display for [_1].',$domdesc));
+        &cat_header($r,$codedom,$js,\%add_entries,$catlinks,$numtitles);
+        my $cat_maxdepth = $env{'form.catalog_maxdepth'};
+        $r->print('<form name="'.$formname.'" method="post" action="/adm/coursecatalog">'.
+                  '<input type="hidden" name="catalog_maxdepth" value="'.$cat_maxdepth.'" />'.
+                  '<input type="hidden" name="showdom" value="'.$env{'form.showdom'}.'" />'.
+                  '<input type="hidden" name="currcat_0" value="instcode::0" />');
+        $r->print('<br />'.&mt('No official courses to display for [_1].',$domdesc).'</form>');
     }
     return $numtitles;
 }