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

www lon-capa-cvs@mail.lon-capa.org
Sat, 24 Jul 2004 18:13:05 -0000


www		Sat Jul 24 14:13:05 2004 EDT

  Modified files:              
    /loncom/interface	lonfeedback.pm 
  Log:
  More comprehensive fix for Bug #3232 - detects presence of HTMLarea at
  runtime, since HTMLarea - even if the code is sent out - can "decide" to
  not load.
  
  
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.104 loncom/interface/lonfeedback.pm:1.105
--- loncom/interface/lonfeedback.pm:1.104	Fri Jul 23 15:58:40 2004
+++ loncom/interface/lonfeedback.pm	Sat Jul 24 14:13:04 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.104 2004/07/23 19:58:40 albertel Exp $
+# $Id: lonfeedback.pm,v 1.105 2004/07/24 18:13:04 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -864,11 +864,6 @@
   }
   my $latexHelp=&Apache::loncommon::helpLatexCheatsheet();
   my $htmlheader=&Apache::lonhtmlcommon::htmlareaheaders();
-  my $onsubmit='';
-  if ((&Apache::lonhtmlcommon::htmlareabrowser()) &&
-      (!&Apache::lonhtmlcommon::htmlareablocked())) {
-      $onsubmit='document.mailform.onsubmit();';
-  }
   my $send=&mt('Send');
   $r->print(<<END);
 <html>
@@ -912,7 +907,9 @@
         }
 
         if (rec) {
-            $onsubmit
+            if (typeof(document.mailform.onsubmit)!='undefined') {
+		document.mailform.onsubmit();
+	    }
 	    document.mailform.submit();
         } else {
             alert('Please check a feedback type.');
@@ -959,7 +956,7 @@
 </p>
 </form>
 ENDDOCUMENT
-$r->print(&generate_preview_button($onsubmit).
+$r->print(&generate_preview_button().
 &Apache::lonhtmlcommon::htmlareaselectactive('comment').
 '</body></html>');
 }
@@ -1758,14 +1755,13 @@
 }
 
 sub generate_preview_button {
-    my ($onsubmit)=@_;
     my $pre=&mt("Show Preview");
     return(<<ENDPREVIEW);
 <form name="preview" action="/adm/feedback?preview=1" method="post" target="preview">
 <input type="hidden" name="subject">
 <input type="hidden" name="comment" />
 <input type="button" value="$pre"
-onClick="$onsubmit;this.form.comment.value=document.mailform.comment.value;this.form.subject.value=document.mailform.subject.value;this.form.submit();" />
+onClick="if (typeof(document.mailform.onsubmit)!='undefined') {document.mailform.onsubmit();};this.form.comment.value=document.mailform.comment.value;this.form.subject.value=document.mailform.subject.value;this.form.submit();" />
 </form>
 ENDPREVIEW
 }