Added CSS changes. WIP: Backup upload

This commit is contained in:
Jose Gonzalez 2020-03-19 18:24:52 +01:00
parent e14f072822
commit 7bf5764081
3 changed files with 95 additions and 91 deletions

View File

@ -17,7 +17,6 @@
ini_set('display_errors', 1); ini_set('display_errors', 1);
ini_set('display_startup_errors', 1); ini_set('display_startup_errors', 1);
error_reporting(E_ALL); */ error_reporting(E_ALL); */
$cipotes = false;
// END // END
global $config; global $config;
@ -32,7 +31,7 @@ if (! check_acl($config['id_user'], 0, 'PM')) {
return; return;
} }
// hd($_POST);
require_once $config['homedir'].'/include/class/ManageBlock.class.php'; require_once $config['homedir'].'/include/class/ManageBlock.class.php';
$ajaxPage = ENTERPRISE_DIR.'/godmode/agentes/ManageBlock'; $ajaxPage = ENTERPRISE_DIR.'/godmode/agentes/ManageBlock';
// Control call flow. // Control call flow.
@ -70,17 +69,17 @@ if (is_ajax()) {
// Stop any execution. // Stop any execution.
exit; exit;
} else { } else {
// Get all parameters
$id_np = get_parameter('id_np', '');
// Run. // Run.
$manageBlock->run(); $manageBlock->run();
// Get the id_np.
$id_np = $manageBlock->getIdNp();
if (empty($id_np)) { // Show the proper window.
// List all Module Block if ($id_np === -1) {
// List all Module Block.
$manageBlock->moduleBlockList(); $manageBlock->moduleBlockList();
} else { } else {
// Create new o update Template // Create new o update Template.
hd($id_np);
$manageBlock->moduleTemplateForm($id_np); $manageBlock->moduleTemplateForm($id_np);
} }
} }

View File

