Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change introduction to feedback emails #2649

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/WeBWorK/ContentGenerator.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,8 @@ sub systemLink ($c, $urlpath, %options) {
my $url = $options{use_abs_url} ? $urlpath->to_abs : $urlpath;

for my $name (keys %params) {
$params{$name} = [ $c->param($name) ] if (!defined $params{$name} && defined $c->param($name));
$params{$name} = [ $c->param($name) ]
if (!defined $params{$name} && defined $c->param($name) && $c->param($name) ne '');
}

return %params ? $url->query(%params) : $url;
Expand Down
12 changes: 4 additions & 8 deletions lib/WeBWorK/ContentGenerator/Feedback.pm
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,11 @@ sub initialize ($c) {

my $systemURL = $c->url_for('root')->to_abs;

my $msg = qq/This message was automatically generated by the WeBWorK
system at $systemURL, in response to a request from $remote_host:$remote_port.

Click this link to see the page from which the user sent feedback:
$emailableURL

/;
my $msg = sprintf("Message from %s (%s) via WeBWorK at\n%s\n\n", $user->full_name, $user->user_id, $systemURL);
$msg .= "To visit the page from which the user sent feedback, go to:\n$emailableURL\n\n";

if ($feedback) {
$msg .= qq/***** The feedback message: *****\n\n\n$feedback\n\n\n/;
$msg .= sprintf("%s (%s) wrote:\n\n\n%s\n\n\n", $user->full_name, $user->user_id, $feedback);
}
if ($problem and $verbosity >= 1) {
$msg .=
Expand All @@ -172,6 +167,7 @@ $emailableURL
if ($user && $verbosity >= 1) {
$msg .= "***** Data about the user: *****\n\n";
$msg .= $c->format_user($user) . "\n";
$msg .= "$remote_host:$remote_port\n";
}

if ($problem && $verbosity >= 1) {
Expand Down
17 changes: 8 additions & 9 deletions lib/WeBWorK/Utils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -358,24 +358,23 @@ sub generateURLs ($c, %params) {

if ($userName) {
my $routePath;
my @args;
my %args;
if (defined $params{set_id} && $params{set_id} ne '') {
if ($params{problem_id}) {
$routePath = $c->url_for('problem_detail', setID => $params{set_id}, problemID => $params{problem_id});
@args = qw/displayMode showOldAnswers showCorrectAnswers showHints showSolutions/;
for my $name ('displayMode', 'showCorrectAnswers', 'showHints', 'showOldAnswers', 'showSolutions') {
$args{$name} = [ $c->param($name) ] if defined $c->param($name) && $c->param($name) ne '';
}
$args{showProblemGrader} = 1;
} else {
$routePath = $c->url_for('problem_list', setID => $params{set_id});
}
} else {
$routePath = $c->url_for('set_list');
}
$emailableURL = $c->systemLink(
$routePath,
authen => 0,
params => [ 'effectiveUser', @args ],
use_abs_url => 1,
);
$returnURL = $c->systemLink($routePath, params => [@args]);
$args{effectiveUser} = [ $c->param('effectiveUser') ] if defined $c->param('effectiveUser');
$emailableURL = $routePath->to_abs->query(map { $_ => $args{$_} } sort keys %args);
$returnURL = $c->systemLink($routePath);
} else {
$emailableURL = '(not available)';
$returnURL = '';
Expand Down