| 1 | ################################################################################ |
1 | ################################################################################ |
| 2 | # WeBWorK Online Homework Delivery System |
2 | # WeBWorK Online Homework Delivery System |
| 3 | # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ |
3 | # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ |
| 4 | # $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor/SendMail.pm,v 1.19 2004/03/28 03:25:47 gage Exp $ |
4 | # $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor/SendMail.pm,v 1.20 2004/04/04 04:00:10 gage Exp $ |
| 5 | # |
5 | # |
| 6 | # This program is free software; you can redistribute it and/or modify it under |
6 | # This program is free software; you can redistribute it and/or modify it under |
| 7 | # the terms of either: (a) the GNU General Public License as published by the |
7 | # the terms of either: (a) the GNU General Public License as published by the |
| 8 | # Free Software Foundation; either version 2, or (at your option) any later |
8 | # Free Software Foundation; either version 2, or (at your option) any later |
| 9 | # version, or (b) the "Artistic License" which comes with this package. |
9 | # version, or (b) the "Artistic License" which comes with this package. |
| … | |
… | |
| 591 | my @tmp2; |
591 | my @tmp2; |
| 592 | eval{ @tmp2= @{$rh_merge_data->{ $db->getUser($preview_user)->student_id } };}; # checked |
592 | eval{ @tmp2= @{$rh_merge_data->{ $db->getUser($preview_user)->student_id } };}; # checked |
| 593 | if ($@ and $merge_file ne 'None') { |
593 | if ($@ and $merge_file ne 'None') { |
| 594 | print "No merge data for $preview_user in merge file: <$merge_file>",CGI::br(); |
594 | print "No merge data for $preview_user in merge file: <$merge_file>",CGI::br(); |
| 595 | } else { |
595 | } else { |
| 596 | print CGI::pre("",data_format(0..($#tmp2)),"<br>\n", data_format(@tmp2)); |
596 | print CGI::pre("",data_format(0..($#tmp2)),"<br>\n", data_format2(@tmp2)); |
| 597 | } |
597 | } |
| 598 | #create a textbox with the subject and a textarea with the message |
598 | #create a textbox with the subject and a textarea with the message |
| 599 | #print actual body of message |
599 | #print actual body of message |
| 600 | |
600 | |
| 601 | print "\n", CGI::p( $self->{message}) if defined($self->{message}); |
601 | print "\n", CGI::p( $self->{message}) if defined($self->{message}); |
| … | |
… | |
| 746 | $msg =~ s/\$COL\[ *-/\$COL\[$endCol-/g; |
746 | $msg =~ s/\$COL\[ *-/\$COL\[$endCol-/g; |
| 747 | $msg =~ s/(\$COL\[.*?\])/eval($1)/ge; |
747 | $msg =~ s/(\$COL\[.*?\])/eval($1)/ge; |
| 748 | |
748 | |
| 749 | $msg =~ s/\r//g; |
749 | $msg =~ s/\r//g; |
| 750 | |
750 | |
| 751 | my $preview_header = CGI::pre("",data_format(0..($#COL)),"<br>\n", data_format(@COL)). |
751 | my $preview_header = CGI::pre("",data_format(0..($#COL)),"<br>\n", data_format2(@COL)). |
| 752 | CGI::h3( "This sample mail would be sent to $EMAIL"); |
752 | CGI::h3( "This sample mail would be sent to $EMAIL"); |
| 753 | |
753 | |
| 754 | |
754 | |
| 755 | return $msg, $preview_header; |
755 | return $msg, $preview_header; |
| 756 | } |
756 | } |
| 757 | sub data_format { |
757 | sub data_format { |
| 758 | map {$_ =~s/\s/\./g;$_} map {sprintf('%-8.8s',$_);} @_; |
758 | map {"COL[$_]".' 'x(4-length($_));} @_; |
|
|
759 | } |
|
|
760 | sub data_format2 { |
|
|
761 | map { $_ . ' 'x(9-length($_));} @_; |
| 759 | } |
762 | } |
| 760 | 1; |
763 | 1; |