@ -56,6 +56,13 @@ class ManageBlock extends HTML
*/ */
private $baseUrl; private $baseUrl;
/**
* Id of the Thing ???
*
* @var integer
*/
private $id_np;
/** /**
* Constructor * Constructor
@ -83,7 +90,9 @@ class ManageBlock extends HTML
exit; exit;
} }
$this->offset = (int) get_parameter('offset', 0); $this->id_np = get_parameter('id_np', -1);
$this->offset = get_parameter('offset', 0);
$this->ajaxController = $ajax_controller; $this->ajaxController = $ajax_controller;
@ -117,7 +126,7 @@ class ManageBlock extends HTML
'selected' => false, 'selected' => false,
], ],
[ [
'link' => $this->url, 'link' => $this->baseUrl,
'label' => __('Module Blocks'), 'label' => __('Module Blocks'),
'selected' => true, 'selected' => true,
], ],
@ -142,6 +151,17 @@ class ManageBlock extends HTML
} }
/**
* Get the value of this current thing ???
*
* @return integer Id of this thing ???
*/
public function getIdNp()
{
return $this->id_np;
}
/** /**
* Create the table with the list of Blocks Templates * Create the table with the list of Blocks Templates
* *
@ -224,11 +244,9 @@ class ManageBlock extends HTML
array_push($table->data, $data); array_push($table->data, $data);
} }
// Sé que los echo son basurientos, pero de momento, me valen para ir montando.
// LOS QUITARÉ, PROMESA DE CORONAVIRUS.
html_print_table($table); html_print_table($table);
echo '<div style="float:right;" class="">'; $output = '<div style="float:right;" class="">';
$form = [ $form = [
'method' => 'POST', 'method' => 'POST',
@ -254,46 +272,24 @@ class ManageBlock extends HTML
], ],
]; ];
$this->printForm( $output .= $this->printForm(
[ [
'form' => $form, 'form' => $form,
'inputs' => $inputs, 'inputs' => $inputs,
] ],
true
); );
echo '</div>'; $output .= '</div>';
echo $output;
} }
/** /**
* Get the data from DB * Prints Form for template management
* *
* @return void * @param integer $id_np
*/
private function getData()
{
return null;
}
/**
* Undocumented function
*
* @param array $data Data to create the table
*
* @return void
*/
public function printModuleTemplateForm($data)
{
}
/**
* Prints Form for template
*
* @param integer $id_np
* @return void
*/ */
public function moduleTemplateForm(int $id_np=0) public function moduleTemplateForm(int $id_np=0)
{ {
@ -306,20 +302,17 @@ class ManageBlock extends HTML
$formButtonName = 'crtbutton'; $formButtonName = 'crtbutton';
$formButtonLabel = __('Create'); $formButtonLabel = __('Create');
// Set of empty values. // Set of empty values.
$values = [ $description = '';
'name' => '', $name = '';
'description' => '', $pen = '';
'pen' => '',
];
} else { } else {
// Assignation for submit button. // Assignation for submit button.
$formButtonClass = 'sub udp'; $formButtonClass = 'sub upd';
$formButtonName = 'updbutton'; $formButtonName = 'updbutton';
$formButtonLabel = __('Update'); $formButtonLabel = __('Update');
// Profile exists.
// Profile exists
$row = db_get_row('tnetwork_profile', 'id_np', $id_np); $row = db_get_row('tnetwork_profile', 'id_np', $id_np);
// Fill the inputs with the obtained data.
$description = $row['description']; $description = $row['description'];
$name = $row['name']; $name = $row['name'];
$pen = ''; $pen = '';
@ -378,7 +371,7 @@ class ManageBlock extends HTML
'arguments' => [ 'arguments' => [
'name' => $formButtonName, 'name' => $formButtonName,
'label' => $formButtonLabel, 'label' => $formButtonLabel,
'type' => 'submit', 'type' => 'button',
'attributes' => 'class="'.$formButtonClass.'"', 'attributes' => 'class="'.$formButtonClass.'"',
'return' => true, 'return' => true,
], ],
@ -411,8 +404,8 @@ class ManageBlock extends HTML
WHERE npc.id_nc = nc.id_nc AND npc.id_np = %d', WHERE npc.id_nc = nc.id_nc AND npc.id_np = %d',
$id_np $id_np
); );
$moduleBlocks = db_get_all_rows_sql($sql); $moduleBlocks = db_get_all_rows_sql($sql);
$blockTables = []; $blockTables = [];
// Build the information of the blocks // Build the information of the blocks
foreach ($moduleBlocks as $block) { foreach ($moduleBlocks as $block) {
@ -431,51 +424,58 @@ class ManageBlock extends HTML
} }
} }
foreach ($blockTables as $blockTable) { if (count($blockTables) === 0) {
$blockTitle = $blockTable['name']; ui_print_info_message(__('No module blocks for this profile'));
$blockData = $blockTable['data']; } else {
foreach ($blockTables as $id_group => $blockTable) {
$blockData = $blockTable['data'];
$blockTitle = $blockTable['name'];
$blockTitle .= '<div class="white_table_header_checkbox">'.html_print_checkbox_switch_extended('block_id_'.$id_group, 1, 0, false, '', '', true).'</div>';
$table = new StdClasS(); $table = new StdClasS();
$table->class = 'databox data'; $table->class = 'databox data';
$table->width = '75%'; $table->width = '75%';
$table->styleTable = 'margin: 2em auto 0;border: 1px solid #ddd;background: white;'; $table->styleTable = 'margin: 2em auto 0;border: 1px solid #ddd;background: white;';
$table->rowid = []; $table->rowid = [];
$table->data = []; $table->data = [];
$table->cellpadding = 0; $table->cellpadding = 0;
$table->cellspacing = 0; $table->cellspacing = 0;
$table->width = '100%'; $table->width = '100%';
$table->class = 'info_table'; $table->class = 'info_table';
$table->head = []; $table->head = [];
// $table->head[0] = html_print_checkbox('all_delete', 0, false, true, false); $table->head[0] = __('Module Name');
$table->head[0] = __('Module Name'); $table->head[1] = __('Type');
$table->head[1] = __('Type'); $table->head[2] = __('Description');
$table->head[2] = __('Description'); $table->head[3] = '<span style="float:right;margin-right:2em;">'.__('Add').'</span>';
$table->head[3] = '<span style="float:right;margin-right:2em;">'.__('Add').'</span>';
$table->size = [];
$table->size[0] = '20%';
$table->size[2] = '65%';
$table->size[3] = '15%';
$table->align = []; $table->size = [];
$table->align[3] = 'left'; $table->size[0] = '20%';
$table->size[2] = '65%';
$table->size[3] = '15%';
$table->data = []; $table->align = [];
$table->align[3] = 'right';
foreach ($blockData as $module) { $table->style = [];
hd($module); $table->style[3] = 'padding-right:2em';
$data[0] = $module['name'];
$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('active_'.$module['component_id'], 1, 0, false, '', '', true);
array_push($table->data, $data); $table->data = [];
foreach ($blockData as $module) {
$data[0] = $module['name'];
$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('active_'.$module['component_id'], 1, 0, false, '', '', true);
array_push($table->data, $data);
}
$content = html_print_table($table, true);
$output[] = ui_toggle($content, $blockTitle, '', '', false);
} }
$content = html_print_table($table, true);
$output[] = ui_toggle($content, $blockTitle, '', '', false);
} }
} }

View File

@ -5735,6 +5735,11 @@ div#status_pie {
.white_table_graph_header b { .white_table_graph_header b {
font-size: 10pt; font-size: 10pt;
font-weight: 600; font-weight: 600;
width: 100%;
}
.white_table_graph_header div.white_table_header_checkbox {
float: right;
} }
.white_table_graph_header div#bullets_modules { .white_table_graph_header div#bullets_modules {