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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 09 May 2006 20:44:16 -0000


albertel		Tue May  9 16:44:16 2006 EDT

  Modified files:              
    /loncom/interface	lonfeedback.pm 
  Log:
  - in remote less mode hitting 'send' could cause a new window to get spawned, this occured because the onload handler was trying to submit to the 'loncapaclient' window which could be a different window
  
  
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.199 loncom/interface/lonfeedback.pm:1.200
--- loncom/interface/lonfeedback.pm:1.199	Tue May  9 16:38:45 2006
+++ loncom/interface/lonfeedback.pm	Tue May  9 16:44:15 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.199 2006/05/09 20:38:45 albertel Exp $
+# $Id: lonfeedback.pm,v 1.200 2006/05/09 20:44:15 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2204,7 +2204,11 @@
   }
   $feedurl=&Apache::lonenc::check_encrypt($feedurl);
   my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');
-  my %onload = ('onload' => "if (window.name!='loncapaclient') { this.document.reldt.submit(); self.window.close(); }");
+  my %onload;
+  if ($env{'environment.remote'} ne 'off') {
+      $onload{'onload'} =
+	  "if (window.name!='loncapaclient') { this.document.reldt.submit(); self.window.close(); }";
+  }
   my $start_page=
       &Apache::loncommon::start_page('New posts marked as read',undef,
 				     {'redirect'    => [2,$feedurl],
@@ -2235,9 +2239,15 @@
   my ($r,$feedurl) = @_;
   my $nofeed=&mt('Sorry, no feedback possible on this resource  ...');
  
+  my %onload;
+  if ($env{'environment.remote'} ne 'off') {
+      $onload{'onload'} = 
+	  "if (window.name!='loncapaclient') { self.window.close(); }";
+  }
+
   my %body_options = ('only_body'   => 1,
 		      'bgcolor'     => '#FFFFFF',
-		      'add_entries' => {'onload' => "if (window.name!='loncapaclient') { self.window.close(); }"});
+		      'add_entries' => \%onload,);
 
   if ($feedurl !~ m{^/adm/feedback}) { 
       $body_options{'rediect'} = [2,$feedurl];
@@ -3109,7 +3119,12 @@
       &Apache::loncommon::content_type($r,'text/html');
       $r->send_http_header;
       my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');
-      my %onload = ('onload' => "if (window.name!='loncapaclient') { this.document.reldt.submit(); self.window.close(); }");
+      my %onload;
+      if ($env{'environment.remote'} ne 'off') {
+	  $onload{'onload'} =
+	      "if (window.name!='loncapaclient') { this.document.reldt.submit(); self.window.close(); }";
+      }
+
       my $start_page=
 	  &Apache::loncommon::start_page('New posts marked as read',undef,
 					 {'redirect'    => [2,$feedurl],