From 2b60df8ac5e48a48c53da2f4cd52703cdf841402 Mon Sep 17 00:00:00 2001 From: Luca <30728163+lucasalva87@users.noreply.github.com> Date: Tue, 3 Mar 2020 22:59:18 +0100 Subject: [PATCH] Fix minori --- include/init/init.php | 16 +++++++++++----- src/HTMLBuilder/Manager/FileManager.php | 15 ++++++++++++--- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/include/init/init.php b/include/init/init.php index f8e0a3c3b..16f7321b3 100755 --- a/include/init/init.php +++ b/include/init/init.php @@ -195,20 +195,26 @@ if (!$has_settings) {

'.tr('Impostazioni di base').'

-
-
'; - +
'; + $i = 0; foreach ($settings as $setting => $required) { if (empty(setting($setting))) { + if ($i%2==0 or $i==0) + echo '
'; + echo '
'.Settings::input($setting, $required).'
'; + $i++; + if ($i%2==0 or $i == sizeof($settings)) + echo '
'; + + } } - echo '
-
+ echo '
'; } diff --git a/src/HTMLBuilder/Manager/FileManager.php b/src/HTMLBuilder/Manager/FileManager.php index 1e1d1aab0..2d81175cd 100755 --- a/src/HTMLBuilder/Manager/FileManager.php +++ b/src/HTMLBuilder/Manager/FileManager.php @@ -251,6 +251,16 @@ $(document).ready(function() { }); }); + function getFilenameAndExtension(pathfilename){ + + var filenameextension = pathfilename.replace(/^.*[\\\/]/, \'\'); + var filename = filenameextension.substring(0, filenameextension.lastIndexOf(\'.\')); + var ext = filenameextension.split(\'.\').pop(); + + return [filename, ext]; + + } + // Autocompletamento nome $("#'.$attachment_id.' #blob").change(function(){ var nome = $("#'.$attachment_id.' #nome_allegato"); @@ -258,10 +268,9 @@ $(document).ready(function() { if (!nome.val()) { var fullPath = $(this).val(); - var startIndex = Math.max(fullPath.lastIndexOf("\\\\"), fullPath.lastIndexOf("/")) + 1; - var filename = fullPath.substring(startIndex); + var filename = getFilenameAndExtension(fullPath); - nome.val(filename); + nome.val(filename[0]); } });