Removed /usr/local from CDPATH
[clearscm.git] / clearadm / deletealertlog.cgi
1 #!/usr/local/bin/perl
2
3 =pod
4
5 =head1 NAME $RCSfile: deletealertlog.cgi,v $
6
7 Delete alertlog entries
8
9 =head1 VERSION
10
11 =over
12
13 =item Author
14
15 Andrew DeFaria <Andrew@ClearSCM.com>
16
17 =item Revision
18
19 $Revision: 1.2 $
20
21 =item Created:
22
23 Mon Oct 25 11:10:47 PDT 2008
24
25 =item Modified:
26
27 $Date: 2011/02/02 16:50:27 $
28
29 =back
30
31 =head1 SYNOPSIS
32
33  Usage deletealertlog.cgi: [-u|sage] [-ve|rbose] [-d|ebug]
34                            alertlogid=[<n>|all]
35
36  Where:
37    -u|sage:   Displays usage
38    -ve|rbose: Be verbose
39    -d|ebug:   Output debug messages
40    
41    alertlogid: Alertlog ID to delete or 'all' to clear the alertlog.
42
43 =head2 DESCRIPTION
44
45 This script deletes alertlog entries.
46
47 =cut
48
49 use strict;
50 use warnings;
51
52 use FindBin;
53 use Getopt::Long;
54 use CGI qw (:standard :cgi-lib *table start_Tr end_Tr);
55 use CGI::Carp 'fatalsToBrowser';
56
57 use lib "$FindBin::Bin/lib", "$FindBin::Bin/../lib";
58
59 use Clearadm;
60 use ClearadmWeb;
61 use Display;
62 use Utils;
63
64 my $VERSION  = '$Revision: 1.2 $';
65   ($VERSION) = ($VERSION =~ /\$Revision: (.*) /);
66   
67 my $clearadm;
68
69 # Main
70 GetOptions (
71   usage      => sub { Usage },
72   verbose    => sub { set_verbose },
73   debug      => sub { set_debug },
74 ) or Usage 'Invalid parameter';
75
76 # Announce ourselves
77 verbose "$FindBin::Script v$VERSION";
78
79 $clearadm = Clearadm->new;
80
81 my %opts = Vars;
82
83 my $title = 'Alert Log';
84
85 heading $title;
86
87 my ($err, $msg) = $clearadm->DeleteAlertlog ($opts{alertlogid});
88
89 display h1 {class => 'center'}, $title;
90
91 if ($msg eq 'Records deleted') {
92   if ($err > 1) {
93     display h3 {class => 'center'}, "Cleared all alertlog entries";
94   } else {
95     display h3 {class => 'center'}, "Deleted alertlog record";
96   } # if
97   
98   displayAlertlog (%opts);
99 } else {
100   displayError "Unable to delete alertlog entry (Status: $err)<br>$msg";
101 } # if
102
103 footing;
104
105 =pod
106
107 =head1 CONFIGURATION AND ENVIRONMENT
108
109 DEBUG: If set then $debug is set to this level.
110
111 VERBOSE: If set then $verbose is set to this level.
112
113 TRACE: If set then $trace is set to this level.
114
115 =head1 DEPENDENCIES
116
117 =head2 Perl Modules
118
119 L<CGI>
120
121 L<CGI::Carp|CGI::Carp>
122
123 L<FindBin>
124
125 L<Getopt::Long|Getopt::Long>
126
127 =head2 ClearSCM Perl Modules
128
129 =begin man 
130
131  Clearadm
132  ClearadmWeb
133  Display
134  Utils
135
136 =end man
137
138 =begin html
139
140 <blockquote>
141 <a href="http://clearscm.com/php/scm_man.php?file=clearadm/lib/Clearadm.pm">Clearadm</a><br>
142 <a href="http://clearscm.com/php/scm_man.php?file=clearadm/lib/ClearadmWeb.pm">ClearadmWeb</a><br>
143 <a href="http://clearscm.com/php/scm_man.php?file=lib/Display.pm">Display</a><br>
144 <a href="http://clearscm.com/php/scm_man.php?file=lib/Utils.pm">Utils</a><br>
145 </blockquote>
146
147 =end html
148
149 =head1 BUGS AND LIMITATIONS
150
151 There are no known bugs in this script
152
153 Please report problems to Andrew DeFaria <Andrew@ClearSCM.com>.
154
155 =head1 LICENSE AND COPYRIGHT
156
157 Copyright (c) 2010, ClearSCM, Inc. All rights reserved.
158
159 =cut