fixed styles

This commit is contained in:
daniel 2023-03-06 17:51:49 +01:00
parent 5ba9e0e9aa
commit 70d2223a46
6 changed files with 155 additions and 117 deletions

View File

@ -55,17 +55,19 @@ function get_wiz_class($str)
default:
// Main, show header.
ui_print_page_header(
ui_print_standard_header(
__('Discovery'),
'',
false,
'',
true,
'',
false,
'',
GENERIC_SIZE_TEXT,
''
[],
[
[
'link' => '',
'label' => __('Discovery'),
],
]
);
return null;
}

View File

@ -454,22 +454,6 @@ if (empty($create) === false || empty($view) === false) {
$data[0] = html_print_textarea('form_description', 4, 50, $form_description, '', true, 'w100p');
$table->colspan['plugin_desc_inputs'][0] = 3;
$table->data['plugin_desc_inputs'] = $data;
/*
if (is_metaconsole() === true) {
$table->head[0] = __('General');
$table->head_colspan[0] = 4;
$table->headstyle[0] = 'text-align: center';
html_print_table($table);
} else {
echo '<fieldset><legend>'.__('General').'</legend>';
html_print_table($table);
echo '</fieldset>';
}
html_print_table($table);
$table->data = [];
*/
// Command title.
$commandTitleContent = [];
@ -528,20 +512,6 @@ if (empty($create) === false || empty($view) === false) {
$data[0] = html_print_div(['id' => 'command_preview', 'class' => 'mono'], true);
$table->data['plugin_preview_inputs'] = $data;
$table->colspan['plugin_preview_inputs'][0] = 2;
/*
$table->width = '100%';
$table->class = 'databox filters';
if (is_metaconsole() === true) {
$table->head[0] = __('Command');
$table->head_colspan[0] = 4;
$table->headstyle[0] = 'text-align: center';
html_print_table($table);
} else {
echo '<fieldset><legend>'.__('Command').'</legend>';
html_print_table($table);
echo '</fieldset>';
}
*/
// Parameters macros title.
$macrosTitleContent = [];
@ -696,11 +666,27 @@ if (empty($create) === false || empty($view) === false) {
echo '<tr><td align="right">';
if ($create != '') {
echo "<input name='crtbutton' type='submit' class='sub wand' value='".__('Create')."'>";
$button = html_print_submit_button(
__('Create'),
'crtbutton',
false,
[ 'icon' => 'wand' ],
true
);
} else {
echo "<input name='uptbutton' type='submit' class='sub upd' value='".__('Update')."'>";
$button = html_print_submit_button(
__('Update'),
'uptbutton',
false,
[ 'icon' => 'upd' ],
true
);
}
html_print_action_buttons(
$button
);
echo '</form></table>';
if (defined('METACONSOLE')) {

View File

@ -60,12 +60,23 @@ if (is_metaconsole() === true) {
return;
}
} else {
ui_print_page_header(
ui_print_standard_header(
__('PLUGIN REGISTRATION'),
'images/gm_servers.png',
false,
'',
true
true,
[],
[
[
'link' => '',
'label' => __('Servers'),
],
[
'link' => '',
'label' => __('Register plugin'),
],
]
);
$management_allowed = is_management_allowed();

View File

@ -603,14 +603,14 @@ class ConfigPEN extends HTML
],
];
$this->tableId = 'keystore';
$tableId = 'keystore';
// Load datatables user interface.
$output .= ui_print_datatable(
[
'id' => $this->tableId,
'id' => $tableId,
'return' => true,
'class' => 'info_table',
'style' => 'width: 100%',
'style' => 'width: 99%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => $this->ajaxController,
@ -621,6 +621,7 @@ class ConfigPEN extends HTML
'direction' => 'asc',
],
'search_button_class' => 'sub filter float-right',
'filter_main_class' => 'box-flat white_table_graph fixed_filter_bar',
'form' => [
'inputs' => [
[
@ -643,15 +644,18 @@ class ConfigPEN extends HTML
$output .= '<div id="msg" class="invisible"></div>';
$output .= '<div id="aux" class="invisible"></div>';
// Create button.
$output .= parent::printInput(
[
'type' => 'submit',
'name' => 'create',
'label' => __('Register manufacturer'),
'attributes' => 'class="sub next"',
'return' => true,
]
$output .= html_print_action_buttons(
parent::printInput(
[
'type' => 'submit',
'name' => 'create',
'label' => __('Register manufacturer'),
'attributes' => ['icon' => 'next'],
'return' => true,
]
),
['type' => 'form_action'],
true
);
ob_start();

View File

@ -398,7 +398,7 @@ class HTML
*
* @return void
*/
public static function printGoBackButton($url=null)
public static function printGoBackButton($url=null, $return=false)
{
if (isset($url) === false) {
$url = ui_get_full_url(
@ -428,7 +428,11 @@ class HTML
],
];
self::printForm($form);
if ($return === true) {
return self::printForm($form, $return);
}
self::printForm($form, $return);
}

View File

@ -836,7 +836,15 @@ class ModuleTemplates extends HTML
]
);
ui_pagination($countModuleTemplates, $this->baseUrl, $this->offset);
$tablePagination = ui_pagination(
$countModuleTemplates,
$this->baseUrl,
$this->offset,
0,
true,
'offset',
false
);
// Create the table with Module Block list.
$table = new StdClasS();
$table->class = 'databox data ';
@ -874,13 +882,13 @@ class ModuleTemplates extends HTML
$table->cellclass[][3] = 'table_action_buttons';
$data[3] = html_print_input_image(
'delete_profile',
'images/cross.png',
'images/delete.svg',
$row['id_np'],
'',
'width:40px',
true,
[
'onclick' => 'if (!confirm(\''.__('Are you sure?').'\')) return false;',
'class' => 'invert_filter',
'class' => 'invert_filter main_menu_icon',
]
);
$data[3] .= html_print_input_image(
@ -891,23 +899,40 @@ class ModuleTemplates extends HTML
true,
[
'title' => 'Export tdaso CSV',
'class' => 'invert_filter',
'class' => 'invert_filter main_menu_icon',
]
);
$data[3] = '<a href="'.$this->baseUrl.'&action=delete&id_np='.$row['id_np'].'" onclick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).'</a>';
$data[3] .= '<a href="'.$this->baseUrl.'&action=export&id_np='.$row['id_np'].'" onclick="blockResubmit($(this))">'.html_print_image('images/csv.png', true, ['title' => __('Export to CSV'), 'class' => 'invert_filter']).'</a>';
$data[3] = '<a href="'.$this->baseUrl.'&action=delete&id_np='.$row['id_np'].'" onclick="if (!confirm(\''.__('Are you sure?').'\')) return false;">';
$data[3] .= html_print_image(
'images/delete.svg',
true,
[
'title' => __('Delete'),
'class' => 'invert_filter main_menu_icon',
]
);
$data[3] .= '</a>';
$data[3] .= '<a href="'.$this->baseUrl.'&action=export&id_np='.$row['id_np'].'" onclick="blockResubmit($(this))">';
$data[3] .= html_print_image(
'images/csv.png',
true,
[
'title' => __('Export to CSV'),
'class' => 'invert_filter main_menu_icon',
]
);
$data[3] .= '</a>';
array_push($table->data, $data);
}
html_print_table($table);
$output = '<div class="float-right">';
$form = [
'method' => 'POST',
'action' => $this->baseUrl,
'id' => 'main_management_form',
'class' => 'flex_center',
];
$inputs[] = [
@ -934,22 +959,29 @@ class ModuleTemplates extends HTML
'label' => __('Delete selected'),
'name' => 'erase',
'type' => 'button',
'attributes' => ['icon' => 'cancel'],
'attributes' => [
'icon' => 'delete',
'mode' => 'secondary',
],
'return' => true,
],
];
$output .= $this->printForm(
html_print_action_buttons(
$this->printForm(
[
'form' => $form,
'inputs' => $inputs,
],
true
),
[
'form' => $form,
'inputs' => $inputs,
],
true
'type' => 'data_table',
'class' => 'fixed_action_buttons',
'right_content' => $tablePagination,
]
);
$output .= '</div>';
echo $output;
}
@ -1056,42 +1088,38 @@ class ModuleTemplates extends HTML
],
];
$availableButtons = [];
// Required for PEN field.
ui_require_jquery_file('tag-editor');
ui_require_css_file('jquery.tag-editor');
$availableButtons[] = [
'arguments' => [
$buttons = $this->printInput(
[
'name' => 'action_button',
'label' => $formButtonLabel,
'type' => 'submit',
'attributes' => [ 'icon' => $formButtonClass ],
'attributes' => [
'icon' => $formButtonClass,
'form' => 'module_template_form',
],
'return' => true,
],
];
'width' => 'initial',
]
);
if ($createNewTemplate === false) {
$availableButtons[] = [
'arguments' => [
$buttons .= $this->printInput(
[
'name' => 'add_components_button',
'label' => __('Add components'),
'type' => 'button',
'attributes' => [ 'icon' => 'cog' ],
'script' => 'showAddComponent();',
'return' => true,
],
];
'width' => 'initial',
]
);
}
$inputs[] = [
'class' => 'action_button_list',
'direct' => false,
'wrapper' => 'div',
'block_content' => $availableButtons,
];
// Required for PEN field.
ui_require_jquery_file('tag-editor');
ui_require_css_file('jquery.tag-editor');
if ($createNewTemplate === false) {
// Get the data.
$sql = sprintf(
@ -1142,13 +1170,13 @@ class ModuleTemplates extends HTML
$blockTitle .= '<div class="white_table_header_checkbox">';
$blockTitle .= html_print_input_image(
'del_block_'.$id_group.'_',
'images/cross.png',
'images/delete.svg',
1,
false,
'width: 40px',
true,
[
'title' => __('Delete this block'),
'class' => 'invert_filter',
'class' => 'invert_filter main_menu_icon',
'onclick' => 'if(confirm(\''.__('Do you want delete this block?').'\')){deleteModuleTemplate(\'block\',\''.$blockComponentList.'\')};return false;',
]
);
@ -1196,7 +1224,7 @@ class ModuleTemplates extends HTML
true,
[
'title' => __('Network module'),
'class' => 'invert_filter',
'class' => 'invert_filter main_menu_icon',
]
);
break;
@ -1207,7 +1235,7 @@ class ModuleTemplates extends HTML
true,
[
'title' => __('WMI module'),
'class' => 'invert_filter',
'class' => 'invert_filter main_menu_icon',
]
);
break;
@ -1218,7 +1246,7 @@ class ModuleTemplates extends HTML
true,
[
'title' => __('Plug-in module'),
'class' => 'invert_filter',
'class' => 'invert_filter main_menu_icon',
]
);
break;
@ -1239,13 +1267,13 @@ class ModuleTemplates extends HTML
$data[3] = mb_strimwidth(io_safe_output($module['description']), 0, 150, '...');
$data[4] = html_print_input_image(
'del_module_'.$module['component_id'].'_',
'images/cross.png',
'images/delete.svg',
1,
'',
'width:40px;',
true,
[
'title' => __('Delete this module'),
'class' => 'invert_filter',
'class' => 'invert_filter main_menu_icon',
'onclick' => 'if(confirm(\''.__('Do you want delete this module?').'\')){deleteModuleTemplate(\'module\','.$module['component_id'].')};return false;',
]
);
@ -1277,7 +1305,9 @@ class ModuleTemplates extends HTML
echo '<div class="invisible" id="msg"></div>';
}
$this->printGoBackButton($this->baseUrl);
$buttons .= $this->printGoBackButton($this->baseUrl, true);
html_print_action_buttons($buttons);
}
@ -1459,30 +1489,31 @@ class ModuleTemplates extends HTML
var listValidPens = $("#hidden-valid-pen").val();
try {
listValidPens = listValidPens.split(',');
if(listValidPens != undefined) {
listValidPens = listValidPens.split(',');
//Adding tagEditor for PEN management.
$("#text-pen").tagEditor({
beforeTagSave: function(field, editor, tags, tag, val) {
if (listValidPens.indexOf(val) == -1) {
return false;
}
},
autocomplete: {
source: <?php echo json_encode($this->penRefs); ?>
}
});
}
} catch (e) {
console.error(e);
return;
}
//Adding tagEditor for PEN management.
$("#text-pen").tagEditor({
beforeTagSave: function(field, editor, tags, tag, val) {
if (listValidPens.indexOf(val) == -1) {
return false;
}
},
autocomplete: {
source: <?php echo json_encode($this->penRefs); ?>
}
});
//Values for add.
$("#add-modules-components").change(function() {
var valores = $("#add-modules-components")
.val()
.join(",");
//$("#hidden-add-modules-components-values").val(valores);
});
});