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

raeburn raeburn@source.lon-capa.org
Fri, 19 Dec 2008 19:38:08 -0000


raeburn		Fri Dec 19 19:38:08 2008 EDT

  Modified files:              
    /loncom/interface	lonfeedback.pm 
  Log:
  - Check that navmap object could be created to avoid ISE.
    - Display error message and log to lonnet.log if navmap object undefined.
  - Regular Expressions for both http and https.
  
  
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.259 loncom/interface/lonfeedback.pm:1.260
--- loncom/interface/lonfeedback.pm:1.259	Sat Dec 13 03:50:04 2008
+++ loncom/interface/lonfeedback.pm	Fri Dec 19 19:38:07 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.259 2008/12/13 03:50:04 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.260 2008/12/19 19:38:07 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3247,12 +3247,18 @@
 sub has_discussion {
     my $resourcesref = shift;
     my $navmap = Apache::lonnavmaps::navmap->new();
-    my @allres=$navmap->retrieveResources();
-    foreach my $resource (@allres) {
-        if ($resource->hasDiscussion()) {
-            my $ressymb = $resource->wrap_symb();
-            push(@{$resourcesref}, $ressymb);
+    if (defined($navmap)) {
+        my @allres=$navmap->retrieveResources();
+        foreach my $resource (@allres) {
+            if ($resource->hasDiscussion()) {
+                my $ressymb = $resource->wrap_symb();
+                if (ref($resourcesref) eq 'ARRAY') {
+                    push(@{$resourcesref}, $ressymb);
+                }
+            }
         }
+    } else {
+        &Apache::lonnet::logthis('Has discussion check failed - could not create navmap object.');
     }
     return;
 }
@@ -3654,7 +3660,7 @@
   } else {
 # ------------------------------------------------------------- Normal feedback
       my $feedurl=$env{'form.postdata'};
-      $feedurl=~s/^http\:\/\///;
+      $feedurl=~s/^https?\:\/\///;
       $feedurl=~s/^$ENV{'SERVER_NAME'}//;
       $feedurl=~s/^$ENV{'HTTP_HOST'}//;
       $feedurl=~s/\?.+$//;