1<?php
2/*
3** Zabbix
4** Copyright (C) 2001-2021 Zabbix SIA
5**
6** This program is free software; you can redistribute it and/or modify
7** it under the terms of the GNU General Public License as published by
8** the Free Software Foundation; either version 2 of the License, or
9** (at your option) any later version.
10**
11** This program is distributed in the hope that it will be useful,
12** but WITHOUT ANY WARRANTY; without even the implied warranty of
13** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14** GNU General Public License for more details.
15**
16** You should have received a copy of the GNU General Public License
17** along with this program; if not, write to the Free Software
18** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19**/
20
21
22/**
23 * @var CView $this
24 */
25?>
26
27<script type="text/javascript">
28	$(document).ready(function() {
29		$("#resetDefaults").click(function() {
30			overlayDialogue({
31				'title': <?= json_encode(_('Reset confirmation')) ?>,
32				'content': $('<span>').text(<?= json_encode(_('Reset all fields to default values?')) ?>),
33				'buttons': [
34					{
35						'title': <?= json_encode(_('Cancel')) ?>,
36						'cancel': true,
37						'class': '<?= ZBX_STYLE_BTN_ALT ?>',
38						'action': function() {}
39					},
40					{
41						'title': <?= json_encode(_('Reset defaults')) ?>,
42						'focused': true,
43						'action': function() {
44							$('main')
45								.prev('.msg-bad')
46								.remove();
47
48							$('#default_lang').val("<?= DB::getDefault('config', 'default_lang') ?>");
49							$('#default_timezone').val("<?= DB::getDefault('config', 'default_timezone') ?>");
50							$('#default_theme').val("<?= DB::getDefault('config', 'default_theme') ?>");
51							$('#search_limit').val("<?= DB::getDefault('config', 'search_limit') ?>");
52							$('#max_overview_table_size').val(
53								"<?= DB::getDefault('config', 'max_overview_table_size') ?>"
54							);
55							$('#max_in_table').val("<?= DB::getDefault('config', 'max_in_table') ?>");
56							$('#server_check_interval').prop('checked',
57								<?= (DB::getDefault('config', 'server_check_interval') == 0) ? 'false' : 'true' ?>
58							);
59							$('#work_period').val("<?= DB::getDefault('config', 'work_period') ?>");
60							$('#show_technical_errors').prop('checked',
61								<?= (DB::getDefault('config', 'show_technical_errors') == 0) ? 'false' : 'true' ?>
62							);
63							$('#history_period').val("<?= DB::getDefault('config', 'history_period') ?>");
64							$('#period_default').val("<?= DB::getDefault('config', 'period_default') ?>");
65							$('#max_period').val("<?= DB::getDefault('config', 'max_period') ?>");
66						}
67					}
68				]
69			}, this);
70		});
71	});
72</script>
73