Aggiunto input ckeditor

This commit is contained in:
Thomas Zilio 2018-09-07 17:43:52 +02:00
parent 93a1053340
commit c97da69b31
11 changed files with 42 additions and 41 deletions

View File

@ -132,7 +132,7 @@ echo '
<div class="clearfix"></div>
<br>
{[ "type": "textarea", "label": "'.tr('Descrizione del bug').'", "name": "body" ]}
{[ "type": "ckeditor", "label": "'.tr('Descrizione del bug').'", "name": "body" ]}
<!-- PULSANTI -->
<div class="row">
@ -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() == ""){

View File

@ -114,7 +114,7 @@ echo '
<div class="row">
<div class="col-md-12">
{[ "type": "textarea", "label": "'.tr('Contenuto').'", "name": "body", "value": '.json_encode($body).' ]}
{[ "type": "ckeditor", "label": "'.tr('Contenuto').'", "name": "body", "value": '.json_encode($body).' ]}
</div>
</div>';
@ -135,9 +135,6 @@ echo '
</div>
</div>';
echo '
<script src="'.$rootdir.'/assets/dist/js/ckeditor/ckeditor.js"></script>';
echo '
<script>
var emails = [];
@ -165,12 +162,6 @@ echo '
echo '
CKEDITOR.replace("body", {
toolbar: globals.ckeditorToolbar,
language: globals.locale,
scayt_autoStartup: true,
scayt_sLang: globals.full_locale
});
});
function send(){

View File

@ -2,9 +2,6 @@
include_once __DIR__.'/../../core.php';
echo '
<script src="'.$rootdir.'/assets/dist/js/ckeditor/ckeditor.js"></script>';
?>
<form action="" method="post" id="edit-form">
<input type="hidden" name="op" value="update">
@ -79,7 +76,7 @@ echo '
<div class="row">
<div class="col-md-12">
{[ "type": "textarea", "label": "<?php echo tr('Contenuto'); ?>", "name": "body", "value": "$body$" ]}
{[ "type": "ckeditor", "label": "<?php echo tr('Contenuto'); ?>", "name": "body", "value": "$body$" ]}
</div>
</div>
@ -130,15 +127,3 @@ echo '
<a class="btn btn-danger ask" data-backto="record-list">
<i class="fa fa-trash"></i> <?php echo tr('Elimina'); ?>
</a>
<script>
$(document).ready(function(){
CKEDITOR.replace("body", {
toolbar: globals.ckeditorToolbar,
language: globals.locale,
scayt_autoStartup: true,
scayt_sLang: globals.full_locale
});
});
</script>

View File

@ -132,7 +132,7 @@ $_SESSION['superselect']['idanagrafica'] = $record['idanagrafica'];
</div>
<div class="col-md-12">
{[ "type": "textarea", "label": "<?php echo tr('Descrizione'); ?>", "name": "descrizione", "class": "autosize", "value": "$descrizione$", "extra": "rows='10'", "readonly": "<?php echo $record['flag_completato']; ?>" ]}
{[ "type": "ckeditor", "label": "<?php echo tr('Descrizione'); ?>", "name": "descrizione", "class": "autosize", "value": "$descrizione$", "extra": "rows='10'", "readonly": "<?php echo $record['flag_completato']; ?>" ]}
</div>
<div class="col-md-12">

View File

@ -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,

View File

@ -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'];

View File

@ -60,6 +60,7 @@ class HTMLBuilder
'timestamp' => 'HTMLBuilder\Handler\DateHandler',
'date' => 'HTMLBuilder\Handler\DateHandler',
'time' => 'HTMLBuilder\Handler\DateHandler',
'ckeditor' => Handler\CKEditorHandler::class,
],
'instances' => [],
];

View File

@ -0,0 +1,28 @@
<?php
namespace HTMLBuilder\Handler;
/**
* Gestione dell'input di tipo "ckeditor".
*
* @since 2.4.2
*/
class CKEditorHandler implements HandlerInterface
{
public function handle(&$values, &$extras)
{
// Generazione del codice HTML
return '
<textarea |attr|>|value|</textarea>
<script src="'.ROOTDIR.'/assets/dist/js/ckeditor/ckeditor.js"></script>
<script>
CKEDITOR.replace("'.prepareToField($values['id']).'", {
toolbar: globals.ckeditorToolbar,
language: globals.locale,
scayt_autoStartup: true,
scayt_sLang: globals.full_locale
});
</script>';
}
}

View File

@ -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 ?: '-';
}
/**

View File

@ -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

View File

@ -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';