5 =head1 NAME $RCSfile: processsystem.cgi,v $
15 Andrew DeFaria <Andrew@ClearSCM.com>
23 Mon Oct 25 11:10:47 PDT 2008
27 $Date: 2011/02/14 14:53:51 $
33 Usage processsystem.cgi: [-u|sage] [-ve|rbose] [-d|ebug]
34 action=[Add|Delete|Edit|Post] system=<systemname>
38 -u|sage: Displays usage
40 -d|ebug: Output debug messages
42 action: Specifies to add, delete, edit or post an alert
43 system: Name of alert to delete or edit
47 This script adds, deletes, edits or posts an alert
56 use CGI qw (:standard :cgi-lib *table start_Tr end_Tr);
57 use CGI::Carp 'fatalsToBrowser';
59 use lib "$FindBin::Bin/lib", "$FindBin::Bin/../lib";
66 my $VERSION = '$Revision: 1.6 $';
67 ($VERSION) = ($VERSION =~ /\$Revision: (.*) /);
73 usage => sub { Usage },
74 verbose => sub { set_verbose },
75 debug => sub { set_debug },
76 ) or Usage 'Invalid parameter';
79 verbose "$FindBin::Script v$VERSION";
81 $clearadm = Clearadm->new;
85 my $title = 'Process System';
89 unless ($opts{'delete.x'}
91 or $opts{action} eq 'Post'
92 or $opts{action} eq 'Add'
94 displayError 'Action not defined!';
98 unless ($opts{action} eq 'Add') {
99 unless ($opts{name}) {
100 displayError 'System not defined!';
107 if ($opts{action} eq 'Add') {
108 display h1 {class => 'center'}, 'Add System';
110 } elsif ($opts{'delete.x'}) {
111 ($err, $msg) = $clearadm->DeleteSystem ($opts{name});
113 display h1 { class => 'center'}, ucfirst $opts{name} . ' deleted';
114 } elsif ($opts{'edit.x'}) {
115 display h1 {class => 'center'}, 'Edit System: ', ucfirst $opts{name};
116 editSystem ($opts{name});
117 } elsif ($opts{action} eq 'Post') {
118 delete $opts{action};
120 my %system = $clearadm->GetSystem ($opts{name});
122 $opts{active} = 'false'
123 unless $opts{active};
126 ($err, $msg) = $clearadm->UpdateSystem ($opts{name}, %opts);
129 displayError "$msg (Status: $err)";
131 display h1 {class => 'center'}, ucfirst $opts{name} . ' updated';
133 displaySystem ($opts{name});
136 ($err, $msg) = $clearadm->AddSystem (%opts);
139 displayError "$msg (Status: $err)";
141 display h1 {class => 'center'}, ucfirst $opts{name} . ' updated';
143 displaySystem ($opts{name});
147 displayError "Unknown action - $opts{action}";
154 =head1 CONFIGURATION AND ENVIRONMENT
156 DEBUG: If set then $debug is set to this level.
158 VERBOSE: If set then $verbose is set to this level.
160 TRACE: If set then $trace is set to this level.
168 L<CGI::Carp|CGI::Carp>
172 L<Getopt::Long|Getopt::Long>
174 =head2 ClearSCM Perl Modules
188 <a href="http://clearscm.com/php/scm_man.php?file=clearadm/lib/Clearadm.pm">Clearadm</a><br>
189 <a href="http://clearscm.com/php/scm_man.php?file=clearadm/lib/ClearadmWeb.pm">ClearadmWeb</a><br>
190 <a href="http://clearscm.com/php/scm_man.php?file=lib/Display.pm">Display</a><br>
191 <a href="http://clearscm.com/php/scm_man.php?file=lib/Utils.pm">Utils</a><br>
196 =head1 BUGS AND LIMITATIONS
198 There are no known bugs in this script
200 Please report problems to Andrew DeFaria <Andrew@ClearSCM.com>.
202 =head1 LICENSE AND COPYRIGHT
204 Copyright (c) 2010, ClearSCM, Inc. All rights reserved.