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

raeburn lon-capa-cvs@mail.lon-capa.org
Mon, 25 Sep 2006 00:16:57 -0000


raeburn		Sun Sep 24 20:16:57 2006 EDT

  Modified files:              
    /loncom/interface	coursecatalog.pm 
  Log:
  Need to return status code from the handler.  Also provide appropriate message when no courses have been assigned institutional codes.
  
  
Index: loncom/interface/coursecatalog.pm
diff -u loncom/interface/coursecatalog.pm:1.4 loncom/interface/coursecatalog.pm:1.5
--- loncom/interface/coursecatalog.pm:1.4	Wed Sep 13 17:35:46 2006
+++ loncom/interface/coursecatalog.pm	Sun Sep 24 20:16:56 2006
@@ -60,6 +60,7 @@
     my $totcodes = 0;
     my $jscript = '';
     my $formname = 'coursecatalog';
+    my $domdesc = $Apache::lonnet::domaindescription{$codedom};
     $totcodes = &Apache::lonsupportreq::retrieve_instcodes(\%coursecodes,$codedom,$totcodes);
     if ($totcodes > 0) {
         if ($ccode eq '') {
@@ -108,7 +109,6 @@
         $r->print($start_page);
 
         my $numtitles = @codetitles;
-        my $domdesc = $Apache::lonnet::domaindescription{$codedom};
         $r->print('<h3>'.&mt('Display information about official [_1] classes for which LON-CAPA courses have been created:',$domdesc).'</h3>');
         $r->print(&mt('<b>Choose which course(s) to list.</b><br />'));
         $r->print('<form name="coursecatalog" method="post">'); 
@@ -163,11 +163,17 @@
             }
         }
         $r->print('<br /><input type="hidden" name="state" value="listing" /><input type="hidden" name="sortby" value="" /><input type="submit" name="catalogfilter" value="'.&mt('Display courses').'" /></form>');
+    } else {
+        $r->print(&Apache::loncommon::start_page('Course Catalog','',
+                  {
+                   'no_inline_link'   => 1,}));
+        $r->print('<br />'.&mt('No official courses to display for [_1].',$domdesc));
     }
     if ($env{'form.state'} eq 'listing') {
         $r->print('<br /><br />'.&print_course_listing($codedom));
     }
     $r->print(&Apache::loncommon::end_page());
+    return OK;
 }
 
 sub print_course_listing {