mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-25 16:44:28 +00:00
Adapted system feedback when uploading too large documents
. Added clientside check to avoid uploads > 8MB size . Adapted message returned by server, when max upload size is exceeded
This commit is contained in:
@@ -119,7 +119,7 @@ class requestAnrechnung extends Auth_Controller
|
|||||||
// Validate data
|
// Validate data
|
||||||
if (empty($_FILES['uploadfile']['name']))
|
if (empty($_FILES['uploadfile']['name']))
|
||||||
{
|
{
|
||||||
return $this->outputJsonError($this->p->t('ui', 'errorUploadFehlt'));
|
return $this->outputJsonError($this->p->t('ui', 'errorUploadFehltOderZuGross'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isEmptyString($begruendung_id) ||
|
if (isEmptyString($begruendung_id) ||
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ $this->load->view(
|
|||||||
'neu',
|
'neu',
|
||||||
'maxZeichen',
|
'maxZeichen',
|
||||||
'errorBestaetigungFehlt',
|
'errorBestaetigungFehlt',
|
||||||
'systemfehler'
|
'systemfehler',
|
||||||
|
'errorDokumentZuGross'
|
||||||
),
|
),
|
||||||
'anrechnung' => array(
|
'anrechnung' => array(
|
||||||
'deadlineUeberschritten',
|
'deadlineUeberschritten',
|
||||||
|
|||||||
@@ -26,6 +26,12 @@ $(function(){
|
|||||||
// Avoid form redirecting automatically
|
// Avoid form redirecting automatically
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
var fileInput = $('#requestAnrechnung-uploadfile');
|
||||||
|
if (!requestAnrechnung.fileSizeOk(fileInput, 8000000)) // 8MB in byte
|
||||||
|
{
|
||||||
|
return FHC_DialogLib.alertWarning(FHC_PhrasesLib.t("ui", "errorDokumentZuGross"));
|
||||||
|
}
|
||||||
|
|
||||||
FHC_AjaxClient.ajaxCallPost(
|
FHC_AjaxClient.ajaxCallPost(
|
||||||
FHC_JS_DATA_STORAGE_OBJECT.called_path + "/apply",
|
FHC_JS_DATA_STORAGE_OBJECT.called_path + "/apply",
|
||||||
{
|
{
|
||||||
@@ -161,5 +167,19 @@ var requestAnrechnung = {
|
|||||||
|
|
||||||
// Disable all form elements
|
// Disable all form elements
|
||||||
$("#requestAnrechnung-form :input").prop("disabled", true);
|
$("#requestAnrechnung-form :input").prop("disabled", true);
|
||||||
|
},
|
||||||
|
fileSizeOk: function(fileInput, maxSize){
|
||||||
|
|
||||||
|
if (fileInput.get(0).files.length){
|
||||||
|
|
||||||
|
var fileSize = fileInput.get(0).files[0].size; // in bytes
|
||||||
|
|
||||||
|
if (fileSize > maxSize)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12333,6 +12333,46 @@ array(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'app' => 'core',
|
||||||
|
'category' => 'ui',
|
||||||
|
'phrase' => 'errorDokumentZuGross',
|
||||||
|
'insertvon' => 'system',
|
||||||
|
'phrases' => array(
|
||||||
|
array(
|
||||||
|
'sprache' => 'German',
|
||||||
|
'text' => "Dokument zu groß",
|
||||||
|
'description' => '',
|
||||||
|
'insertvon' => 'system'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'sprache' => 'English',
|
||||||
|
'text' => "Document maximum size exceeded",
|
||||||
|
'description' => '',
|
||||||
|
'insertvon' => 'system'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'app' => 'core',
|
||||||
|
'category' => 'ui',
|
||||||
|
'phrase' => 'errorUploadFehltOderZuGross',
|
||||||
|
'insertvon' => 'system',
|
||||||
|
'phrases' => array(
|
||||||
|
array(
|
||||||
|
'sprache' => 'German',
|
||||||
|
'text' => "Dokument fehlt oder zu groß",
|
||||||
|
'description' => '',
|
||||||
|
'insertvon' => 'system'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'sprache' => 'English',
|
||||||
|
'text' => "Document missing or maximum size exceeded",
|
||||||
|
'description' => '',
|
||||||
|
'insertvon' => 'system'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
array(
|
array(
|
||||||
'app' => 'core',
|
'app' => 'core',
|
||||||
'category' => 'ui',
|
'category' => 'ui',
|
||||||
|
|||||||
Reference in New Issue
Block a user