2019-01-30 16:18:44 +01:00
|
|
|
<?php
|
2023-02-20 13:02:24 +01:00
|
|
|
/**
|
|
|
|
* OS Builder
|
|
|
|
*
|
|
|
|
* @category Os
|
|
|
|
* @package Pandora FMS
|
|
|
|
* @subpackage Community
|
|
|
|
* @version 1.0.0
|
|
|
|
* @license See below
|
|
|
|
*
|
|
|
|
* ______ ___ _______ _______ ________
|
|
|
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
|
|
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
|
|
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
|
|
|
*
|
|
|
|
* ============================================================================
|
|
|
|
* Copyright (c) 2005-2023 Artica Soluciones Tecnologicas
|
|
|
|
* Please see http://pandorafms.org for full contribution list
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation for version 2.
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
* ============================================================================
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Load global vars.
|
2010-09-09 16:07:21 +02:00
|
|
|
global $config;
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
check_login();
|
2010-09-09 16:07:21 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
|
2022-02-01 13:39:18 +01:00
|
|
|
db_pandora_audit(
|
|
|
|
AUDIT_LOG_ACL_VIOLATION,
|
|
|
|
'Trying to access Setup Management'
|
|
|
|
);
|
2019-01-30 16:18:44 +01:00
|
|
|
include 'general/noaccess.php';
|
|
|
|
return;
|
2010-09-09 16:07:21 +02:00
|
|
|
}
|
|
|
|
|
2023-02-20 13:02:24 +01:00
|
|
|
$icons = get_list_os_icons_dir();
|
|
|
|
|
|
|
|
$iconData = [];
|
|
|
|
$iconData[] = html_print_select(
|
|
|
|
$icons,
|
|
|
|
'icon',
|
|
|
|
$icon,
|
|
|
|
'show_icon_OS();',
|
|
|
|
__('None'),
|
|
|
|
0,
|
|
|
|
true
|
|
|
|
);
|
|
|
|
$iconData[] = html_print_div(
|
|
|
|
[
|
|
|
|
'id' => 'icon_image',
|
2023-03-16 18:51:54 +01:00
|
|
|
'class' => 'invert_filter main_menu_icon',
|
2023-02-20 13:02:24 +01:00
|
|
|
'style' => 'margin-left: 10px',
|
|
|
|
'content' => ui_print_os_icon($idOS, false, true),
|
|
|
|
],
|
|
|
|
true
|
|
|
|
);
|
|
|
|
|
2023-02-24 14:34:32 +01:00
|
|
|
echo '<form id="form_setup" method="post">';
|
|
|
|
$table = new stdClass();
|
|
|
|
$table->width = '100%';
|
|
|
|
$table->class = 'databox filter-table-adv';
|
|
|
|
|
|
|
|
// $table->style[0] = 'width: 15%';
|
|
|
|
$table->data[0][] = html_print_label_input_block(
|
|
|
|
__('Name'),
|
|
|
|
html_print_input_text('name', $name, __('Name'), 20, 30, true, false, false, '', 'w250px')
|
|
|
|
);
|
|
|
|
|
|
|
|
$table->data[0][] = html_print_label_input_block(
|
|
|
|
__('Icon'),
|
|
|
|
html_print_div(
|
|
|
|
[
|
|
|
|
'class' => 'flex-row-center',
|
|
|
|
'content' => implode('', $iconData),
|
|
|
|
],
|
|
|
|
true
|
|
|
|
)
|
2023-02-20 13:02:24 +01:00
|
|
|
);
|
2010-09-09 16:07:21 +02:00
|
|
|
|
2023-02-24 14:34:32 +01:00
|
|
|
$table->data[1][] = html_print_label_input_block(
|
|
|
|
__('Description'),
|
|
|
|
html_print_textarea('description', 5, 20, $description, '', true, 'w250px')
|
|
|
|
);
|
2014-06-09 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_config.php, general/login_page.php: improved
the source code style.
* godmode/setup/os.builder.php: fixed the form.
* godmode/update_manager_xxx/*, godmode/menu.php,
include/functions_update_manager.php,
include/ajax/update_manager.ajax.php,
include/graphs/functions_gd.php, include/graphs/functions_flot.php,
include/config_process.php, include/javascript/update_manager.js,
include/javascript/jquery.knob.js,
include/javascript/jquery.iframe-transport.js,
include/javascript/jquery.fileupload.js, images/check-cross.png:
first version of new update manager.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10144 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-06-09 15:33:55 +02:00
|
|
|
|
2011-04-27 15:43:31 +02:00
|
|
|
html_print_table($table);
|
2010-09-09 16:07:21 +02:00
|
|
|
|
2011-04-27 15:43:31 +02:00
|
|
|
html_print_input_hidden('id_os', $idOS);
|
2019-01-30 16:18:44 +01:00
|
|
|
html_print_input_hidden('action', $actionHidden);
|
2010-09-09 16:07:21 +02:00
|
|
|
|
2023-02-20 13:02:24 +01:00
|
|
|
html_print_action_buttons(
|
|
|
|
html_print_submit_button($textButton, 'update_button', false, $classButton, true),
|
|
|
|
['type' => 'form_action']
|
|
|
|
);
|
|
|
|
|
2010-09-09 16:07:21 +02:00
|
|
|
echo '</form>';
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
|
|
|
|
function get_list_os_icons_dir()
|
|
|
|
{
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
$return = [];
|
|
|
|
|
2023-02-20 13:02:24 +01:00
|
|
|
$items = scandir($config['homedir'].'/images/');
|
2019-01-30 16:18:44 +01:00
|
|
|
|
|
|
|
foreach ($items as $item) {
|
2023-02-20 13:02:24 +01:00
|
|
|
if (strstr($item, '@os.svg')) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$return[$item] = $item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-12 14:44:01 +02:00
|
|
|
$items2 = scandir($config['homedir'].'/images/os_icons');
|
|
|
|
|
|
|
|
foreach ($items2 as $item2) {
|
|
|
|
if (strstr($item2, '_small.png') || strstr($item2, '_small.gif')
|
|
|
|
|| strstr($item2, '_small.jpg')
|
|
|
|
) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strstr($item2, '.png') || strstr($item2, '.gif')
|
|
|
|
|| strstr($item2, '.jpg')
|
|
|
|
) {
|
|
|
|
$return[$item2] = $item2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
return $return;
|
2010-09-09 16:07:21 +02:00
|
|
|
}
|
2019-01-30 16:18:44 +01:00
|
|
|
|
|
|
|
|
2010-09-09 16:07:21 +02:00
|
|
|
?>
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
function show_icon_OS() {
|
2023-04-12 14:44:01 +02:00
|
|
|
var extension = $("#icon").val().split('.').pop();
|
2011-02-28 17:53:09 +01:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
var params = [];
|
|
|
|
params.push("get_image_path=1");
|
2023-04-12 14:44:01 +02:00
|
|
|
if (extension !== 'svg') {
|
|
|
|
params.push('img_src=images/os_icons/' + $("#icon").val());
|
|
|
|
} else {
|
|
|
|
params.push('img_src=images/' + $("#icon").val());
|
|
|
|
}
|
2019-01-30 16:18:44 +01:00
|
|
|
params.push("page=include/ajax/skins.ajax");
|
|
|
|
jQuery.ajax ({
|
|
|
|
data: params.join ("&"),
|
|
|
|
type: 'POST',
|
|
|
|
url: action="ajax.php",
|
|
|
|
async: false,
|
|
|
|
timeout: 10000,
|
|
|
|
success: function (data) {
|
|
|
|
$("#icon_image").html(data);
|
|
|
|
}
|
|
|
|
});
|
2010-09-09 16:07:21 +02:00
|
|
|
}
|
|
|
|
</script>
|