From 0a4a9c14eade4ed60a4ba37ccf1e303b6de13544 Mon Sep 17 00:00:00 2001 From: Thomas Zilio Date: Fri, 23 Feb 2018 09:49:31 +0100 Subject: [PATCH] Miglioramenti per le email (#9) --- bug.php | 7 ++----- editor.php | 16 ++++++++++++++-- include/top.php | 20 +++++++++++++++++--- mail.php | 11 +++++++++-- modules/emails/edit.php | 40 +++++++++++++++++++++------------------- 5 files changed, 63 insertions(+), 31 deletions(-) diff --git a/bug.php b/bug.php index 0706ab949..ae2384810 100644 --- a/bug.php +++ b/bug.php @@ -3,7 +3,7 @@ include_once __DIR__.'/core.php'; $pageTitle = 'Bug'; -$jscript_modules[] = $js.'/ckeditor/ckeditor.js'; +$jscript_modules[] = App::getPaths()['js'].'/ckeditor/ckeditor.js'; if (filter('op') == 'send') { // Preparazione email @@ -193,10 +193,7 @@ echo ' var firstFocus = 1; CKEDITOR.replace("body", { - toolbar: [ - { name: "document", items: [ "NewPage", "Preview", "-", "Templates" ] }, // Defines toolbar group with name (used to create voice label) and items in 3 subgroups - ["Bold","Italic","Underline","Superscript","-","NumberedList","BulletedList","Outdent","Indent","Blockquote","-","Format",], // Defines toolbar group without name - ] + toolbar: globals.ckeditorToolbar }); CKEDITOR.instances.body.on("key", function() { diff --git a/editor.php b/editor.php index 88f6acb09..eae13b7e1 100755 --- a/editor.php +++ b/editor.php @@ -92,7 +92,7 @@ if (empty($records)) { // Pulsanti di default echo ' -
+
'.tr("Torna all'elenco").' @@ -117,6 +117,15 @@ if (empty($records)) { $("#save").click(function(){ $("#submit").trigger("click"); + });'; + + // Pulsanti dinamici + if (!isMobile()) { + echo ' + $("#pulsanti").affix({ + offset: { + top: 200 + } }); $("#pulsanti").on("affix.bs.affix", function(){ @@ -125,7 +134,10 @@ if (empty($records)) { $("#pulsanti").on("affix-top.bs.affix", function(){ $("#pulsanti").css("width", "100%"); - }); + });'; + } + + echo ' }); diff --git a/include/top.php b/include/top.php index 6bd68714f..fdc6a5c23 100644 --- a/include/top.php +++ b/include/top.php @@ -98,17 +98,31 @@ if (Auth::check()) { echo ' }; globals = { - rootdir: \''.$rootdir.'\', js: \''.$paths['js'].'\', css: \''.$paths['css'].'\', img: \''.$paths['img'].'\', + rootdir: \''.$rootdir.'\', + js: \''.$paths['js'].'\', + css: \''.$paths['css'].'\', + img: \''.$paths['img'].'\', + id_module: \''.$id_module.'\', id_record: \''.$id_record.'\', + aggiornamenti_id: \''.($dbo->isInstalled() ? Modules::get('Aggiornamenti')['id'] : '').'\', + cifre_decimali: '.get_var('Cifre decimali per importi').', - decimals: "'.Translator::getFormatter()->getNumberSeparators()['decimals'].'", thousands: "'.Translator::getFormatter()->getNumberSeparators()['thousands'].'", + + decimals: "'.Translator::getFormatter()->getNumberSeparators()['decimals'].'", + thousands: "'.Translator::getFormatter()->getNumberSeparators()['thousands'].'", + search: search, translations: translations, + locale: \''.$lang.'\', + start_date: \''.Translator::dateToLocale($_SESSION['period_start']).'\', end_date: \''.Translator::dateToLocale($_SESSION['period_end']).'\', - locale: \''.$lang.'\', + + ckeditorToolbar: [ + [ "Bold", "Italic", "Underline", "Superscript", "-", "NumberedList", "BulletedList", "Outdent", "Indent", "Blockquote", "-", "Format"], + ], }; '; } diff --git a/mail.php b/mail.php index 9a9a26c15..0bcd14b40 100644 --- a/mail.php +++ b/mail.php @@ -119,11 +119,18 @@ echo ' emails = JSON.parse(response); $(".destinatari").each(function(){ - $(this).autocomplete({source: emails}); + $(this).autocomplete({ + source: emails, + minLength: 0 + }).focus(function() { + $(this).autocomplete("search", $(this).val()) + });; }); }); - CKEDITOR.replace("body"); + CKEDITOR.replace("body", { + toolbar: globals.ckeditorToolbar + }); }); function send(){ diff --git a/modules/emails/edit.php b/modules/emails/edit.php index 336fd8403..63ae842aa 100644 --- a/modules/emails/edit.php +++ b/modules/emails/edit.php @@ -84,35 +84,35 @@ echo '
0) { - echo ' + if (sizeof($variables) > 0) { + echo '

Puoi utilizzare le seguenti variabili nell\'oggetto e nel corpo della mail:

    '; - foreach ($variables as $variable => $value) { - echo '
  • {'.$variable.'}
  • '; - } + foreach ($variables as $variable => $value) { + echo '
  • {'.$variable.'}
  • '; + } - echo ' + echo '
'; - } else { - echo ' + } else { + echo '
Non sono state definite variabili da utilizzare nel template.
'; - } - ?> + } + ?>
@@ -125,6 +125,8 @@ echo '