--- loncom/interface/lonsupportreq.pm 2017/01/18 21:24:40 1.86
+++ loncom/interface/lonsupportreq.pm 2017/02/25 20:00:47 1.91
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Helpdesk request form
#
-# $Id: lonsupportreq.pm,v 1.86 2017/01/18 21:24:40 raeburn Exp $
+# $Id: lonsupportreq.pm,v 1.91 2017/02/25 20:00:47 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -79,7 +79,7 @@ sub handler {
}
return OK;
}
-
+
sub print_request_form {
my ($r,$origurl,$function) = @_;
my ($os,$browser,$bversion,$uname,$udom,$uhome,$urole,$usec,$email,$cid,
@@ -105,7 +105,7 @@ sub print_request_form {
}
}
}
- if (($env{'user.name'} =~ /^$match_username$/) &&
+ if (($env{'user.name'} =~ /^$match_username$/) &&
($env{'user.domain'} =~ /^$match_domain$/) && (!$public)) {
$knownuser = 1;
} else {
@@ -246,7 +246,7 @@ END
subj => 'Subject',
detd => 'Detailed Description',
opfi => 'Optional file upload',
- uplf => 'Upload a file (e.g., a screenshot) relevant to your help request (1 MB max.)',
+ uplf => 'Upload a file (e.g., a screenshot) relevant to your help request',
fini => 'Finish',
clfm => 'Clear Form',
);
@@ -350,7 +350,7 @@ ENDJS
unless ($helpform{'username'} eq 'no') {
my ($reqd,$namefield,$fullname);
if ((defined($lastname) && $lastname ne '') && (defined($firstname) && $firstname ne '')) {
- $fullname = "$firstname $lastname";
+ $fullname = "$firstname $lastname";
$namefield = $fullname.'&').'" />'."\n";
} else {
if (defined($firstname) && $firstname ne '') {
@@ -378,7 +378,7 @@ ENDJS
&HTML::Entities::encode($email,'"<>&').'" />'."\n";
unless ($shownsubmit) {
$output .= $topsubmit;
- }
+ }
$output .= &Apache::lonhtmlcommon::row_closure();
$num ++;
$i = $num%2;
@@ -541,7 +541,7 @@ ENDJS
$output .= ''."\n".
'
'.
'
'."\n";
- } else {
+ } else {
$output .= ''."\n";
}
$output .= &Apache::lonhtmlcommon::row_closure();
@@ -567,13 +567,16 @@ ENDJS
if ($homeserver) {
unless ($helpform{'screenshot'} eq 'no') {
my $max = 1048576;
+ my $showmax = 1.00;
if ($helpform{'maxsize'} =~ /^\d+\.\d*$/) {
- $max *= $helpform{'maxsize'};
+ $max *= $helpform{'maxsize'};
+ $showmax = $helpform{'maxsize'};
}
+ $showmax = ' ('.sprintf("%.2f",$showmax).' '.&mt('MB max.').')';
$output .= &Apache::lonhtmlcommon::row_title($html_lt{'opfi'},undef,$css[$i])
.' '
.''
- .'
'."\n".$html_lt{'uplf'}."\n"
+ .'
'."\n".$html_lt{'uplf'}.$showmax."\n"
.&Apache::lonhtmlcommon::row_closure();
$num ++;
$i = $num%2;
@@ -624,7 +627,7 @@ sub print_request_receipt {
if (($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public')) {
$public = 1;
}
- my $lonhost = $r->dir_config('lonHostID');
+ my $lonhost = $r->dir_config('lonHostID');
unless (($env{'user.name'} =~ /^$match_username$/) && (!$public)) {
my ($captcha_chk,$captcha_error) =
&Apache::loncommon::captcha_response('login',$lonhost);
@@ -654,7 +657,12 @@ sub print_request_receipt {
my @ENVvars = ('HTTP_HOST','HTTP_USER_AGENT','REMOTE_ADDR','SERVER_ADDR','SERVER_NAME');
my @envvars = ('browser.os','browser.type','browser.version','user.home','request.role');
my @loncvars = ('user.name','user.domain','request.course.sec','request.course.id');
- my @cookievars = ('lonID');
+ my @cookievars;
+ if ($ENV{'SERVER_PORT'} == 443) {
+ @cookievars = ('lonLinkID');
+ } else {
+ @cookievars = ('lonID');
+ }
my $admin = $Apache::lonnet::perlvar{'lonAdminMail'};
my $origmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
@@ -830,7 +838,7 @@ sub print_request_receipt {
}
if ($formvars{'course'}) {
$supportmsg .= "$lt{'crsi'}: $env{'form.crsi'}\n";
- }
+ }
$supportmsg .= "$lt{'subject'}: $env{'form.subject'}
$lt{'description'}: $env{'form.description'}
$lt{'sourceurl'}: $env{'form.sourceurl'}
@@ -958,18 +966,24 @@ END
my $fname;
my $attachmentpath = '';
- my $attachmentsize = '';
+ my $showsize = '';
+
if ((defined($env{'user.name'})) && (!$public)) {
if ($homeserver && $env{'form.screenshot.filename'}) {
unless ($helpform{'screenshot'} eq 'no') {
- $attachmentsize = length($env{'form.screenshot'});
+ my $attachmentsize = length($env{'form.screenshot'});
my $max = 1048576;
+ my $showmax = 1.00;
if ($helpform{'maxsize'} =~ /^\d+\.\d*$/) {
$max *= $helpform{'maxsize'};
+ $showmax = $helpform{'maxsize'};
}
+ $showmax = '('.sprintf("%.2f",$showmax).' MB)';
+ $showsize = $attachmentsize/1048576;
+ $showsize = '('.sprintf("%.2f",$showsize).' MB)';
if ($attachmentsize > $max) {
$displaymsg .= '
'.
- &mt('The uploaded screenshot file ([_1] bytes) included with your request exceeded the maximum allowed size - 1 MB, and has therefore been discarded.',$attachmentsize).'';
+ &mt('The uploaded screenshot file [_1] included with your request exceeded the maximum allowed size [_2], and has therefore been discarded.',$showsize,$showmax).'';
} else {
$attachmentpath=&Apache::lonnet::userfileupload('screenshot',undef,'helprequests');
}
@@ -982,13 +996,14 @@ END
if ($$cookie{'lonID'} =~ /lonID=($LONCAPA::handle_re);/) {
$cookies{'lonID'} = $1;
}
-
+ if ($$cookie{'lonLinkID'} =~ /lonLinkID=([a-f0-9]+_linked);/) {
+ $cookies{'lonLinkID'} = $1;
+ }
if ($attachmentpath =~ m-/([^/]+)$-) {
$fname = $1;
$displaymsg .= '
'
- .&mt('An uploaded screenshot file [_1] ([_2] bytes) was included in the request sent by [_3].'
- ,''.$fname.''
- ,$attachmentsize
+ .&mt('An uploaded screenshot file [_1] was included in the request sent by [_2].'
+ ,''.$fname.' '.$showsize,
,$env{'user.name'}.':'.$env{'user.domain'}
);
$supportmsg .= "\n";
@@ -1002,7 +1017,7 @@ END
$supportmsg .= "$var: $env{$var}\n";
}
}
-
+
my $cc_string;
if ($homeserver) {
if (@ok_ccs > 0) {
@@ -1010,20 +1025,19 @@ END
}
}
- my $attachment_text;
+ my $attachment_text = '';
unless ($homeserver && $attachmentpath) {
- my $envdata = '';
foreach my $var (@cookievars) {
- $envdata .= "$var: $cookies{$var}\n";
+ $attachment_text .= "$var: $cookies{$var}\n";
}
foreach my $var (@ENVvars) {
- $envdata .= "$var: $ENV{$var}\n";
+ $attachment_text .= "$var: $ENV{$var}\n";
}
foreach my $var (@envvars) {
- $envdata .= "$var: $env{$var}\n";
+ $attachment_text .= "$var: $env{$var}\n";
}
foreach my $var (@loncvars) {
- $envdata .= "$var: $env{$var}\n";
+ $attachment_text .= "$var: $env{$var}\n";
}
$attachment_text = $envdata;
}