[LON-CAPA-cvs] cvs: loncom /interface lonsupportreq.pm
raeburn
raeburn at source.lon-capa.org
Mon Jan 23 12:23:03 EST 2017
raeburn Mon Jan 23 17:23:03 2017 EDT
Modified files:
/loncom/interface lonsupportreq.pm
Log:
- Maximum file size allowed for file uploaded to "Ask Helpdesk" form can
be set as a domain configuration. Default is 1 MB.
Index: loncom/interface/lonsupportreq.pm
diff -u loncom/interface/lonsupportreq.pm:1.86 loncom/interface/lonsupportreq.pm:1.87
--- loncom/interface/lonsupportreq.pm:1.86 Wed Jan 18 21:24:40 2017
+++ loncom/interface/lonsupportreq.pm Mon Jan 23 17:23:03 2017
@@ -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.87 2017/01/23 17:23:03 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -246,7 +246,7 @@
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',
);
@@ -567,13 +567,16 @@
if ($homeserver) {
unless ($helpform{'screenshot'} eq 'no') {
my $max = 1048576;
+ my $showmax = 1.00;
if ($helpform{'maxsize'} =~ /^\d+\.\d*$/) {
$max *= $helpform{'maxsize'};
+ $showmax = $helpform{'maxsize'};
}
+ $showmax = ' ('.sprintf("%.2f",$showmax).' '.&mt('MB max.').')';
$output .= &Apache::lonhtmlcommon::row_title($html_lt{'opfi'},undef,$css[$i])
.' <input type="file" name="screenshot" class="flUpload" size="20" />'
.'<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();
$num ++;
$i = $num%2;
@@ -964,12 +967,17 @@
unless ($helpform{'screenshot'} eq 'no') {
$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)';
if ($attachmentsize > $max) {
+ my $showsize = $attachmentsize/1048576;
+ $showsize = '('.sprintf("%.2f",$showsize).' MB)';
$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 {
$attachmentpath=&Apache::lonnet::userfileupload('screenshot',undef,'helprequests');
}
More information about the LON-CAPA-cvs
mailing list