Handle hostnames with upper-case letters
[webmin.git] / usermin / log_parser.pl
1 # log_parser.pl
2 # Functions for parsing this module's logs
3
4 do 'usermin-lib.pl';
5
6 # parse_webmin_log(user, script, action, type, object, &params)
7 # Converts logged information from this module into human-readable form
8 sub parse_webmin_log
9 {
10 local ($user, $script, $action, $type, $object, $p) = @_;
11 if ($type eq "restrict") {
12         return &text("log_restrict_$action",
13                 $object eq "*" ? $text{'log_all'} :
14                 $object =~ /^\@(.*)$/ ? &text('log_group', "<tt>$1</tt>")
15                                       : "<tt>$object</tt>");
16         }
17 elsif ($action eq 'install') {
18         return &text('log_install', "<i>$p->{'desc'}</i>");
19         }
20 elsif ($action eq 'tinstall') {
21         return &text('log_tinstall', "<i>$p->{'desc'}</i>");
22         }
23 elsif ($action eq 'clone') {
24         return &text('log_clone', "<i>$p->{'desc'}</i>",
25                                   "<i>$p->{'dstdesc'}</i>");
26         }
27 elsif ($action eq 'delete') {
28         return &text('log_delete', "<i>$p->{'desc'}</i>");
29         }
30 elsif ($action eq 'upgrade') {
31         return &text('log_upgrade', $p->{'version'});
32         }
33 elsif ($action eq 'uinstall') {
34         return &text('log_uinstall', $p->{'version'});
35         }
36 elsif ($action eq 'theme') {
37         return $p->{'theme'} ? &text('log_theme', "<tt>$p->{'theme'}</tt>")
38                              : $text{'log_theme_def'};
39         }
40 elsif ($action eq "config") {
41         return &text('log_config', "<tt>$p->{'mod'}</tt>");
42         }
43 elsif ($action eq "uconfig") {
44         return &text('log_uconfig', "<tt>$p->{'mod'}</tt>");
45         }
46 elsif ($action eq 'switch') {
47         return &text('log_switch', "<tt>$object</tt>");
48         }
49 elsif ($text{"log_$action"}) {
50         return $text{"log_$action"};
51         }
52 else {
53         return undef;
54         }
55 }
56