[LON-CAPA-cvs] cvs: loncom(version_2_8_X) /interface londocs.pm

raeburn raeburn@source.lon-capa.org
Sun, 21 Dec 2008 16:15:40 -0000


raeburn		Sun Dec 21 16:15:40 2008 EDT

  Modified files:              (Branch: version_2_8_X)
    /loncom/interface	londocs.pm 
  Log:
  - Backport 1.325.
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.314.2.3 loncom/interface/londocs.pm:1.314.2.4
--- loncom/interface/londocs.pm:1.314.2.3	Sun Dec 21 15:48:43 2008
+++ loncom/interface/londocs.pm	Sun Dec 21 16:15:39 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.314.2.3 2008/12/21 15:48:43 raeburn Exp $
+# $Id: londocs.pm,v 1.314.2.4 2008/12/21 16:15:39 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -280,6 +280,15 @@
                                                $env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'});
     my $numdisc = keys %discussiontime;
     my $navmap = Apache::lonnavmaps::navmap->new();
+    if (!defined($navmap)) {
+        $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package').
+                  '<h2>IMS Export Failed</h2>'.
+                  '<div class="LC_error">'.
+                  &mt('Unable to retrieve information about course contents').
+                  '</div><a href="/adm/coursedocs">'.&mt('Return to Course Editor').'</a>');
+        &Apache::lonnet::logthis('IMS export failed - could not create navmap object in '.lc($type).':'.$env{'request.course.id'});
+        return;
+    }
     my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef);
     my $curRes;
     my $outcome;
@@ -471,8 +480,7 @@
 	$r->print($display.'</table>'.
                   '<p><input type="hidden" name="finishexport" value="1">'.
                   '<input type="submit" name="exportcourse" value="'.
-                  &mt('Export '.$type.' DOCS').'" /></p></form>'.
-		  &Apache::loncommon::end_page());
+                  &mt('Export '.$type.' DOCS').'" /></p></form>');
     }
 }
 
@@ -2108,14 +2116,23 @@
 sub list_symbs {
     my ($r) = @_;
 
+    my $type = &Apache::loncommon::course_type();
     $r->print(&Apache::loncommon::start_page('Symb List'));
     $r->print(&Apache::lonhtmlcommon::breadcrumbs('Symb List'));
     my $navmap = Apache::lonnavmaps::navmap->new();
-    $r->print("<pre>\n");
-    foreach my $res ($navmap->retrieveResources()) {
-	$r->print($res->compTitle()."\t".$res->symb()."\n");
+    if (!defined($navmap)) {
+        $r->print('<h2>'.&mt('Retrieval of List Failed').'</h2>'.
+                  '<div class="LC_error">'.
+                  &mt('Unable to retrieve information about course contents').
+                  '</div>');
+        &Apache::lonnet::logthis('Symb list failed - could not create navmap object in '.lc($type).':'.$env{'request.course.id'});
+    } else {
+        $r->print("<pre>\n");
+        foreach my $res ($navmap->retrieveResources()) {
+	    $r->print($res->compTitle()."\t".$res->symb()."\n");
+        }
+        $r->print("\n</pre>\n");
     }
-    $r->print("\n</pre>\n");
     $r->print('<a href="/adm/coursedocs">'.&mt('Return to DOCS').'</a>');
 }