diff --git a/lang/1.php b/lang/1.php index b766d4520..8f5348dba 100644 --- a/lang/1.php +++ b/lang/1.php @@ -2026,6 +2026,7 @@ $lang = array ( "srv_alert_show_missing_97" => "Prikaži opcijo \"Neustrezno\" ob opozorilu", "srv_alert_upload_size" => "Naložena datoteka je prevelika! Največja dovoljena velikost je 16 MB.", "srv_alert_upload_ext" => "Naložen tip datoteke ni dovoljen!", + "srv_alert_upload_remove" => "Odstrani datoteko", "srv_dostop" => "Anketo lahko ureja avtor in vsi", "srv_izpolnjujejo" => "Anketo lahko izpolnjujejo", "srv_dostop_users" => "Uporabniki, ki lahko urejajo anketo", diff --git a/lang/2.php b/lang/2.php index 5c77ee206..7ab1585d3 100644 --- a/lang/2.php +++ b/lang/2.php @@ -2013,6 +2013,7 @@ $lang = array ( "srv_alert_show_missing_97" => "Show option \"Invalid\" on alert", "srv_alert_upload_size" => "Uploaded file is too large! Maximum file size is 16 MB.", "srv_alert_upload_ext" => "Uploaded file type is not allowed!", + "srv_alert_upload_remove" => "Remove file", "srv_dostop" => "Survey can be edited by", "srv_izpolnjujejo" => "Survey can be answered by", "srv_dostop_users" => "Users who can edit survey", diff --git a/main/survey/app/Controllers/Vprasanja/TextController.php b/main/survey/app/Controllers/Vprasanja/TextController.php index ca4b26600..46bae6283 100644 --- a/main/survey/app/Controllers/Vprasanja/TextController.php +++ b/main/survey/app/Controllers/Vprasanja/TextController.php @@ -780,13 +780,22 @@ class TextController extends Controller type="file" id="spremenljivka_' . $spremenljivka . '_vrednost_' . $i . '" ' . (!$missing ? '' : ' disabled') . ' - onChange="checkUpload(this);" + class="pointer" + onChange="checkUpload(this, \''.$spremenljivka.'_vrednost_'.$i.'\');" >'; + + // Remove file button + echo ''; } //Fotografiranje elseif ($row['upload'] == 2) { - //$imginput = ' '; $inpname = 'vrednost_' . $spremenljivka . '_kos_' . $row1['id']; $inpid = 'spremenljivka_' . $spremenljivka . '_vrednost_' . $i; diff --git a/main/survey/js/script.js b/main/survey/js/script.js index 211ffce2d..1e9dfbda4 100644 --- a/main/survey/js/script.js +++ b/main/survey/js/script.js @@ -1896,7 +1896,7 @@ function gridRepeatHeader(repeat_every, spr_id){ // Preverimo upload file omejitve -function checkUpload(upload){ +function checkUpload(upload, id){ // Max file size (mb) let maxSize = 16; @@ -1908,6 +1908,8 @@ function checkUpload(upload){ if(fileSize > maxSize){ $(upload).val(null); alert(lang["srv_alert_upload_size"]); + + return; } @@ -1925,5 +1927,15 @@ function checkUpload(upload){ if(!extAllowed.includes(fileExt)){ $(upload).val(null); alert(lang["srv_alert_upload_ext"]); + + return; } + + + // Add/remove "remove file" button + $('#remove_file_' + id).show(); +} + +function removeUpload(id){ + $('#' + id).val(null); } diff --git a/public/css/main.css b/public/css/main.css index 399e5c1a5..57ccda6cf 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -5257,6 +5257,19 @@ input[type=radio]:checked + span.enka-checkbox-radio:before { content: ""; } +/* File upload */ +.remove_file { + margin: 10px 0 0 0; + width: 150px; + color: #1e88e5; + text-decoration: none; + cursor: pointer; +} +.remove_file:hover { + color: #ffa608; + text-decoration: none; +} + /******* CUSTOM IKONE ZA SLIKOVNI TIP **********/ input[type=radio] + span.enka-custom-radio { font-size: 20px; @@ -5483,29 +5496,6 @@ span.enka-custom-radio:before, color: #ffa608; } -div.qtip-content { - font-size: 9px; -} - -.qtip-wrapper, .qtip-contentWrapper { - border: 0 !important; -} - -.qtip-borderTop, .qtip-borderBottom { - display: none !important; -} - -.qtip-title { - color: #0C377A !important; - background-color: #D8DFEA !important; -} - -.qtip-content { - padding: 12px 9px !important; - background-color: #EFF2F7 !important; - border: 1px #D8DFEA solid; -} - #cookie_alert, #test_alert { display: none; position: fixed; diff --git a/resources/sass/main/main/input.scss b/resources/sass/main/main/input.scss index 340c199d5..4e7542e07 100644 --- a/resources/sass/main/main/input.scss +++ b/resources/sass/main/main/input.scss @@ -95,6 +95,21 @@ input[type="radio"]:checked + span.enka-checkbox-radio:before { } +/* File upload */ +.remove_file{ + margin: 10px 0 0 0; + width: 150px; + + color: #1e88e5; + text-decoration: none; + cursor: pointer; + + &:hover { + color: #ffa608; + text-decoration: none; + } +} + /******* CUSTOM IKONE ZA SLIKOVNI TIP **********/ input[type="radio"] + span.enka-custom-radio{