2017-08-04 16:28:16 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
include_once __DIR__.'/core.php';
|
|
|
|
|
|
|
|
// Lettura parametri iniziali
|
2017-09-22 15:19:59 +02:00
|
|
|
$info = Plugins::get($id_plugin);
|
2017-08-04 16:28:16 +02:00
|
|
|
|
|
|
|
if (empty($info) || empty($info['enabled'])) {
|
2017-09-04 12:02:29 +02:00
|
|
|
die(tr('Accesso negato'));
|
2017-08-04 16:28:16 +02:00
|
|
|
}
|
|
|
|
|
2018-06-26 14:26:40 +02:00
|
|
|
// Inclusione di eventuale plugin personalizzato
|
2017-08-04 16:28:16 +02:00
|
|
|
if (!empty($info['script'])) {
|
2018-06-26 14:26:40 +02:00
|
|
|
include App::filepath('modules/'.$info['module_dir'].'/plugins|custom|', $info['script']);
|
2017-08-04 16:28:16 +02:00
|
|
|
|
|
|
|
return;
|
2018-06-26 14:26:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Plugin standard
|
|
|
|
else {
|
2018-02-15 17:30:42 +01:00
|
|
|
// Caricamento helper plugin (verifico se ci sono helper personalizzati)
|
2018-06-26 14:26:40 +02:00
|
|
|
include_once Plugins::filepath($info['id'], 'modutil.php');
|
|
|
|
|
|
|
|
// Lettura risultato query del plugin
|
|
|
|
include_once Plugins::filepath($info['id'], 'init.php');
|
|
|
|
|
|
|
|
// Esecuzione delle operazioni del plugin
|
2018-02-15 17:30:42 +01:00
|
|
|
include $docroot.'/actions.php';
|
2017-08-04 16:28:16 +02:00
|
|
|
|
|
|
|
if (empty($records)) {
|
|
|
|
echo '
|
2017-09-04 12:02:29 +02:00
|
|
|
<p>'.tr('Record non trovato').'.</p>';
|
2017-08-04 16:28:16 +02:00
|
|
|
} else {
|
2018-02-15 17:30:42 +01:00
|
|
|
// Lettura template plugin (verifico se ci sono template personalizzati, altrimenti uso quello base)
|
2017-08-04 16:28:16 +02:00
|
|
|
if (file_exists($docroot.'/plugins/'.$info['directory'].'/custom/edit.php')) {
|
|
|
|
include $docroot.'/plugins/'.$info['directory'].'/custom/edit.php';
|
|
|
|
} elseif (file_exists($docroot.'/plugins/'.$info['directory'].'/custom/edit.html')) {
|
|
|
|
include $docroot.'/plugins/'.$info['directory'].'/custom/edit.html';
|
|
|
|
} elseif (file_exists($docroot.'/plugins/'.$info['directory'].'/edit.php')) {
|
|
|
|
include $docroot.'/plugins/'.$info['directory'].'/edit.php';
|
|
|
|
} elseif (file_exists($docroot.'/plugins/'.$info['directory'].'/edit.html')) {
|
|
|
|
include $docroot.'/plugins/'.$info['directory'].'/edit.html';
|
|
|
|
}
|
2018-02-15 17:30:42 +01:00
|
|
|
|
|
|
|
// Campi personalizzati
|
|
|
|
echo '
|
|
|
|
|
|
|
|
<div class="hide" id="custom_fields_top-plugin">
|
|
|
|
{( "name": "custom_fields", "id_plugin": "'.$id_plugin.'", "id_record": "'.$id_record.'", "position": "top" )}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="hide" id="custom_fields_bottom-plugin">
|
|
|
|
{( "name": "custom_fields", "id_plugin": "'.$id_plugin.'", "id_record": "'.$id_record.'" )}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
$(document).ready(function(){
|
|
|
|
var form = $("#custom_fields_top-plugin").parent().find("form").first();
|
|
|
|
|
|
|
|
// Campi a inizio form
|
|
|
|
form.prepend($("#custom_fields_top-plugin").html());
|
|
|
|
|
|
|
|
// Campi a fine form
|
|
|
|
var last = form.find(".panel").last();
|
|
|
|
if (!last.length) {
|
|
|
|
last = form.find(".row").eq(-2);
|
|
|
|
}
|
|
|
|
|
|
|
|
last.after($("#custom_fields_bottom-plugin").html());
|
|
|
|
});
|
|
|
|
</script>';
|
2017-08-04 16:28:16 +02:00
|
|
|
}
|
|
|
|
|
2017-09-08 13:24:48 +02:00
|
|
|
redirectOperation($id_module, $id_parent);
|
2017-08-04 16:28:16 +02:00
|
|
|
|
2017-09-22 15:19:59 +02:00
|
|
|
$module = Modules::get($info['idmodule_to']);
|
2017-08-04 16:28:16 +02:00
|
|
|
|
|
|
|
if ($module['permessi'] != 'rw') {
|
|
|
|
?>
|
|
|
|
<script>
|
|
|
|
|
|
|
|
$(document).ready( function(){
|
|
|
|
$('input, textarea, select', 'section.content').attr('readonly', 'true');
|
|
|
|
$('select.chzn-done').prop('disabled', true).trigger('liszt:updated');
|
|
|
|
$('a.btn, button, input[type=button], input[type=submit]', 'section.content').hide();
|
|
|
|
$('a.btn-info, button.btn-info, input[type=button].btn-info', 'section.content').show();
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '
|
|
|
|
<script src="'.$rootdir.'/lib/init.js"></script>';
|