version 1.86, 2017/01/18 21:24:40
|
version 1.90, 2017/01/23 19:51:52
|
Line 79 sub handler {
|
Line 79 sub handler {
|
} |
} |
return OK; |
return OK; |
} |
} |
|
|
sub print_request_form { |
sub print_request_form { |
my ($r,$origurl,$function) = @_; |
my ($r,$origurl,$function) = @_; |
my ($os,$browser,$bversion,$uname,$udom,$uhome,$urole,$usec,$email,$cid, |
my ($os,$browser,$bversion,$uname,$udom,$uhome,$urole,$usec,$email,$cid, |
Line 105 sub print_request_form {
|
Line 105 sub print_request_form {
|
} |
} |
} |
} |
} |
} |
if (($env{'user.name'} =~ /^$match_username$/) && |
if (($env{'user.name'} =~ /^$match_username$/) && |
($env{'user.domain'} =~ /^$match_domain$/) && (!$public)) { |
($env{'user.domain'} =~ /^$match_domain$/) && (!$public)) { |
$knownuser = 1; |
$knownuser = 1; |
} else { |
} else { |
Line 246 END
|
Line 246 END
|
subj => 'Subject', |
subj => 'Subject', |
detd => 'Detailed Description', |
detd => 'Detailed Description', |
opfi => 'Optional file upload', |
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', |
fini => 'Finish', |
clfm => 'Clear Form', |
clfm => 'Clear Form', |
); |
); |
Line 350 ENDJS
|
Line 350 ENDJS
|
unless ($helpform{'username'} eq 'no') { |
unless ($helpform{'username'} eq 'no') { |
my ($reqd,$namefield,$fullname); |
my ($reqd,$namefield,$fullname); |
if ((defined($lastname) && $lastname ne '') && (defined($firstname) && $firstname ne '')) { |
if ((defined($lastname) && $lastname ne '') && (defined($firstname) && $firstname ne '')) { |
$fullname = "$firstname $lastname"; |
$fullname = "$firstname $lastname"; |
$namefield = $fullname.'<input type="hidden" name="username" value="'.&HTML::Entities::encode($fullname,'"<>&').'" />'."\n"; |
$namefield = $fullname.'<input type="hidden" name="username" value="'.&HTML::Entities::encode($fullname,'"<>&').'" />'."\n"; |
} else { |
} else { |
if (defined($firstname) && $firstname ne '') { |
if (defined($firstname) && $firstname ne '') { |
Line 378 ENDJS
|
Line 378 ENDJS
|
&HTML::Entities::encode($email,'"<>&').'" />'."\n"; |
&HTML::Entities::encode($email,'"<>&').'" />'."\n"; |
unless ($shownsubmit) { |
unless ($shownsubmit) { |
$output .= $topsubmit; |
$output .= $topsubmit; |
} |
} |
$output .= &Apache::lonhtmlcommon::row_closure(); |
$output .= &Apache::lonhtmlcommon::row_closure(); |
$num ++; |
$num ++; |
$i = $num%2; |
$i = $num%2; |
Line 541 ENDJS
|
Line 541 ENDJS
|
$output .= '</select></div>'."\n". |
$output .= '</select></div>'."\n". |
'<div id="LC_helpdesk_section" style="display:none">'. |
'<div id="LC_helpdesk_section" style="display:none">'. |
'<input type="text" name="sectiontxt" size="10" /></div>'."\n"; |
'<input type="text" name="sectiontxt" size="10" /></div>'."\n"; |
} else { |
} else { |
$output .= '<input type="text" name="section" size="10" />'."\n"; |
$output .= '<input type="text" name="section" size="10" />'."\n"; |
} |
} |
$output .= &Apache::lonhtmlcommon::row_closure(); |
$output .= &Apache::lonhtmlcommon::row_closure(); |
Line 567 ENDJS
|
Line 567 ENDJS
|
if ($homeserver) { |
if ($homeserver) { |
unless ($helpform{'screenshot'} eq 'no') { |
unless ($helpform{'screenshot'} eq 'no') { |
my $max = 1048576; |
my $max = 1048576; |
|
my $showmax = 1.00; |
if ($helpform{'maxsize'} =~ /^\d+\.\d*$/) { |
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]) |
$output .= &Apache::lonhtmlcommon::row_title($html_lt{'opfi'},undef,$css[$i]) |
.' <input type="file" name="screenshot" class="flUpload" size="20" />' |
.' <input type="file" name="screenshot" class="flUpload" size="20" />' |
.'<input type="hidden" id="free_space" value="'.$max.'" />' |
.'<input type="hidden" id="free_space" value="'.$max.'" />' |
.'<br />'."\n".$html_lt{'uplf'}."\n" |
.'<br />'."\n".$html_lt{'uplf'}.$showmax."\n" |
.&Apache::lonhtmlcommon::row_closure(); |
.&Apache::lonhtmlcommon::row_closure(); |
$num ++; |
$num ++; |
$i = $num%2; |
$i = $num%2; |
Line 624 sub print_request_receipt {
|
Line 627 sub print_request_receipt {
|
if (($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public')) { |
if (($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public')) { |
$public = 1; |
$public = 1; |
} |
} |
my $lonhost = $r->dir_config('lonHostID'); |
my $lonhost = $r->dir_config('lonHostID'); |
unless (($env{'user.name'} =~ /^$match_username$/) && (!$public)) { |
unless (($env{'user.name'} =~ /^$match_username$/) && (!$public)) { |
my ($captcha_chk,$captcha_error) = |
my ($captcha_chk,$captcha_error) = |
&Apache::loncommon::captcha_response('login',$lonhost); |
&Apache::loncommon::captcha_response('login',$lonhost); |
Line 830 sub print_request_receipt {
|
Line 833 sub print_request_receipt {
|
} |
} |
if ($formvars{'course'}) { |
if ($formvars{'course'}) { |
$supportmsg .= "$lt{'crsi'}: $env{'form.crsi'}\n"; |
$supportmsg .= "$lt{'crsi'}: $env{'form.crsi'}\n"; |
} |
} |
$supportmsg .= "$lt{'subject'}: $env{'form.subject'} |
$supportmsg .= "$lt{'subject'}: $env{'form.subject'} |
$lt{'description'}: $env{'form.description'} |
$lt{'description'}: $env{'form.description'} |
$lt{'sourceurl'}: $env{'form.sourceurl'} |
$lt{'sourceurl'}: $env{'form.sourceurl'} |
Line 958 END
|
Line 961 END
|
my $fname; |
my $fname; |
|
|
my $attachmentpath = ''; |
my $attachmentpath = ''; |
my $attachmentsize = ''; |
my $showsize = ''; |
|
|
if ((defined($env{'user.name'})) && (!$public)) { |
if ((defined($env{'user.name'})) && (!$public)) { |
if ($homeserver && $env{'form.screenshot.filename'}) { |
if ($homeserver && $env{'form.screenshot.filename'}) { |
unless ($helpform{'screenshot'} eq 'no') { |
unless ($helpform{'screenshot'} eq 'no') { |
$attachmentsize = length($env{'form.screenshot'}); |
my $attachmentsize = length($env{'form.screenshot'}); |
my $max = 1048576; |
my $max = 1048576; |
|
my $showmax = 1.00; |
if ($helpform{'maxsize'} =~ /^\d+\.\d*$/) { |
if ($helpform{'maxsize'} =~ /^\d+\.\d*$/) { |
$max *= $helpform{'maxsize'}; |
$max *= $helpform{'maxsize'}; |
|
$showmax = $helpform{'maxsize'}; |
} |
} |
|
$showmax = '('.sprintf("%.2f",$showmax).' MB)'; |
|
$showsize = $attachmentsize/1048576; |
|
$showsize = '('.sprintf("%.2f",$showsize).' MB)'; |
if ($attachmentsize > $max) { |
if ($attachmentsize > $max) { |
$displaymsg .= '<br /><span class="LC_warning">'. |
$displaymsg .= '<br /><span class="LC_warning">'. |
&mt('The uploaded screenshot file ([_1] bytes) included with your request exceeded the maximum allowed size - 1 MB, and has therefore been discarded.',$attachmentsize).'</span>'; |
&mt('The uploaded screenshot file [_1] included with your request exceeded the maximum allowed size [_2], and has therefore been discarded.',$showsize,$showmax).'</span>'; |
} else { |
} else { |
$attachmentpath=&Apache::lonnet::userfileupload('screenshot',undef,'helprequests'); |
$attachmentpath=&Apache::lonnet::userfileupload('screenshot',undef,'helprequests'); |
} |
} |
Line 986 END
|
Line 995 END
|
if ($attachmentpath =~ m-/([^/]+)$-) { |
if ($attachmentpath =~ m-/([^/]+)$-) { |
$fname = $1; |
$fname = $1; |
$displaymsg .= '<br />' |
$displaymsg .= '<br />' |
.&mt('An uploaded screenshot file [_1] ([_2] bytes) was included in the request sent by [_3].' |
.&mt('An uploaded screenshot file [_1] was included in the request sent by [_2].' |
,'<span class="LC_filename">'.$fname.'</span>' |
,'<span class="LC_filename">'.$fname.'</span> '.$showsize, |
,$attachmentsize |
|
,$env{'user.name'}.':'.$env{'user.domain'} |
,$env{'user.name'}.':'.$env{'user.domain'} |
); |
); |
$supportmsg .= "\n"; |
$supportmsg .= "\n"; |
Line 1002 END
|
Line 1010 END
|
$supportmsg .= "$var: $env{$var}\n"; |
$supportmsg .= "$var: $env{$var}\n"; |
} |
} |
} |
} |
|
|
my $cc_string; |
my $cc_string; |
if ($homeserver) { |
if ($homeserver) { |
if (@ok_ccs > 0) { |
if (@ok_ccs > 0) { |
Line 1010 END
|
Line 1018 END
|
} |
} |
} |
} |
|
|
my $attachment_text; |
my $attachment_text = ''; |
unless ($homeserver && $attachmentpath) { |
unless ($homeserver && $attachmentpath) { |
my $envdata = ''; |
|
foreach my $var (@cookievars) { |
foreach my $var (@cookievars) { |
$envdata .= "$var: $cookies{$var}\n"; |
$attachment_text .= "$var: $cookies{$var}\n"; |
} |
} |
foreach my $var (@ENVvars) { |
foreach my $var (@ENVvars) { |
$envdata .= "$var: $ENV{$var}\n"; |
$attachment_text .= "$var: $ENV{$var}\n"; |
} |
} |
foreach my $var (@envvars) { |
foreach my $var (@envvars) { |
$envdata .= "$var: $env{$var}\n"; |
$attachment_text .= "$var: $env{$var}\n"; |
} |
} |
foreach my $var (@loncvars) { |
foreach my $var (@loncvars) { |
$envdata .= "$var: $env{$var}\n"; |
$attachment_text .= "$var: $env{$var}\n"; |
} |
} |
$attachment_text = $envdata; |
$attachment_text = $envdata; |
} |
} |