1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
<% include( 'elements/edit.html',
'name_singular' => 'log email condition',
'table' => 'log_email',
'fields' => [
{ 'field' => 'context',
'type' => 'select',
'options' => [ '', @contexts ],
'labels' => { '' => '(all)', map { $_ => $_ } @contexts },
'curr_value' => scalar($cgi->param('context')),
},
{ 'field' => 'min_level',
'type' => 'select',
'options' => [ 0..4 ],
'labels' => { map {$_ => $FS::Log::LEVELS[$_]} 0..4 },
'curr_value' => scalar($cgi->param('min_level')),
},
'to_addr',
{ 'field' => 'msgnum',
'type' => 'select-msg_template',
'empty_label' => 'Select template',
'value' => $msgnum,
'required' => 1,
},
],
'labels' => {
'context' => 'Context',
'min_level' => 'Min. Level',
'to_addr' => 'To',
'msgnum' => 'Message',
},
'viewall_dir' => 'browse',
'popup' => $opts{'popup'},
'form_init' => $opts{'popup'} ? q(<INPUT TYPE="hidden" NAME="popup" VALUE="1">) : '',
)
%>
<%once>
my @contexts = sort FS::log_context->contexts;
</%once>
<%init>
my %opts = @_;
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right([ 'View system logs', 'Configuration' ]);
my $msgnum = $cgi->param('msgnum');
unless ($msgnum) {
my ($msg_template) = qsearch('msg_template',{ msgname => 'System log' });
# doesn't seem worth having a config just for the default selected template
# if they've deleted the system-generated one, just default to empty "Select template"
if ($msg_template) {
$msgnum = $msg_template->msgnum;
}
}
</%init>
|