Upload immagini per ckeditor
This commit is contained in:
parent
d17fb1baf2
commit
513bfea92c
48
actions.php
48
actions.php
|
@ -53,6 +53,54 @@ if (filter('op') == 'aggiungi-allegato' || filter('op') == 'rimuovi-allegato') {
|
|||
|
||||
// Gestione delle operazioni
|
||||
else {
|
||||
|
||||
//UPLOAD PER CKEDITOR
|
||||
if (filter('op') == 'aggiungi-allegato' && !empty($_FILES) && !empty($_FILES['upload']['name'])) {
|
||||
|
||||
$CKEditor = $_GET['CKEditor'];
|
||||
$funcNum = $_GET['CKEditorFuncNum'];
|
||||
|
||||
|
||||
$allowed_extension = array(
|
||||
"png","jpg","jpeg"
|
||||
);
|
||||
|
||||
// Get image file extension
|
||||
$file_extension = pathinfo($_FILES["upload"]["name"], PATHINFO_EXTENSION);
|
||||
|
||||
if(in_array(strtolower($file_extension),$allowed_extension)){
|
||||
|
||||
$upload = Uploads::upload($_FILES['upload'], [
|
||||
'name' => filter('nome_allegato'),
|
||||
'category' => filter('categoria'),
|
||||
'id_module' => Modules::get('Gestione documentale')['id'],
|
||||
'id_record' => $id_record,
|
||||
]);
|
||||
|
||||
// Creazione file fisico
|
||||
if (!empty($upload)) {
|
||||
flash()->info(tr('File caricato correttamente!'));
|
||||
|
||||
$id_allegato = $dbo->lastInsertedID();
|
||||
$upload = Upload::find($id_allegato);
|
||||
|
||||
echo '<script>window.parent.CKEDITOR.tools.callFunction('.$funcNum.', "'.$baseurl.'/'.$upload->filepath.'", "'.$message.'")</script>';
|
||||
|
||||
} else {
|
||||
flash()->error(tr('Errore durante il caricamento del file!'));
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
//flash()->error(tr('Estensione non permessa!'));
|
||||
//toastr["error"]("'.tr('Estensione non permessa').'");
|
||||
echo '<script> alert("'.tr('Estensione non permessa').'"); </script>';
|
||||
|
||||
}
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
// UPLOAD
|
||||
if (filter('op') == 'aggiungi-allegato' && !empty($_FILES) && !empty($_FILES['file']['name'])) {
|
||||
$upload = Uploads::upload($_FILES['file'], [
|
||||
|
|
|
@ -94,11 +94,14 @@ function initCKEditor(input) {
|
|||
// Avvio di CKEditor
|
||||
CKEDITOR.replace(name, {
|
||||
toolbar: (input.hasAttribute('use_full_ckeditor')) ? globals.ckeditorToolbar_Full : globals.ckeditorToolbar,
|
||||
language: (globals.locale) ? globals.locale : 'it',
|
||||
language: globals.locale,
|
||||
scayt_autoStartup: true,
|
||||
scayt_sLang: (globals.full_locale) ? globals.full_locale : 'it_IT',
|
||||
scayt_sLang: globals.full_locale,
|
||||
scayt_disableOptionsStorage: 'lang',
|
||||
disableNativeSpellChecker: false,
|
||||
filebrowserUploadUrl: globals.rootdir+'/ckeditor_fileupload/ajaxfile.php?type=file',
|
||||
filebrowserImageUploadUrl: globals.rootdir+"/actions.php?type=image&op=aggiungi-allegato&id_module="+globals.id_module+"&id_plugin="+globals.id_plugin+"&id_record="+globals.id_record,
|
||||
filebrowserUploadMethod: 'form',
|
||||
fullPage: (input.hasAttribute('use_full_ckeditor')) ? true : false,
|
||||
allowedContent: (input.hasAttribute('use_full_ckeditor')) ? true : false,
|
||||
extraPlugins: 'scayt,textwatcher,autocomplete,textmatch,emoji',
|
||||
|
|
|
@ -294,12 +294,7 @@ function ckeditor() {
|
|||
])
|
||||
.pipe(gulp.dest(config.production + '/' + config.paths.js + '/ckeditor/plugins'));
|
||||
|
||||
const extra = gulp.src([
|
||||
config.nodeDirectory + '/ckeditor-image-to-base/**/*.{js,json,css,png,gif,html}',
|
||||
])
|
||||
.pipe(gulp.dest(config.production + '/' + config.paths.js + '/ckeditor/plugins/ckeditor-image-to-base64'));
|
||||
|
||||
return merge(ckeditor, plugins, extra);
|
||||
return merge(ckeditor, plugins);
|
||||
}
|
||||
|
||||
function colorpicker() {
|
||||
|
|
|
@ -26,6 +26,8 @@ $user = Auth::user();
|
|||
|
||||
$pageTitle = !empty($pageTitle) ? $pageTitle : $structure->title;
|
||||
|
||||
$lang = (empty($lang) || $lang == '|lang|' ) ? 'it_IT' : $lang;
|
||||
|
||||
$messages = flash()->getMessages();
|
||||
|
||||
echo '<!DOCTYPE html>
|
||||
|
|
Loading…
Reference in New Issue