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

www lon-capa-cvs@mail.lon-capa.org
Tue, 01 Nov 2005 15:59:18 -0000


www		Tue Nov  1 10:59:18 2005 EDT

  Modified files:              
    /loncom/interface	lonfeedback.pm lonmsg.pm 
  Log:
  Bug #3495: preview on mail
  
  
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.170 loncom/interface/lonfeedback.pm:1.171
--- loncom/interface/lonfeedback.pm:1.170	Sat Oct 29 22:38:10 2005
+++ loncom/interface/lonfeedback.pm	Tue Nov  1 10:59:18 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.170 2005/10/30 02:38:10 www Exp $
+# $Id: lonfeedback.pm,v 1.171 2005/11/01 15:59:18 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2641,13 +2641,16 @@
 }
 
 sub generate_preview_button {
+    my ($formname,$fieldname)=@_;
+    unless ($formname) { $formname='mailform'; }
+    unless ($fieldname) { $fieldname='comment'; }
     my $pre=&mt("Show Preview and Check Spelling");
     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="if (typeof(document.mailform.onsubmit)=='function') {document.mailform.onsubmit();};this.form.comment.value=document.mailform.comment.value;this.form.subject.value=document.mailform.subject.value;this.form.submit();" />
+onClick="if (typeof(document.$formname.onsubmit)=='function') {document.$formname.onsubmit();};this.form.comment.value=document.$formname.$fieldname.value;this.form.subject.value=document.$formname.subject.value;this.form.submit();" />
 </form>
 ENDPREVIEW
 }
Index: loncom/interface/lonmsg.pm
diff -u loncom/interface/lonmsg.pm:1.152 loncom/interface/lonmsg.pm:1.153
--- loncom/interface/lonmsg.pm:1.152	Fri Jul  8 06:39:49 2005
+++ loncom/interface/lonmsg.pm	Tue Nov  1 10:59:18 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging
 #
-# $Id: lonmsg.pm,v 1.152 2005/07/08 10:39:49 www Exp $
+# $Id: lonmsg.pm,v 1.153 2005/11/01 15:59:18 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -114,6 +114,7 @@
 use Mail::Send;
 use Apache::lonlocal;
 use Apache::loncommunicate;
+use Apache::lonfeedback;
 
 # Querystring component with sorting type
 my $sqs;
@@ -1233,6 +1234,7 @@
        &discourse;
     }
     $r->print('</form>'.
+	      &Apache::lonfeedback::generate_preview_button('compemail','message').
 	      &Apache::lonhtmlcommon::htmlareaselectactive('message'));
 }