From c97da69b315164c64151e2adbdf78a00aa85b206 Mon Sep 17 00:00:00 2001 From: Thomas Zilio Date: Fri, 7 Sep 2018 17:43:52 +0200 Subject: [PATCH] Aggiunto input ckeditor --- bug.php | 9 +----- mail.php | 11 +------- modules/emails/edit.php | 17 +---------- modules/interventi/edit.php | 2 +- modules/interventi/src/Articolo.php | 2 +- .../pianficazione.php | 2 +- src/HTMLBuilder/HTMLBuilder.php | 1 + src/HTMLBuilder/Handler/CKEditorHandler.php | 28 +++++++++++++++++++ src/Models/Module.php | 4 +-- src/Settings.php | 4 +-- update/2_4_2.sql | 3 ++ 11 files changed, 42 insertions(+), 41 deletions(-) create mode 100644 src/HTMLBuilder/Handler/CKEditorHandler.php diff --git a/bug.php b/bug.php index c5c344c30..41ec0537f 100644 --- a/bug.php +++ b/bug.php @@ -132,7 +132,7 @@ echo '

- {[ "type": "textarea", "label": "'.tr('Descrizione del bug').'", "name": "body" ]} + {[ "type": "ckeditor", "label": "'.tr('Descrizione del bug').'", "name": "body" ]}
@@ -159,13 +159,6 @@ echo ' var firstFocus = 1; - CKEDITOR.replace("body", { - toolbar: globals.ckeditorToolbar, - language: globals.locale, - scayt_autoStartup: true, - scayt_sLang: globals.full_locale - }); - CKEDITOR.instances.body.on("key", function() { setTimeout(function(){ if(CKEDITOR.instances.body.getData() == ""){ diff --git a/mail.php b/mail.php index 915cd6897..f42526ec0 100644 --- a/mail.php +++ b/mail.php @@ -114,7 +114,7 @@ echo '
- {[ "type": "textarea", "label": "'.tr('Contenuto').'", "name": "body", "value": '.json_encode($body).' ]} + {[ "type": "ckeditor", "label": "'.tr('Contenuto').'", "name": "body", "value": '.json_encode($body).' ]}
'; @@ -135,9 +135,6 @@ echo '
'; -echo ' -'; - echo ' '; - ?>
@@ -79,7 +76,7 @@ echo '
- {[ "type": "textarea", "label": "", "name": "body", "value": "$body$" ]} + {[ "type": "ckeditor", "label": "", "name": "body", "value": "$body$" ]}
@@ -130,15 +127,3 @@ echo ' - - diff --git a/modules/interventi/edit.php b/modules/interventi/edit.php index 3ba218a1d..a7105fd4c 100644 --- a/modules/interventi/edit.php +++ b/modules/interventi/edit.php @@ -132,7 +132,7 @@ $_SESSION['superselect']['idanagrafica'] = $record['idanagrafica'];
- {[ "type": "textarea", "label": "", "name": "descrizione", "class": "autosize", "value": "$descrizione$", "extra": "rows='10'", "readonly": "" ]} + {[ "type": "ckeditor", "label": "", "name": "descrizione", "class": "autosize", "value": "$descrizione$", "extra": "rows='10'", "readonly": "" ]}
diff --git a/modules/interventi/src/Articolo.php b/modules/interventi/src/Articolo.php index 0bb47707b..b4c7a866a 100644 --- a/modules/interventi/src/Articolo.php +++ b/modules/interventi/src/Articolo.php @@ -54,7 +54,7 @@ class Articolo extends Model ':id_intervento' => $intervento->id, ])['data']; - $data = $data ?? $intervento->data_richiesta; + $data = $data ?: $intervento->data_richiesta; $descrizione = ($qta < 0) ? tr('Ripristino articolo da intervento _NUM_', [ '_NUM_' => $numero, diff --git a/plugins/pianificazione_interventi/pianficazione.php b/plugins/pianificazione_interventi/pianficazione.php index 365774f52..c1fd043f2 100644 --- a/plugins/pianificazione_interventi/pianficazione.php +++ b/plugins/pianificazione_interventi/pianficazione.php @@ -30,7 +30,7 @@ if (count($id_impianti) == 1) { $record = $dbo->fetchOne('SELECT *, (SELECT descrizione FROM in_tipiintervento WHERE idtipointervento=co_promemoria.idtipointervento) AS tipointervento, (SELECT tempo_standard FROM in_tipiintervento WHERE idtipointervento = co_promemoria.idtipointervento) AS tempo_standard FROM co_promemoria WHERE id = :id', [ ':id' => $id_record, ]); -$data_richiesta = $record['data_richiesta'] ?? date('Y-m-d'); +$data_richiesta = $record['data_richiesta'] ?: date('Y-m-d'); $id_sede = $record['idsede']; $tempo_standard = $record['tempo_standard']; $idtipointervento = $record['idtipointervento']; diff --git a/src/HTMLBuilder/HTMLBuilder.php b/src/HTMLBuilder/HTMLBuilder.php index 2539469ec..c72e00600 100644 --- a/src/HTMLBuilder/HTMLBuilder.php +++ b/src/HTMLBuilder/HTMLBuilder.php @@ -60,6 +60,7 @@ class HTMLBuilder 'timestamp' => 'HTMLBuilder\Handler\DateHandler', 'date' => 'HTMLBuilder\Handler\DateHandler', 'time' => 'HTMLBuilder\Handler\DateHandler', + 'ckeditor' => Handler\CKEditorHandler::class, ], 'instances' => [], ]; diff --git a/src/HTMLBuilder/Handler/CKEditorHandler.php b/src/HTMLBuilder/Handler/CKEditorHandler.php new file mode 100644 index 000000000..427280d43 --- /dev/null +++ b/src/HTMLBuilder/Handler/CKEditorHandler.php @@ -0,0 +1,28 @@ +|value| + + '; + } +} + diff --git a/src/Models/Module.php b/src/Models/Module.php index da41e1e3a..a533c0e12 100644 --- a/src/Models/Module.php +++ b/src/Models/Module.php @@ -53,11 +53,11 @@ class Module extends Model $group = Auth::user()->group->id; - $pivot = $this->pivot ?? $this->groups->first(function ($item) use ($group) { + $pivot = $this->pivot ?: $this->groups->first(function ($item) use ($group) { return $item->id == $group; })->pivot; - return $pivot->permessi ?? '-'; + return $pivot->permessi ?: '-'; } /** diff --git a/src/Settings.php b/src/Settings.php index 93276a7b3..f60010859 100644 --- a/src/Settings.php +++ b/src/Settings.php @@ -160,9 +160,9 @@ class Settings } // Textarea - elseif ($setting->tipo == 'textarea') { + elseif ($setting->tipo == 'textarea' || $setting->tipo == 'ckeditor') { $result = ' - {[ "type": "textarea", "label": "'.$setting->nome.'", "name": "setting['.$setting->id.']", "value": '.json_encode($setting->valore).', "required": "'.intval($required).'" ]}'; + {[ "type": "'.$setting->tipo.'", "label": "'.$setting->nome.'", "name": "setting['.$setting->id.']", "value": '.json_encode($setting->valore).', "required": "'.intval($required).'" ]}'; } // Campo di testo diff --git a/update/2_4_2.sql b/update/2_4_2.sql index eae2f8a62..8cf4fbc10 100644 --- a/update/2_4_2.sql +++ b/update/2_4_2.sql @@ -290,3 +290,6 @@ UPDATE `zz_plugins` SET `script` = '', `options` = ' { "main_query": [ { "type": ALTER TABLE `in_interventi` ADD `id_preventivo` int(11), ADD FOREIGN KEY (`id_preventivo`) REFERENCES `co_preventivi`(`id`) ON DELETE CASCADE, ADD `id_contratto` int(11), ADD FOREIGN KEY (`id_contratto`) REFERENCES `co_contratti`(`id`) ON DELETE CASCADE; UPDATE `in_interventi` SET `id_preventivo` = (SELECT `idpreventivo` FROM `co_preventivi_interventi` WHERE `co_preventivi_interventi`.`idintervento` = `in_interventi`.`id` LIMIT 1); DROP TABLE `co_preventivi_interventi`; + +-- Aggiunto input CKEditor automatico +UPDATE `zz_settings` SET `tipo` = 'ckeditor' WHERE `nome` = 'Dicitura fissa fattura';