mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 01:05:39 +02:00
Inventory modules forms
This commit is contained in:
parent
f01b18b965
commit
845a637082
@ -369,6 +369,17 @@ if ($result === false) {
|
|||||||
$actionButtons = '';
|
$actionButtons = '';
|
||||||
|
|
||||||
if ($management_allowed === true) {
|
if ($management_allowed === true) {
|
||||||
|
$actionButtons .= html_print_submit_button(
|
||||||
|
__('Create'),
|
||||||
|
'crt',
|
||||||
|
false,
|
||||||
|
[
|
||||||
|
'icon' => 'wand',
|
||||||
|
'form' => 'form_create',
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
$actionButtons .= html_print_submit_button(
|
$actionButtons .= html_print_submit_button(
|
||||||
__('Delete'),
|
__('Delete'),
|
||||||
'delete_btn',
|
'delete_btn',
|
||||||
@ -380,18 +391,6 @@ if ($result === false) {
|
|||||||
],
|
],
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
$actionButtons .= html_print_submit_button(
|
|
||||||
__('Create'),
|
|
||||||
'crt',
|
|
||||||
false,
|
|
||||||
[
|
|
||||||
'icon' => 'wand',
|
|
||||||
'form' => 'form_create',
|
|
||||||
],
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
html_print_action_buttons(
|
html_print_action_buttons(
|
||||||
|
@ -26,22 +26,32 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'],
|
|||||||
|
|
||||||
|
|
||||||
// Header
|
// Header
|
||||||
if (defined('METACONSOLE')) {
|
if (is_metaconsole() === true) {
|
||||||
$sec = 'advanced';
|
$sec = 'advanced';
|
||||||
enterprise_include_once('meta/include/functions_components_meta.php');
|
enterprise_include_once('meta/include/functions_components_meta.php');
|
||||||
components_meta_print_header();
|
components_meta_print_header();
|
||||||
} else {
|
} else {
|
||||||
$sec = 'gmodules';
|
$sec = 'gmodules';
|
||||||
ui_print_page_header(
|
ui_print_standard_header(
|
||||||
__('Module management').' » '.__('Inventory modules'),
|
__('Module management'),
|
||||||
'images/op_inventory.png',
|
'images/op_inventory.png',
|
||||||
false,
|
false,
|
||||||
'',
|
'',
|
||||||
true
|
true,
|
||||||
|
[],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => __('Configuration'),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => __('Inventory modules'),
|
||||||
|
],
|
||||||
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Header
|
|
||||||
$is_windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN';
|
$is_windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN';
|
||||||
if ($is_windows) {
|
if ($is_windows) {
|
||||||
ui_print_error_message(__('Not supported in Windows systems'));
|
ui_print_error_message(__('Not supported in Windows systems'));
|
||||||
@ -95,16 +105,40 @@ if ($id_os == null) {
|
|||||||
|
|
||||||
$table = new stdClass();
|
$table = new stdClass();
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
$table->class = 'databox filters';
|
$table->class = 'databox filter-table-adv';
|
||||||
$table->style = [];
|
$table->style = [];
|
||||||
$table->style[0] = 'font-weight: bold';
|
$table->style[0] = 'width: 50%';
|
||||||
|
$table->style[1] = 'width: 50%';
|
||||||
$table->data = [];
|
$table->data = [];
|
||||||
$table->data[0][0] = '<strong>'.__('Name').'</strong>';
|
|
||||||
$table->data[0][1] = html_print_input_text('name', $name, '', 45, 100, true, $disabled);
|
$table->data[0][] = html_print_label_input_block(
|
||||||
$table->data[1][0] = '<strong>'.__('Description').'</strong>';
|
__('Name'),
|
||||||
$table->data[1][1] = html_print_input_text('description', $description, '', 60, 500, true);
|
html_print_input_text(
|
||||||
$table->data[2][0] = '<strong>'.__('OS').'</strong>';
|
'name',
|
||||||
$table->data[2][1] = html_print_select_from_sql(
|
$name,
|
||||||
|
'',
|
||||||
|
45,
|
||||||
|
100,
|
||||||
|
true,
|
||||||
|
$disabled
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$table->data[0][] = html_print_label_input_block(
|
||||||
|
__('Description'),
|
||||||
|
html_print_input_text(
|
||||||
|
'description',
|
||||||
|
$description,
|
||||||
|
'',
|
||||||
|
60,
|
||||||
|
500,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$table->data[1][] = html_print_label_input_block(
|
||||||
|
__('OS'),
|
||||||
|
html_print_select_from_sql(
|
||||||
'SELECT id_os, name FROM tconfig_os ORDER BY name',
|
'SELECT id_os, name FROM tconfig_os ORDER BY name',
|
||||||
'id_os',
|
'id_os',
|
||||||
$id_os,
|
$id_os,
|
||||||
@ -112,65 +146,125 @@ $table->data[2][1] = html_print_select_from_sql(
|
|||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
$return = true
|
$return = true
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$table->data[3][0] = '<strong>'.__('Interpreter').'</strong>';
|
$table->data[1][] = html_print_label_input_block(
|
||||||
$table->data[3][1] = html_print_input_text('interpreter', $interpreter, '', 25, 100, true);
|
__('Interpreter'),
|
||||||
$table->data[3][1] .= ui_print_help_tip(__('Left blank for the LOCAL inventory modules'), true);
|
html_print_input_text(
|
||||||
|
'interpreter',
|
||||||
|
$interpreter,
|
||||||
|
'',
|
||||||
|
25,
|
||||||
|
100,
|
||||||
|
true
|
||||||
|
).ui_print_input_placeholder(
|
||||||
|
__('Left blank for the LOCAL inventory modules'),
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$table->data['block_mode'][0] = '<strong>'.__('Block Mode').'</strong>';
|
$table->data[2][] = html_print_label_input_block(
|
||||||
$table->data['block_mode'][1] = html_print_checkbox('block_mode', 1, $block_mode, true);
|
__('Format'),
|
||||||
|
html_print_input_text(
|
||||||
|
'format',
|
||||||
|
$data_format,
|
||||||
|
'',
|
||||||
|
50,
|
||||||
|
100,
|
||||||
|
true
|
||||||
|
).ui_print_input_placeholder(
|
||||||
|
__('separate fields with ').SEPARATOR_COLUMN,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$table->data[4][0] = '<strong>'.__('Format').'</strong>';
|
$table->data[2][] = html_print_label_input_block(
|
||||||
$table->data[4][0] .= ui_print_help_tip(__('separate fields with ').SEPARATOR_COLUMN, true);
|
__('Block Mode'),
|
||||||
$table->data[4][1] = html_print_input_text('format', $data_format, '', 50, 100, true);
|
html_print_checkbox_switch(
|
||||||
|
'block_mode',
|
||||||
$table->data[5][0] = '<strong>'.__('Script mode').'</strong>';
|
|
||||||
$table->data[5][0] .= ui_print_help_tip(__(''), true);
|
|
||||||
$table->data[5][1] = __('Use script');
|
|
||||||
$table->data[5][1] .= html_print_radio_button(
|
|
||||||
'script_mode',
|
|
||||||
1,
|
1,
|
||||||
'',
|
$block_mode,
|
||||||
$script_mode,
|
|
||||||
true
|
true
|
||||||
).' ';
|
)
|
||||||
$table->data[5][1] .= '    '.__('Use inline code');
|
);
|
||||||
$table->data[5][1] .= html_print_radio_button(
|
|
||||||
'script_mode',
|
$radioButtons = [];
|
||||||
2,
|
$radioButtons[] = html_print_radio_button('script_mode', 1, __('Script mode'), $script_mode, true);
|
||||||
'',
|
$radioButtons[] = html_print_radio_button('script_mode', 2, __('Use inline code'), $script_mode, true);
|
||||||
$script_mode,
|
|
||||||
|
$table->data[3][] = html_print_label_input_block(
|
||||||
|
__('Script mode'),
|
||||||
|
html_print_div(
|
||||||
|
[
|
||||||
|
'class' => 'switch_radio_button',
|
||||||
|
'content' => implode('', $radioButtons),
|
||||||
|
],
|
||||||
true
|
true
|
||||||
).' ';
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$table->data[6][0] = '<strong>'.__('Script path').'</strong>';
|
$table->colspan[4][0] = 2;
|
||||||
$table->data[6][1] = html_print_input_text('script_path', $script_path, '', 50, 1000, true);
|
|
||||||
|
|
||||||
$table->data[7][0] = '<strong>'.__('Code').'</strong>';
|
$table->data[4][0] = html_print_label_input_block(
|
||||||
$table->data[7][0] .= ui_print_help_tip(__("Here is placed the script for the REMOTE inventory modules Local inventory modules don't use this field").SEPARATOR_COLUMN, true);
|
__('Script path'),
|
||||||
|
html_print_input_text(
|
||||||
|
'script_path',
|
||||||
|
$script_path,
|
||||||
|
'',
|
||||||
|
50,
|
||||||
|
1000,
|
||||||
|
true
|
||||||
|
),
|
||||||
|
['div_class' => 'script_path_inventory_modules']
|
||||||
|
);
|
||||||
|
|
||||||
$table->data[7][1] = html_print_textarea('code', 25, 80, base64_decode($code), '', true);
|
$table->data[4][0] .= html_print_label_input_block(
|
||||||
|
__('Code'),
|
||||||
|
html_print_textarea(
|
||||||
|
'code',
|
||||||
|
25,
|
||||||
|
80,
|
||||||
|
base64_decode($code),
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
).ui_print_input_placeholder(
|
||||||
|
__("Here is placed the script for the REMOTE inventory modules Local inventory modules don't use this field").SEPARATOR_COLUMN,
|
||||||
|
true
|
||||||
|
),
|
||||||
|
['div_class' => 'code_inventory_modules']
|
||||||
|
);
|
||||||
|
|
||||||
echo '<form name="inventorymodule" id="inventorymodule_form" method="post"
|
echo '<form name="inventorymodule" id="inventorymodule_form" class="max_floating_element_size" method="post"
|
||||||
action="index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules">';
|
action="index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules">';
|
||||||
|
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
if ($id_module_inventory) {
|
if ($id_module_inventory) {
|
||||||
html_print_input_hidden('update_module_inventory', 1);
|
html_print_input_hidden('update_module_inventory', 1);
|
||||||
html_print_input_hidden('id_module_inventory', $id_module_inventory);
|
html_print_input_hidden('id_module_inventory', $id_module_inventory);
|
||||||
|
$buttonCaption = __('Update');
|
||||||
|
$buttonIcon = 'update';
|
||||||
} else {
|
} else {
|
||||||
html_print_input_hidden('create_module_inventory', 1);
|
html_print_input_hidden('create_module_inventory', 1);
|
||||||
|
$buttonCaption = __('Create');
|
||||||
|
$buttonIcon = 'wand';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
$actionButtons = '';
|
||||||
if ($id_module_inventory) {
|
$actionButtons = html_print_submit_button(
|
||||||
html_print_submit_button(__('Update'), 'submit', false, 'class="sub next"');
|
$buttonCaption,
|
||||||
} else {
|
'submit',
|
||||||
html_print_submit_button(__('Create'), 'submit', false, 'class="sub upd"');
|
false,
|
||||||
}
|
['icon' => $buttonIcon],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$actionButtons .= html_print_go_back_button(
|
||||||
|
'index.php?sec=gmodules&sec2=godmode/modules/manage_inventory_modules',
|
||||||
|
['button_class' => ''],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
echo '</div>';
|
html_print_action_buttons($actionButtons);
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@ -180,21 +274,21 @@ echo '</form>';
|
|||||||
var mode = <?php echo $script_mode; ?>;
|
var mode = <?php echo $script_mode; ?>;
|
||||||
|
|
||||||
if (mode == 1) {
|
if (mode == 1) {
|
||||||
$('#table1-6').show();
|
$('.script_path_inventory_modules').show();
|
||||||
$('#table1-7').hide();
|
$('.code_inventory_modules').hide();
|
||||||
} else {
|
} else {
|
||||||
$('#table1-7').show();
|
$('.code_inventory_modules').show();
|
||||||
$('#table1-6').hide();
|
$('.script_path_inventory_modules').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
$('input[type=radio][name=script_mode]').change(function() {
|
$('input[type=radio][name=script_mode]').change(function() {
|
||||||
if (this.value == 1) {
|
if (this.value == 1) {
|
||||||
$('#table1-6').show();
|
$('.script_path_inventory_modules').show();
|
||||||
$('#table1-7').hide();
|
$('.code_inventory_modules').hide();
|
||||||
}
|
}
|
||||||
else if (this.value == 2) {
|
else if (this.value == 2) {
|
||||||
$('#table1-7').show();
|
$('.code_inventory_modules').show();
|
||||||
$('#table1-6').hide();
|
$('.script_path_inventory_modules').hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user