From 6f25f7c2cb28c3b035ae032b1355a30895cdbac9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 16 Feb 2021 11:43:26 +0100 Subject: [PATCH] Clean code --- htdocs/core/class/html.form.class.php | 26 ++++++++++---------------- htdocs/core/lib/functions.lib.php | 2 +- htdocs/ecm/file_card.php | 10 ++++++---- htdocs/langs/en_US/main.lang | 8 +++++--- 4 files changed, 22 insertions(+), 24 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 89593335ed9..3d90762abd4 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4365,14 +4365,11 @@ class Form $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : ''); $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : ''); - if ($input['type'] == 'text') - { + if ($input['type'] == 'text') { $more .= '
'.$input['label'].'
'."\n"; - } elseif ($input['type'] == 'password') - { + } elseif ($input['type'] == 'password') { $more .= '
'.$input['label'].'
'."\n"; - } elseif ($input['type'] == 'select') - { + } elseif ($input['type'] == 'select') { if (empty($morecss)) { $morecss = 'minwidth100'; } @@ -4380,8 +4377,7 @@ class Form if (!empty($input['label'])) $more .= $input['label'].'
'; $more .= $this->selectarray($input['name'], $input['values'], $input['default'], 1, 0, 0, $moreattr, 0, 0, 0, '', $morecss); $more .= '
'."\n"; - } elseif ($input['type'] == 'checkbox') - { + } elseif ($input['type'] == 'checkbox') { $more .= '
'; $more .= '
'.$input['label'].'
'; $more .= ' $selval) { @@ -4406,8 +4401,7 @@ class Form $more .= '
'."\n"; $i++; } - } elseif ($input['type'] == 'date') - { + } elseif ($input['type'] == 'date') { $more .= '
'.$input['label'].'
'; $more .= '
'; $more .= $this->selectDate($input['value'], $input['name'], 0, 0, 0, '', 1, 0); @@ -4417,17 +4411,17 @@ class Form $formquestion[] = array('name'=>$input['name'].'year'); $formquestion[] = array('name'=>$input['name'].'hour'); $formquestion[] = array('name'=>$input['name'].'min'); - } elseif ($input['type'] == 'other') - { + } elseif ($input['type'] == 'other') { $more .= '
'; if (!empty($input['label'])) $more .= $input['label'].'
'; $more .= $input['value']; $more .= '
'."\n"; - } elseif ($input['type'] == 'onecolumn') - { + } elseif ($input['type'] == 'onecolumn') { $moreonecolumn .= '
'; $moreonecolumn .= $input['value']; $moreonecolumn .= '
'."\n"; + } elseif ($input['type'] == 'hidden') { + // Do nothing more, already added by a previous loop } else { $more .= 'Error type '.$input['type'].' for the confirm box is not a supported type'; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index fe438b7ebe4..e990f80361e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8206,7 +8206,7 @@ function showDirectDownloadLink($object) if ($url) { - $out .= img_picto('', 'globe').' '.$langs->trans("DirectDownloadLink").'
'; + $out .= img_picto($langs->trans("PublicDownloadLinkdesc"), 'globe').' '.$langs->trans("DirectDownloadLink").'
'; $out .= ''; $out .= ajax_autoselect("directdownloadlink", 0); } diff --git a/htdocs/ecm/file_card.php b/htdocs/ecm/file_card.php index b1c7eb0ec28..93885c2843a 100644 --- a/htdocs/ecm/file_card.php +++ b/htdocs/ecm/file_card.php @@ -290,7 +290,7 @@ print '
'; print '
'; print ''; -print ''; /*print ''; // Link for direct external download print '
'.$langs->trans("ECMCreationDate").''; +print '
'.$langs->trans("ECMCreationDate").''; print dol_print_date(dol_filemtime($fullpath), 'dayhour'); print '
'.$langs->trans("ECMDirectoryForFiles").''; @@ -321,7 +321,9 @@ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domai //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current // Link for internal download -print '
'.$langs->trans("DirectDownloadInternalLink").''; +print '
'; +print $form->textwithpicto($langs->trans("DirectDownloadInternalLink"), $langs->trans("PrivateDownloadLinkDesc")); +print ''; $modulepart = 'ecm'; $forcedownload = 1; $rellink = '/document.php?modulepart='.$modulepart; @@ -347,9 +349,9 @@ print '
'; if ($action != 'edit') { - print $langs->trans("DirectDownloadLink"); + print $form->textwithpicto($langs->trans("DirectDownloadLink"), $langs->trans("PublicDownloadLinkDesc")); } else { - print $langs->trans("FileSharedViaALink"); + print $form->textwithpicto($langs->trans("FileSharedViaALink"), $langs->trans("PublicDownloadLinkDesc")); } print ''; if (!empty($object->share)) { diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index a5cd750e3d6..f7c55df211f 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -899,8 +899,10 @@ ViewAccountList=View ledger ViewSubAccountList=View subaccount ledger RemoveString=Remove string '%s' SomeTranslationAreUncomplete=Some of the languages offered may be only partially translated or may contain errors. Please help to correct your language by registering at https://transifex.com/projects/p/dolibarr/ to add your improvements. -DirectDownloadLink=Direct download link (public/external) -DirectDownloadInternalLink=Direct download link (need to be logged and need permissions) +DirectDownloadLink=Public download link +PublicDownloadLinkDesc=Only the link is required to download the file +DirectDownloadInternalLink=Private download link +PrivateDownloadLinkDesc=You need to be logged and you need permissions to view or download the file Download=Download DownloadDocument=Download document ActualizeCurrency=Update currency rate @@ -1049,7 +1051,7 @@ KeyboardShortcut=Keyboard shortcut AssignedTo=Assigned to Deletedraft=Delete draft ConfirmMassDraftDeletion=Draft mass delete confirmation -FileSharedViaALink=File shared via a link +FileSharedViaALink=File shared with a public link SelectAThirdPartyFirst=Select a third party first... YouAreCurrentlyInSandboxMode=You are currently in the %s "sandbox" mode Inventory=Inventory