1<?php
2$schema = DB::getSchema('config');
3?>
4
5<script type="text/javascript">
6	jQuery(document).ready(function() {
7		jQuery("#resetDefaults").click(function() {
8			overlayDialogue({
9				'title': '<?= _('Reset confirmation') ?>',
10				'content': jQuery('<span>').text('<?= _('Reset all fields to default values?') ?>'),
11				'buttons': [
12					{
13						'title': '<?= _('Cancel') ?>',
14						'cancel': true,
15						'class': '<?= ZBX_STYLE_BTN_ALT ?>',
16						'action': function() {}
17					},
18					{
19						'title': '<?= _('Reset defaults') ?>',
20						'focused': true,
21						'action': function() {
22							// Unacknowledged problem events
23							jQuery('#problem_unack_color')
24								.val("<?= $schema['fields']['problem_unack_color']['default'] ?>")
25								.change();
26							jQuery('#problem_unack_style').prop('checked',
27								<?= $schema['fields']['problem_unack_style']['default'] == 0 ? 'false' : 'true' ?>
28							);
29
30							// Acknowledged problem events
31							jQuery('#problem_ack_color')
32								.val("<?= $schema['fields']['problem_ack_color']['default'] ?>")
33								.change();
34							jQuery('#problem_ack_style').prop('checked',
35								<?= $schema['fields']['problem_ack_style']['default'] == 0 ? 'false' : 'true' ?>
36							);
37
38							// Unacknowledged ok events
39							jQuery('#ok_unack_color')
40								.val("<?= $schema['fields']['ok_unack_color']['default'] ?>")
41								.change();
42							jQuery('#ok_unack_style').prop('checked',
43								<?= $schema['fields']['ok_unack_style']['default'] == 0 ? 'false' : 'true' ?>
44							);
45
46							// Acknowledged ok events
47							jQuery('#ok_ack_color')
48								.val("<?= $schema['fields']['ok_ack_color']['default'] ?>")
49								.change();
50							jQuery('#ok_ack_style').prop('checked',
51								<?= $schema['fields']['ok_ack_style']['default'] == 0 ? 'false' : 'true' ?>
52							);
53
54							jQuery('#ok_period').val("<?= $schema['fields']['ok_period']['default'] ?>");
55							jQuery('#blink_period').val("<?= $schema['fields']['blink_period']['default'] ?>");
56						}
57					}
58				]
59			});
60		});
61	});
62</script>
63