diff --git a/application/controllers/lehre/anrechnung/RequestAnrechnung.php b/application/controllers/lehre/anrechnung/RequestAnrechnung.php index bc886a876..bf98e1c59 100644 --- a/application/controllers/lehre/anrechnung/RequestAnrechnung.php +++ b/application/controllers/lehre/anrechnung/RequestAnrechnung.php @@ -119,7 +119,7 @@ class requestAnrechnung extends Auth_Controller // Validate data 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) || diff --git a/application/views/lehre/anrechnung/requestAnrechnung.php b/application/views/lehre/anrechnung/requestAnrechnung.php index e507d3846..bfae61487 100644 --- a/application/views/lehre/anrechnung/requestAnrechnung.php +++ b/application/views/lehre/anrechnung/requestAnrechnung.php @@ -26,7 +26,8 @@ $this->load->view( 'neu', 'maxZeichen', 'errorBestaetigungFehlt', - 'systemfehler' + 'systemfehler', + 'errorDokumentZuGross' ), 'anrechnung' => array( 'deadlineUeberschritten', diff --git a/public/js/lehre/anrechnung/requestAnrechnung.js b/public/js/lehre/anrechnung/requestAnrechnung.js index fa7d02de8..e7128a696 100644 --- a/public/js/lehre/anrechnung/requestAnrechnung.js +++ b/public/js/lehre/anrechnung/requestAnrechnung.js @@ -26,6 +26,12 @@ $(function(){ // Avoid form redirecting automatically 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_JS_DATA_STORAGE_OBJECT.called_path + "/apply", { @@ -161,5 +167,19 @@ var requestAnrechnung = { // Disable all form elements $("#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; + } } } \ No newline at end of file diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 1baffa93b..5c4e4d445 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -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( 'app' => 'core', 'category' => 'ui',