Miglioramenti per le email (#9)

This commit is contained in:
Thomas Zilio 2018-02-23 09:49:31 +01:00
parent a045fa8250
commit 0a4a9c14ea
5 changed files with 63 additions and 31 deletions

View File

@ -3,7 +3,7 @@
include_once __DIR__.'/core.php'; include_once __DIR__.'/core.php';
$pageTitle = 'Bug'; $pageTitle = 'Bug';
$jscript_modules[] = $js.'/ckeditor/ckeditor.js'; $jscript_modules[] = App::getPaths()['js'].'/ckeditor/ckeditor.js';
if (filter('op') == 'send') { if (filter('op') == 'send') {
// Preparazione email // Preparazione email
@ -193,10 +193,7 @@ echo '
var firstFocus = 1; var firstFocus = 1;
CKEDITOR.replace("body", { CKEDITOR.replace("body", {
toolbar: [ toolbar: globals.ckeditorToolbar
{ 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
]
}); });
CKEDITOR.instances.body.on("key", function() { CKEDITOR.instances.body.on("key", function() {

View File

@ -92,7 +92,7 @@ if (empty($records)) {
// Pulsanti di default // Pulsanti di default
echo ' echo '
<div id="pulsanti" data-spy="affix" data-offset-top="200"> <div id="pulsanti">
<a class="btn btn-warning" href="'.ROOTDIR.'/controller.php?id_module='.$id_module.'"> <a class="btn btn-warning" href="'.ROOTDIR.'/controller.php?id_module='.$id_module.'">
<i class="fa fa-chevron-left"></i> '.tr("Torna all'elenco").' <i class="fa fa-chevron-left"></i> '.tr("Torna all'elenco").'
</a> </a>
@ -117,6 +117,15 @@ if (empty($records)) {
$("#save").click(function(){ $("#save").click(function(){
$("#submit").trigger("click"); $("#submit").trigger("click");
});';
// Pulsanti dinamici
if (!isMobile()) {
echo '
$("#pulsanti").affix({
offset: {
top: 200
}
}); });
$("#pulsanti").on("affix.bs.affix", function(){ $("#pulsanti").on("affix.bs.affix", function(){
@ -125,7 +134,10 @@ if (empty($records)) {
$("#pulsanti").on("affix-top.bs.affix", function(){ $("#pulsanti").on("affix-top.bs.affix", function(){
$("#pulsanti").css("width", "100%"); $("#pulsanti").css("width", "100%");
}); });';
}
echo '
}); });
</script> </script>

View File

@ -98,17 +98,31 @@ if (Auth::check()) {
echo ' echo '
}; };
globals = { 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_module: \''.$id_module.'\',
id_record: \''.$id_record.'\', id_record: \''.$id_record.'\',
aggiornamenti_id: \''.($dbo->isInstalled() ? Modules::get('Aggiornamenti')['id'] : '').'\', aggiornamenti_id: \''.($dbo->isInstalled() ? Modules::get('Aggiornamenti')['id'] : '').'\',
cifre_decimali: '.get_var('Cifre decimali per importi').', 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, search: search,
translations: translations, translations: translations,
locale: \''.$lang.'\',
start_date: \''.Translator::dateToLocale($_SESSION['period_start']).'\', start_date: \''.Translator::dateToLocale($_SESSION['period_start']).'\',
end_date: \''.Translator::dateToLocale($_SESSION['period_end']).'\', end_date: \''.Translator::dateToLocale($_SESSION['period_end']).'\',
locale: \''.$lang.'\',
ckeditorToolbar: [
[ "Bold", "Italic", "Underline", "Superscript", "-", "NumberedList", "BulletedList", "Outdent", "Indent", "Blockquote", "-", "Format"],
],
}; };
</script>'; </script>';
} }

View File

@ -119,11 +119,18 @@ echo '
emails = JSON.parse(response); emails = JSON.parse(response);
$(".destinatari").each(function(){ $(".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(){ function send(){

View File

@ -88,9 +88,9 @@ echo '
$module_dir = DOCROOT.'/modules/'.Modules::get($records[0]['id_module'])['directory']; $module_dir = DOCROOT.'/modules/'.Modules::get($records[0]['id_module'])['directory'];
$variables = []; $variables = [];
if (file_exists($module_dir.'/custom/variables.php') ) { if (file_exists($module_dir.'/custom/variables.php')) {
$variables = include $module_dir.'/custom/variables.php'; $variables = include $module_dir.'/custom/variables.php';
} elseif (file_exists($module_dir.'/variables.php') ) { } elseif (file_exists($module_dir.'/variables.php')) {
$variables = include $module_dir.'/variables.php'; $variables = include $module_dir.'/variables.php';
} }
@ -125,6 +125,8 @@ echo '
<script> <script>
$(document).ready(function(){ $(document).ready(function(){
CKEDITOR.replace("body"); CKEDITOR.replace("body", {
toolbar: globals.ckeditorToolbar
});
}); });
</script> </script>