[system] / branches / rel-2-3-dev / webwork-modperl / lib / WeBWorK / ContentGenerator / Instructor / SendMail.pm Repository:
ViewVC logotype

Diff of /branches/rel-2-3-dev/webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor/SendMail.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1952 Revision 1953
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.21 2004/04/05 19:33:03 gage Exp $ 4# $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor/SendMail.pm,v 1.23 2004/04/05 20:52:54 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.
155# Determine the file name to save message into 155# Determine the file name to save message into
156################################################################# 156#################################################################
157 my $output_file = 'FIXME no output file specified'; 157 my $output_file = 'FIXME no output file specified';
158 if (defined($action) and $action eq 'Save as Default') { 158 if (defined($action) and $action eq 'Save as Default') {
159 $output_file = $default_msg_file; 159 $output_file = $default_msg_file;
160 } elsif ( defined($action) and ($action =~/save/i) and defined($savefilename) ){ 160 } elsif ( defined($action) and ($action =~/save/i) and defined($savefilename) and $savefilename ){
161 $output_file = $savefilename; 161 $output_file = $savefilename;
162 } elsif ( defined($input_file) ) { 162 } elsif ( defined($input_file) ) {
163 $output_file = $input_file; 163 $output_file = $input_file;
164 } 164 }
165# warn "FIXME savefilename $savefilename output file $output_file"; 165
166 ################################################################# 166 #################################################################
167 # Sanity check on save file name 167 # Sanity check on save file name
168 ################################################################# 168 #################################################################
169 169
170 if ($output_file =~ /^[~.]/ || $output_file =~ /\.\./) { 170 if ($output_file =~ /^[~.]/ || $output_file =~ /\.\./) {
186 186
187############################################################################################# 187#############################################################################################
188# Determine input source 188# Determine input source
189############################################################################################# 189#############################################################################################
190 my $input_source = ( defined( $r->param('body') ) and $action ne 'Open' ) ? 'form' : 'file'; 190 my $input_source = ( defined( $r->param('body') ) and $action ne 'Open' ) ? 'form' : 'file';
191# warn "FIXME input source is $input_source from $input_file"; 191
192############################################################################################# 192#############################################################################################
193# Get inputs 193# Get inputs
194############################################################################################# 194#############################################################################################
195 my($from, $replyTo, $r_text, $subject); 195 my($from, $replyTo, $r_text, $subject);
196 if ($input_source eq 'file') { 196 if ($input_source eq 'file') {
197# warn "FIXME obtaining source from $emailDirectory/$input_file"; 197
198 ($from, $replyTo,$subject,$r_text) = $self->read_input_file("$emailDirectory/$input_file"); 198 ($from, $replyTo,$subject,$r_text) = $self->read_input_file("$emailDirectory/$input_file");
199# warn "FIXME Done reading source"; 199
200 200
201 } elsif ($input_source eq 'form') { 201 } elsif ($input_source eq 'form') {
202 # read info from the form 202 # read info from the form
203 # bail if there is no message body 203 # bail if there is no message body
204 204
249 my $script_action = ''; 249 my $script_action = '';
250 250
251 251
252 if(not defined($action) or $action eq 'Open' or $action eq $REFRESH_RESIZE_BUTTON or $action eq 'Sort by' 252 if(not defined($action) or $action eq 'Open' or $action eq $REFRESH_RESIZE_BUTTON or $action eq 'Sort by'
253 or $action eq 'Set merge file to:' ){ 253 or $action eq 'Set merge file to:' ){
254# warn "FIXME action is |$action| no further initialization required"; 254
255 return ''; 255 return '';
256 } 256 }
257 257
258 258
259 259
299 } 299 }
300 ################################################################# 300 #################################################################
301 # Save the message 301 # Save the message
302 ################################################################# 302 #################################################################
303 $self->saveProblem($temp_body, "${emailDirectory}/$output_file" ); 303 $self->saveProblem($temp_body, "${emailDirectory}/$output_file" );
304 unless ( $self->{submitError} or not -w "${emailDirectory}/$output_file" ) { # if there are no errors report success
304 $self->{message} .= "Message saved to file <code>${emailDirectory}/$output_file</code>."; 305 $self->{message} .= "Message saved to file <code>${emailDirectory}/$output_file</code>.";
305# warn "FIXME saving to ${emailDirectory}/$output_file"; 306 }
307
306 } elsif ($action eq 'Preview') { 308 } elsif ($action eq 'Preview') {
307 $self->{response} = 'preview'; 309 $self->{response} = 'preview';
308 310
309 } elsif ($action eq 'Send Email') { 311 } elsif ($action eq 'Send Email') {
310 $self->{response} = 'send_email'; 312 $self->{response} = 'send_email';

Legend:
Removed from v.1952  
changed lines
  Added in v.1953

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9