mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-17 20:10:50 +01:00
Aggiunta modifica dati degli allegati
Correzione delle azioni previste dal file actions.php per rendere la logica più uniforme.
This commit is contained in:
parent
ed5a3d4618
commit
a0bad7a6af
42
actions.php
42
actions.php
@ -21,6 +21,7 @@ include_once __DIR__.'/core.php';
|
|||||||
|
|
||||||
use Models\Note;
|
use Models\Note;
|
||||||
use Models\OperationLog;
|
use Models\OperationLog;
|
||||||
|
use Models\Upload;
|
||||||
use Modules\Checklists\Check;
|
use Modules\Checklists\Check;
|
||||||
use Modules\Checklists\Checklist;
|
use Modules\Checklists\Checklist;
|
||||||
use Modules\Emails\Template;
|
use Modules\Emails\Template;
|
||||||
@ -35,7 +36,7 @@ $upload_dir = base_dir().'/'.Uploads::getDirectory($id_module, $id_plugin);
|
|||||||
$database->beginTransaction();
|
$database->beginTransaction();
|
||||||
|
|
||||||
// Upload allegati e rimozione
|
// Upload allegati e rimozione
|
||||||
if (filter('op') == 'link_file' || filter('op') == 'unlink_file') {
|
if (filter('op') == 'aggiungi-allegato' || filter('op') == 'rimuovi-allegato') {
|
||||||
// Controllo sui permessi di scrittura per il modulo
|
// Controllo sui permessi di scrittura per il modulo
|
||||||
if (Modules::getPermission($id_module) != 'rw') {
|
if (Modules::getPermission($id_module) != 'rw') {
|
||||||
flash()->error(tr('Non hai permessi di scrittura per il modulo _MODULE_', [
|
flash()->error(tr('Non hai permessi di scrittura per il modulo _MODULE_', [
|
||||||
@ -53,7 +54,7 @@ if (filter('op') == 'link_file' || filter('op') == 'unlink_file') {
|
|||||||
// Gestione delle operazioni
|
// Gestione delle operazioni
|
||||||
else {
|
else {
|
||||||
// UPLOAD
|
// UPLOAD
|
||||||
if (filter('op') == 'link_file' && !empty($_FILES) && !empty($_FILES['file']['name'])) {
|
if (filter('op') == 'aggiungi-allegato' && !empty($_FILES) && !empty($_FILES['file']['name'])) {
|
||||||
$upload = Uploads::upload($_FILES['file'], [
|
$upload = Uploads::upload($_FILES['file'], [
|
||||||
'name' => filter('nome_allegato'),
|
'name' => filter('nome_allegato'),
|
||||||
'category' => filter('categoria'),
|
'category' => filter('categoria'),
|
||||||
@ -71,7 +72,7 @@ if (filter('op') == 'link_file' || filter('op') == 'unlink_file') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DELETE
|
// DELETE
|
||||||
elseif (filter('op') == 'unlink_file' && filter('filename') !== null) {
|
elseif (filter('op') == 'rimuovi-allegato' && filter('filename') !== null) {
|
||||||
$name = Uploads::delete(filter('filename'), [
|
$name = Uploads::delete(filter('filename'), [
|
||||||
'id_module' => $id_module,
|
'id_module' => $id_module,
|
||||||
'id_plugin' => $id_plugin,
|
'id_plugin' => $id_plugin,
|
||||||
@ -92,14 +93,29 @@ if (filter('op') == 'link_file' || filter('op') == 'unlink_file') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Download allegati
|
// Download allegati
|
||||||
elseif (filter('op') == 'download_file') {
|
elseif (filter('op') == 'download-allegato') {
|
||||||
$rs = $dbo->fetchArray('SELECT * FROM zz_files WHERE id_module='.prepare($id_module).' AND id='.prepare(filter('id')).' AND filename='.prepare(filter('filename')));
|
$rs = $dbo->fetchArray('SELECT * FROM zz_files WHERE id_module='.prepare($id_module).' AND id='.prepare(filter('id')).' AND filename='.prepare(filter('filename')));
|
||||||
|
|
||||||
download($upload_dir.'/'.$rs[0]['filename'], $rs[0]['original']);
|
download($upload_dir.'/'.$rs[0]['filename'], $rs[0]['original']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
elseif (filter('op') == 'visualizza-modifica-allegato') {
|
||||||
|
include_once base_dir().'/include/modifica_allegato.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Modifica dati di un allegato
|
||||||
|
elseif (filter('op') == 'modifica-allegato') {
|
||||||
|
$id_allegato = filter('id_allegato');
|
||||||
|
$allegato = Upload::find($id_allegato);
|
||||||
|
|
||||||
|
$allegato->name = post('nome_allegato');
|
||||||
|
$allegato->category = post('categoria_allegato');
|
||||||
|
|
||||||
|
$allegato->save();
|
||||||
|
}
|
||||||
|
|
||||||
// Modifica nome della categoria degli allegati
|
// Modifica nome della categoria degli allegati
|
||||||
elseif (filter('op') == 'upload_category') {
|
elseif (filter('op') == 'modifica-categoria-allegato') {
|
||||||
$category = post('category');
|
$category = post('category');
|
||||||
$name = post('name');
|
$name = post('name');
|
||||||
|
|
||||||
@ -130,7 +146,7 @@ elseif (filter('op') == 'validate') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Aggiunta nota interna
|
// Aggiunta nota interna
|
||||||
elseif (filter('op') == 'add_nota') {
|
elseif (filter('op') == 'aggiungi-nota') {
|
||||||
$contenuto = post('contenuto');
|
$contenuto = post('contenuto');
|
||||||
$data_notifica = post('data_notifica') ?: null;
|
$data_notifica = post('data_notifica') ?: null;
|
||||||
|
|
||||||
@ -140,7 +156,7 @@ elseif (filter('op') == 'add_nota') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Rimozione data di notifica dalla nota interna
|
// Rimozione data di notifica dalla nota interna
|
||||||
elseif (filter('op') == 'notification_nota') {
|
elseif (filter('op') == 'rimuovi-notifica-nota') {
|
||||||
$id_nota = post('id_nota');
|
$id_nota = post('id_nota');
|
||||||
$nota = Note::find($id_nota);
|
$nota = Note::find($id_nota);
|
||||||
|
|
||||||
@ -151,7 +167,7 @@ elseif (filter('op') == 'notification_nota') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Rimozione nota interna
|
// Rimozione nota interna
|
||||||
elseif (filter('op') == 'delete_nota') {
|
elseif (filter('op') == 'rimuovi-nota') {
|
||||||
$id_nota = post('id_nota');
|
$id_nota = post('id_nota');
|
||||||
$nota = Note::find($id_nota);
|
$nota = Note::find($id_nota);
|
||||||
|
|
||||||
@ -161,7 +177,7 @@ elseif (filter('op') == 'delete_nota') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clonazione di una checklist
|
// Clonazione di una checklist
|
||||||
elseif (filter('op') == 'clone_checklist') {
|
elseif (filter('op') == 'copia-checklist') {
|
||||||
$content = post('content');
|
$content = post('content');
|
||||||
$checklist_id = post('checklist');
|
$checklist_id = post('checklist');
|
||||||
|
|
||||||
@ -175,7 +191,7 @@ elseif (filter('op') == 'clone_checklist') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Aggiunta check alla checklist
|
// Aggiunta check alla checklist
|
||||||
elseif (filter('op') == 'add_check') {
|
elseif (filter('op') == 'aggiungi-check') {
|
||||||
$content = post('content');
|
$content = post('content');
|
||||||
$parent_id = post('parent') ?: null;
|
$parent_id = post('parent') ?: null;
|
||||||
|
|
||||||
@ -189,7 +205,7 @@ elseif (filter('op') == 'add_check') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Rimozione di un check della checklist
|
// Rimozione di un check della checklist
|
||||||
elseif (filter('op') == 'delete_check') {
|
elseif (filter('op') == 'rimuovi-check') {
|
||||||
$check_id = post('check_id');
|
$check_id = post('check_id');
|
||||||
$check = Check::find($check_id);
|
$check = Check::find($check_id);
|
||||||
|
|
||||||
@ -201,7 +217,7 @@ elseif (filter('op') == 'delete_check') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Gestione check per le checklist
|
// Gestione check per le checklist
|
||||||
elseif (filter('op') == 'toggle_check') {
|
elseif (filter('op') == 'toggle-check') {
|
||||||
$check_id = post('check_id');
|
$check_id = post('check_id');
|
||||||
$check = Check::find($check_id);
|
$check = Check::find($check_id);
|
||||||
|
|
||||||
@ -213,7 +229,7 @@ elseif (filter('op') == 'toggle_check') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Gestione ordine per le checklist
|
// Gestione ordine per le checklist
|
||||||
elseif (filter('op') == 'sort_checks') {
|
elseif (filter('op') == 'ordina-checks') {
|
||||||
$ids = explode(',', $_POST['order']);
|
$ids = explode(',', $_POST['order']);
|
||||||
$order = 0;
|
$order = 0;
|
||||||
|
|
||||||
|
67
include/modifica_allegato.php
Normal file
67
include/modifica_allegato.php
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
||||||
|
* Copyright (C) DevCode s.r.l.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Models\Upload;
|
||||||
|
|
||||||
|
$id_allegato = filter('id_allegato');
|
||||||
|
$allegato = Upload::find($id_allegato);
|
||||||
|
|
||||||
|
// Form di inserimento riga documento
|
||||||
|
echo '
|
||||||
|
<form action="" method="post" id="modifica-allegato">
|
||||||
|
<input type="hidden" name="id_allegato" value="'.$id_allegato.'">
|
||||||
|
<input type="hidden" name="backto" value="record-edit">
|
||||||
|
<input type="hidden" name="op" value="modifica-allegato">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
{[ "type": "text", "label": "'.tr('Nome').'", "name": "nome_allegato", "value": "'.$allegato->name.'" ]}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
{[ "type": "text", "label": "'.tr('Categoria').'", "name": "categoria_allegato", "value": "'.$allegato->category.'" ]}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- PULSANTI -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 text-right">
|
||||||
|
<button type="submit" class="btn btn-primary pull-right">
|
||||||
|
<i class="fa fa-edit"></i> '.tr('Modifica').'
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>';
|
||||||
|
|
||||||
|
// Elenco categoria disponibili per l'autocompletamento
|
||||||
|
$where = '`id_module` '.(!empty($allegato['id_module']) && empty($allegato['id_plugin']) ? '= '.prepare($allegato['id_module']) : 'IS NULL').' AND `id_plugin` '.(!empty($allegato['id_plugin']) ? '= '.prepare($allegato['id_plugin']) : 'IS NULL').'';
|
||||||
|
$categories = $dbo->fetchArray('SELECT DISTINCT(BINARY `category`) AS `category` FROM `zz_files` WHERE '.$where.' ORDER BY `category`');
|
||||||
|
$source = array_clean(array_column($categories, 'category'));
|
||||||
|
|
||||||
|
echo '
|
||||||
|
<script>
|
||||||
|
// Auto-completamento categoria
|
||||||
|
$("#modifica-allegato #categoria_allegato").autocomplete({
|
||||||
|
source: '.json_encode($source).',
|
||||||
|
minLength: 0
|
||||||
|
}).focus(function() {
|
||||||
|
$(this).autocomplete("search", $(this).val())
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<script>$(document).ready(init)</script>';
|
@ -331,7 +331,7 @@ switch (post('op')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Operazioni aggiuntive per il logo e filigrana stampe
|
// Operazioni aggiuntive per il logo e filigrana stampe
|
||||||
if (filter('op') == 'link_file') {
|
if (filter('op') == 'aggiungi-allegato') {
|
||||||
$nome = filter('nome_allegato');
|
$nome = filter('nome_allegato');
|
||||||
|
|
||||||
$logo_stampe = ['logo stampe', 'logo_stampe', 'logo stampe.jpg', 'logo stampe.png'];
|
$logo_stampe = ['logo stampe', 'logo_stampe', 'logo stampe.jpg', 'logo stampe.png'];
|
||||||
@ -360,7 +360,7 @@ if (filter('op') == 'link_file') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Operazioni aggiuntive per il logo
|
// Operazioni aggiuntive per il logo
|
||||||
elseif (filter('op') == 'unlink_file') {
|
elseif (filter('op') == 'rimuovi-allegato') {
|
||||||
$filename = filter('filename');
|
$filename = filter('filename');
|
||||||
|
|
||||||
if (strpos($filename, setting('Logo stampe')) !== false) {
|
if (strpos($filename, setting('Logo stampe')) !== false) {
|
||||||
|
@ -324,13 +324,13 @@ switch (post('op')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Operazioni aggiuntive per l'immagine
|
// Operazioni aggiuntive per l'immagine
|
||||||
if (filter('op') == 'unlink_file' && filter('filename') == $record['immagine']) {
|
if (filter('op') == 'rimuovi-allegato' && filter('filename') == $record['immagine']) {
|
||||||
$dbo->update('mg_articoli', [
|
$dbo->update('mg_articoli', [
|
||||||
'immagine' => null,
|
'immagine' => null,
|
||||||
], [
|
], [
|
||||||
'id' => $id_record,
|
'id' => $id_record,
|
||||||
]);
|
]);
|
||||||
} elseif (filter('op') == 'link_file' && filter('nome_allegato') == 'Immagine') {
|
} elseif (filter('op') == 'aggiungi-allegato' && filter('nome_allegato') == 'Immagine') {
|
||||||
$dbo->update('mg_articoli', [
|
$dbo->update('mg_articoli', [
|
||||||
'immagine' => $upload,
|
'immagine' => $upload,
|
||||||
], [
|
], [
|
||||||
|
@ -23,13 +23,13 @@ class Checklist {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cloneChecklist(data){
|
cloneChecklist(data){
|
||||||
data.op = "clone_checklist";
|
data.op = "copia-checklist";
|
||||||
|
|
||||||
this.request(data);
|
this.request(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
addCheck(data){
|
addCheck(data){
|
||||||
data.op = "add_check";
|
data.op = "aggiungi-check";
|
||||||
|
|
||||||
this.request(data);
|
this.request(data);
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ class Checklist {
|
|||||||
|
|
||||||
deleteCheck(id) {
|
deleteCheck(id) {
|
||||||
this.request({
|
this.request({
|
||||||
op: "delete_check",
|
op: "rimuovi-check",
|
||||||
check_id: id,
|
check_id: id,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ class Checklist {
|
|||||||
|
|
||||||
toggleCheck(id) {
|
toggleCheck(id) {
|
||||||
this.request({
|
this.request({
|
||||||
op: "toggle_check",
|
op: "toggle-check",
|
||||||
check_id: id,
|
check_id: id,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -155,13 +155,13 @@ switch ($op) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Operazioni aggiuntive per l'immagine
|
// Operazioni aggiuntive per l'immagine
|
||||||
if (filter('op') == 'unlink_file' && filter('filename') == $record['immagine']) {
|
if (filter('op') == 'rimuovi-allegato' && filter('filename') == $record['immagine']) {
|
||||||
$dbo->update('my_impianti', [
|
$dbo->update('my_impianti', [
|
||||||
'immagine' => null,
|
'immagine' => null,
|
||||||
], [
|
], [
|
||||||
'id' => $id_record,
|
'id' => $id_record,
|
||||||
]);
|
]);
|
||||||
} elseif (filter('op') == 'link_file' && filter('nome_allegato') == 'Immagine') {
|
} elseif (filter('op') == 'aggiungi-allegato' && filter('nome_allegato') == 'Immagine') {
|
||||||
$dbo->update('my_impianti', [
|
$dbo->update('my_impianti', [
|
||||||
'immagine' => $upload,
|
'immagine' => $upload,
|
||||||
], [
|
], [
|
||||||
|
@ -99,7 +99,7 @@ $(document).ready(function() {
|
|||||||
id_module: "'.$id_module.'",
|
id_module: "'.$id_module.'",
|
||||||
id_plugin: "'.$id_plugin.'",
|
id_plugin: "'.$id_plugin.'",
|
||||||
id_record: "'.$id_record.'",
|
id_record: "'.$id_record.'",
|
||||||
op: "sort_checks",
|
op: "ordina-checks",
|
||||||
order: order.join(","),
|
order: order.join(","),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -61,14 +61,14 @@ if (count($notes) > 0) {
|
|||||||
<i class="fa fa-bell"></i> '.dateFormat($nota->notification_date).'
|
<i class="fa fa-bell"></i> '.dateFormat($nota->notification_date).'
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<button type="button" class="btn btn-info btn-xs ask" data-op="notification_nota" data-id_nota="'.$nota->id.'" data-msg="'.tr('Rimuovere la data di notifica da questa nota?').'" data-backto="record-edit" data-button="'.tr('Rimuovi').'" data-class="btn btn-lg btn-warning">
|
<button type="button" class="btn btn-info btn-xs ask" data-op="rimuovi-notifica-nota" data-id_nota="'.$nota->id.'" data-msg="'.tr('Rimuovere la data di notifica da questa nota?').'" data-backto="record-edit" data-button="'.tr('Rimuovi').'" data-class="btn btn-lg btn-warning">
|
||||||
<i class="fa fa-eye"></i>
|
<i class="fa fa-eye"></i>
|
||||||
</button>';
|
</button>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->is_admin || $utente->id == $user->id) {
|
if ($user->is_admin || $utente->id == $user->id) {
|
||||||
echo '
|
echo '
|
||||||
<button type="button" class="btn btn-danger btn-xs ask" data-op="delete_nota" data-id_nota="'.$nota->id.'" data-msg="'.tr('Rimuovere questa nota?').'" data-backto="record-edit">
|
<button type="button" class="btn btn-danger btn-xs ask" data-op="rimuovi-nota" data-id_nota="'.$nota->id.'" data-msg="'.tr('Rimuovere questa nota?').'" data-backto="record-edit">
|
||||||
<i class="fa fa-trash-o"></i>
|
<i class="fa fa-trash-o"></i>
|
||||||
</button>';
|
</button>';
|
||||||
}
|
}
|
||||||
@ -91,7 +91,7 @@ if (count($notes) > 0) {
|
|||||||
if ($structure->permission == 'rw') {
|
if ($structure->permission == 'rw') {
|
||||||
echo '
|
echo '
|
||||||
<form action="" method="post">
|
<form action="" method="post">
|
||||||
<input type="hidden" name="op" value="add_nota">
|
<input type="hidden" name="op" value="aggiungi-nota">
|
||||||
<input type="hidden" name="backto" value="record-edit">
|
<input type="hidden" name="backto" value="record-edit">
|
||||||
<div class="row" >
|
<div class="row" >
|
||||||
<div class="col-md-12" >
|
<div class="col-md-12" >
|
||||||
|
@ -139,7 +139,7 @@ class FileManager implements ManagerInterface
|
|||||||
<td>'.\Translator::timestampToLocale($r['created_at']).'</td>
|
<td>'.\Translator::timestampToLocale($r['created_at']).'</td>
|
||||||
|
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<a class="btn btn-xs btn-primary" href="'.base_path().'/actions.php?id_module='.$options['id_module'].'&op=download_file&id='.$r['id'].'&filename='.$r['filename'].'" target="_blank">
|
<a class="btn btn-xs btn-primary" href="'.base_path().'/actions.php?id_module='.$options['id_module'].'&op=download-allegato&id='.$r['id'].'&filename='.$r['filename'].'" target="_blank">
|
||||||
<i class="fa fa-download"></i>
|
<i class="fa fa-download"></i>
|
||||||
</a>';
|
</a>';
|
||||||
|
|
||||||
@ -158,7 +158,11 @@ class FileManager implements ManagerInterface
|
|||||||
|
|
||||||
if (!$options['readonly']) {
|
if (!$options['readonly']) {
|
||||||
$result .= '
|
$result .= '
|
||||||
<a class="btn btn-xs btn-danger ask" data-backto="record-edit" data-msg="'.tr('Vuoi eliminare questo file?').'" data-op="unlink_file" data-filename="'.$r['filename'].'" data-id_record="'.$r['id_record'].'" data-id_plugin="'.$options['id_plugin'].'" data-before="show_'.$attachment_id.'" data-callback="reload_'.$attachment_id.'">
|
<button type="button" class="btn btn-xs btn-info" data-href="'.base_url().'/actions.php?op=visualizza-modifica-allegato&id_module='.$options['id_module'].'&id_allegato='.$r['id'].'" data-title="'.tr('Modifica allegato').'">
|
||||||
|
<i class="fa fa-edit"></i>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<a class="btn btn-xs btn-danger ask" data-backto="record-edit" data-msg="'.tr('Vuoi eliminare questo file?').'" data-op="rimuovi-allegato" data-filename="'.$r['filename'].'" data-id_record="'.$r['id_record'].'" data-id_plugin="'.$options['id_plugin'].'" data-before="show_'.$attachment_id.'" data-callback="reload_'.$attachment_id.'">
|
||||||
<i class="fa fa-trash"></i>
|
<i class="fa fa-trash"></i>
|
||||||
</a>';
|
</a>';
|
||||||
}
|
}
|
||||||
@ -189,6 +193,7 @@ class FileManager implements ManagerInterface
|
|||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
{[ "type": "text", "placeholder": "'.tr('Nome').'", "name": "nome_allegato", "class": "unblockable" ]}
|
{[ "type": "text", "placeholder": "'.tr('Nome').'", "name": "nome_allegato", "class": "unblockable" ]}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
{[ "type": "text", "placeholder": "'.tr('Categoria').'", "name": "categoria_allegato", "id": "categoria_allegato", "class": "unblockable" ]}
|
{[ "type": "text", "placeholder": "'.tr('Categoria').'", "name": "categoria_allegato", "id": "categoria_allegato", "class": "unblockable" ]}
|
||||||
</div>
|
</div>
|
||||||
@ -245,7 +250,7 @@ $(document).ready(function() {
|
|||||||
addRemoveLinks: false,
|
addRemoveLinks: false,
|
||||||
autoProcessQueue: true,
|
autoProcessQueue: true,
|
||||||
autoQueue: true,
|
autoQueue: true,
|
||||||
url: "'.base_path().'/actions.php?op=link_file&id_module='.$options['id_module'].'&id_record='.$options['id_record'].'&id_plugin='.$options['id_plugin'].'",
|
url: "'.base_path().'/actions.php?op=aggiungi-allegato&id_module='.$options['id_module'].'&id_record='.$options['id_record'].'&id_plugin='.$options['id_plugin'].'",
|
||||||
init: function (file, xhr, formData) {
|
init: function (file, xhr, formData) {
|
||||||
this.on("sending", function(file, xhr, formData) {
|
this.on("sending", function(file, xhr, formData) {
|
||||||
formData.append("categoria", $("#categoria_allegato").val());
|
formData.append("categoria", $("#categoria_allegato").val());
|
||||||
@ -292,7 +297,7 @@ $(document).ready(function() {
|
|||||||
id_module: "'.$options['id_module'].'",
|
id_module: "'.$options['id_module'].'",
|
||||||
id_plugin: "'.$options['id_plugin'].'",
|
id_plugin: "'.$options['id_plugin'].'",
|
||||||
id_record: "'.$options['id_record'].'",
|
id_record: "'.$options['id_record'].'",
|
||||||
op: "upload_category",
|
op: "modifica-categoria-allegato",
|
||||||
category: nome.text(),
|
category: nome.text(),
|
||||||
name: input.val(),
|
name: input.val(),
|
||||||
},
|
},
|
||||||
@ -326,7 +331,7 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Autocompletamento categoria
|
// Auto-completamento categoria
|
||||||
$("#'.$attachment_id.' #categoria_allegato").autocomplete({
|
$("#'.$attachment_id.' #categoria_allegato").autocomplete({
|
||||||
source: '.json_encode($source).',
|
source: '.json_encode($source).',
|
||||||
minLength: 0
|
minLength: 0
|
||||||
@ -335,7 +340,7 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
op: "link_file",
|
op: "aggiungi-allegato",
|
||||||
id_module: "'.$options['id_module'].'",
|
id_module: "'.$options['id_module'].'",
|
||||||
id_plugin: "'.$options['id_plugin'].'",
|
id_plugin: "'.$options['id_plugin'].'",
|
||||||
id_record: "'.$options['id_record'].'",
|
id_record: "'.$options['id_record'].'",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user