WIP: Backup upload

This commit is contained in:
Jose Gonzalez 2020-03-23 15:16:54 +01:00
parent 28cdbf1409
commit c18d339730
2 changed files with 34 additions and 17 deletions

View File

@ -73,10 +73,13 @@ if (is_ajax()) {
$manageBlock->run();
// Get the id_np.
$id_np = $manageBlock->getIdNp();
$saveData = $manageBlock->getSaveData();
// Show the proper window.
if ($id_np === -1) {
// List all Module Block.
if ($saveData === true) {
// Save the data sent
$manageBlock->saveData();
} else if ($id_np === -1) {
// List all Module Blocks.
$manageBlock->moduleBlockList();
} else {
// Create new o update Template.
@ -88,7 +91,7 @@ if (is_ajax()) {
<script>
$(document).ready (function () {
//Close button
$("[id*=checkbox-active]").click (function () {
$("[id*=checkbox-switch]").click (function () {
$("[id*=checkbox-block_id]").toggleClass('alpha50');
});
});

View File

@ -120,7 +120,7 @@ class ManageBlock extends HTML
$this->pen = get_parameter('pen', '');
$this->offset = get_parameter('offset', 0);
$this->ajaxController = $ajax_controller;
$this->saveData = (bool) get_parameter('save', 0);
return $this;
}
@ -184,12 +184,23 @@ class ManageBlock extends HTML
}
/**
* Get the value of if we want save the changes
*
* @return boolean True if must save the changes
*/
public function getSaveData()
{
return $this->saveData;
}
/**
* Undocumented function
*
* @return void
*/
private function manageData()
private function saveData()
{
// if ($)
$name = get_parameter('name', '');
@ -368,6 +379,8 @@ class ManageBlock extends HTML
// Inputs.
$inputs = [];
// Inputs.
$rawInputs = '';
$inputs[] = [
'label' => __('Name'),
@ -420,15 +433,6 @@ class ManageBlock extends HTML
$js = '$(\'#text-pen\').tagEditor();';
$this->printFormAsList(
[
'form' => $form,
'inputs' => $inputs,
'js' => $js,
true
]
);
if ($createNewBlock === false) {
// Get the data.
$sql = sprintf(
@ -503,13 +507,13 @@ class ManageBlock extends HTML
$data[1] = ui_print_moduletype_icon($module['type'], true);
$data[2] = mb_strimwidth(io_safe_output($module['description']), 0, 150, '...');
$data[3] = html_print_checkbox_switch_extended('switch_'.$id_group.'_'.$module['component_id'], 1, 0, false, 'switchBlockControl(event)', '', true);
// $data[3] .= html_print_input_hidden();
array_push($table->data, $data);
}
$content = html_print_table($table, true);
ui_toggle($content, $blockTitle, '', '', false);
$rawInputs .= ui_toggle($content, $blockTitle, '', '', false, true);
}
}
} else {
@ -517,6 +521,16 @@ class ManageBlock extends HTML
}
}
$this->printFormAsList(
[
'form' => $form,
'inputs' => $inputs,
'rawInputs' => $rawInputs,
'js' => $js,
true
]
);
$javascript = "
<script>
function switchBlockControl(e){