version 1.86, 2017/01/18 21:24:40
|
version 1.87, 2017/01/23 17:23:03
|
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 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 964 END
|
Line 967 END
|
unless ($helpform{'screenshot'} eq 'no') { |
unless ($helpform{'screenshot'} eq 'no') { |
$attachmentsize = length($env{'form.screenshot'}); |
$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)'; |
if ($attachmentsize > $max) { |
if ($attachmentsize > $max) { |
|
my $showsize = $attachmentsize/1048576; |
|
$showsize = '('.sprintf("%.2f",$showsize).' MB)'; |
$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'); |
} |
} |