Log Message:
-----------
implement customizable feedback subject line. The following escape
sequences are recognized:
%c = course ID
%u = user ID
%s = set ID
%p = problem ID
%x = section
%r = recitation
%% = literal percent sign
Modified Files:
--------------
webwork2/lib/WeBWorK/ContentGenerator:
Feedback.pm
webwork2/conf:
global.conf.dist
Revision Data
-------------
Index: Feedback.pm
===================================================================
RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/ContentGenerator/Feedback.pm,v
retrieving revision 1.30
retrieving revision 1.31
diff -Llib/WeBWorK/ContentGenerator/Feedback.pm -Llib/WeBWorK/ContentGenerator/Feedback.pm -u -r1.30 -r1.31
--- lib/WeBWorK/ContentGenerator/Feedback.pm
+++ lib/WeBWorK/ContentGenerator/Feedback.pm
@@ -180,17 +180,26 @@
return "";
}
+ my %subject_map = (
+ 'c' => $courseID,
+ 'u' => $user ? $user->user_id : undef,
+ 's' => $set ? $set->set_id : undef,
+ 'p' => $problem ? $problem->problem_id : undef,
+ 'x' => $user ? $user->section : undef,
+ 'r' => $user ? $user->recitation : undef,
+ '%' => '%',
+ );
+ my $chars = join("", keys %subject_map);
+ my $subject = $ce->{mail}{feedbackSubjectFormat}
+ || "WeBWorK feedback from %c: %u set %s/prob %p"; # default if not entered
+ $subject =~ s/%([$chars])/defined $subject_map{$1} ? $subject_map{$1} : ""/eg;
+
# bring up a mailer
my $mailer = Mail::Sender->new({
from => $sender,
to => join(",", @recipients),
- # *** we might want to have a CE setting for
- # "additional recipients"
smtp => $ce->{mail}->{smtpServer},
- subject => "WeBWorK feedback from $courseID (".$user->section.'-'.$user->recitation.'): '.$user->first_name.' '.$user->last_name.
- ( ( defined($setName) && defined($problemNumber) ) ?
- " set$setName/prob$problemNumber" : ""
- ),
+ subject => $subject,
headers => "X-Remote-Host: ".$r->get_remote_host(),
});
unless (ref $mailer) {
Index: global.conf.dist
===================================================================
RCS file: /webwork/cvs/system/webwork2/conf/global.conf.dist,v
retrieving revision 1.139
retrieving revision 1.140
diff -Lconf/global.conf.dist -Lconf/global.conf.dist -u -r1.139 -r1.140
--- conf/global.conf.dist
+++ conf/global.conf.dist
@@ -93,7 +93,7 @@
# message. It can really be anything, but some mail servers require it contain
# a valid mail domain, or at least be well-formed.
$mail{smtpSender} = 'we...@yo...';
-
+
# AllowedRecipients defines addresses that the PG system is allowed to send mail
# to. this prevents subtle PG exploits. This should be set in course.conf to the
# addresses of professors of each course. Sending mail from the PG system (i.e.
@@ -123,12 +123,24 @@
#'pr...@yo...',
];
+# Feedback subject line -- the following escape sequences are recognized:
+#
+# %c = course ID
+# %u = user ID
+# %s = set ID
+# %p = problem ID
+# %x = section
+# %r = recitation
+# %% = literal percent sign
+#
+$mail{feedbackSubjectFormat} = "[WWfeedback] course:%c %% user:%u set:%s prob:%p sec:%x rec:%r";
+
# feedbackVerbosity:
# 0: send only the feedback comment and context link
# 1: as in 0, plus user, set, problem, and PG data
# 2: as in 1, plus the problem environment (debugging data)
$mail{feedbackVerbosity} = 1;
-
+
# Defines the size of the Mail Merge editor window
# FIXME: should this be here? it's UI, not mail
# FIXME: replace this with the auto-size method that TWiki uses
@@ -340,22 +352,7 @@
};
################################################################################
-# Database options (WWDBv3)
-################################################################################
-
-# The four arguments passed to the DBI::connect() method. See the DBI manual for
-# more information.
-$wwdbv3_settings{dsn} = "dbi:mysql:wwdbv3";
-$wwdbv3_settings{user} = "wwdbv3";
-$wwdbv3_settings{pass} = "xyzzy";
-$wwdbv3_settings{attr} = {};
-
-# WWDBv3 needs a lock file to prevent concurrent database upgrades. The file
-# will be locked with flock().
-$wwdbv3_settings{upgrade_lock} = "$webworkDirs{tmp}/wwdbv3_upgrade.lock";
-
-################################################################################
-# Database options (WWDBv2)
+# Database options
################################################################################
# Several database are defined in the file conf/database.conf and stored in the
|