File tree Expand file tree Collapse file tree 4 files changed +23
-19
lines changed
Expand file tree Collapse file tree 4 files changed +23
-19
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ $mail{feedbackRecipients} = [
7373# %% = literal percent sign
7474#
7575
76- $mail {feedbackSubjectFormat } = " [WWfeedback] course:%c user:%u set:%s prob:%p sec:%x rec:%r " ;
76+ $mail {feedbackSubjectFormat } = ' [WWfeedback] course:%c user:%u%s{ set:}%s%p{ prob:}%p%x{ sec:}%x%r{ rec:}%r ' ;
7777
7878# feedbackVerbosity:
7979# 0: send only the feedback comment and context link
Original file line number Diff line number Diff line change @@ -829,13 +829,15 @@ sub getConfigValues ($ce) {
829829 x(' E-Mail' ),
830830 {
831831 var => ' mail{feedbackSubjectFormat}' ,
832- doc => x(' Format for the subject line in feedback emails' ),
832+ doc => x(' Format for the subject of feedback emails' ),
833833 doc2 => x(
834- ' When students click the <em>Email Instructor</em> button to send feedback, WeBWorK fills in the '
835- . ' subject line. Here you can set the subject line. In it, you can have various bits of '
836- . ' information filled in with the following escape sequences.<p><ul><li>%c = course ID</li>'
834+ ' <p> When students click the <em>Email Instructor</em> button to send feedback, WeBWorK fills in '
835+ . ' the subject line. Here you can set the subject line. In it, you can have various bits of '
836+ . ' information filled in with the following escape sequences.</ p><ul><li>%c = course ID</li>'
837837 . ' <li>%u = user ID</li><li>%s = set ID</li><li>%p = problem ID</li><li>%x = section</li>'
838- . ' <li>%r = recitation</li><li>%% = literal percent sign</li></ul>'
838+ . ' <li>%r = recitation</li><li>%% = literal percent sign</li></ul><p>Sequences like '
839+ . " '%r { rec:}' will produce the string inside the braces if the corresponding key (%r in this "
840+ . ' example) is defined and nonempty.'
839841 ),
840842 width => 45,
841843 type => ' text'
Original file line number Diff line number Diff line change @@ -109,16 +109,17 @@ sub initialize ($c) {
109109 }
110110
111111 my %subject_map = (
112- ' c ' => $courseID ,
113- ' u ' => $user ? $user -> user_id : undef ,
114- ' s ' => $set ? $set -> set_id : undef ,
115- ' p ' => $problem ? $problem -> problem_id : undef ,
116- ' x ' => $user ? $user -> section : undef ,
117- ' r ' => $user ? $user -> recitation : undef ,
112+ c => $courseID ,
113+ u => $user ? $user -> user_id : undef ,
114+ s => $set ? $set -> set_id : undef ,
115+ p => $problem ? $problem -> problem_id : undef ,
116+ x => $user && $user -> section ? $user -> section : undef ,
117+ r => $user && $user -> recitation ? $user -> recitation : undef ,
118118 ' %' => ' %' ,
119119 );
120120 my $chars = join (' ' , keys %subject_map );
121121 my $subject = $ce -> {mail }{feedbackSubjectFormat } || ' WeBWorK question from %c: %u set %s/prob %p' ;
122+ $subject =~ s / %([$chars])\{ (.*?)\} / defined $subject_map {$1 } ? $2 : ''/ eg ;
122123 $subject =~ s / %([$chars])/ defined $subject_map {$1 } ? $subject_map {$1 } : ''/ eg ;
123124
124125 my %data = (
Original file line number Diff line number Diff line change @@ -384,18 +384,19 @@ sub jitar_send_warning_email ($c, $userProblem) {
384384 $problemID = join (' .' , jitar_id_to_seq($problemID ));
385385
386386 my %subject_map = (
387- ' c ' => $courseID ,
388- ' u ' => $userID ,
389- ' s ' => $setID ,
390- ' p ' => $problemID ,
391- ' x ' => $user -> section,
392- ' r ' => $user -> recitation,
387+ c => $courseID ,
388+ u => $userID ,
389+ s => $setID ,
390+ p => $problemID ,
391+ x => $user -> section ? $user -> section : undef ,
392+ r => $user -> recitation ? $user -> recitation : undef ,
393393 ' %' => ' %' ,
394394 );
395395 my $chars = join (' ' , keys %subject_map );
396396 my $subject = $ce -> {mail }{feedbackSubjectFormat }
397397 || ' WeBWorK question from %c: %u set %s/prob %p' ; # default if not entered
398- $subject =~ s / %([$chars])/ defined $subject_map {$1 } ? $subject_map {$1 } : ""/ eg ;
398+ $subject =~ s / %([$chars])\{ (.*?)\} / defined $subject_map {$1 } ? $2 : ''/ eg ;
399+ $subject =~ s / %([$chars])/ defined $subject_map {$1 } ? $subject_map {$1 } : ''/ eg ;
399400
400401 my $full_name = $user -> full_name;
401402 my $email_address = $user -> email_address;
You can’t perform that action at this time.
0 commit comments