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'} or $opts{'edit.x'} or $opts{action} eq 'Post') {
90 displayError 'Action not defined!';
94 unless ($opts{action} eq 'Add') {
95 unless ($opts{name}) {
96 displayError 'System not defined!';
103 if ($opts{action} eq 'Add') {
104 display h1 {class => 'center'}, 'Add System';
106 } elsif ($opts{'delete.x'}) {
107 ($err, $msg) = $clearadm->DeleteSystem ($opts{name});
109 display h1 { class => 'center'}, ucfirst $opts{name} . ' deleted';
110 } elsif ($opts{'edit.x'}) {
111 display h1 {class => 'center'}, 'Edit System: ', ucfirst $opts{name};
112 editSystem ($opts{name});
113 } elsif ($opts{action} eq 'Post') {
114 delete $opts{action};
116 my %system = $clearadm->GetSystem ($opts{name});
118 $opts{active} = 'false'
119 unless $opts{active};
122 ($err, $msg) = $clearadm->UpdateSystem ($opts{name}, %opts);
125 displayError "$msg (Status: $err)";
127 display h1 {class => 'center'}, ucfirst $opts{name} . ' updated';
129 displaySystem ($opts{name});
132 ($err, $msg) = $clearadm->AddSystem (%opts);
135 displayError "$msg (Status: $err)";
137 display h1 {class => 'center'}, ucfirst $opts{name} . ' updated';
139 displaySystem ($opts{name});
143 displayError "Unknown action - $opts{action}";
150 =head1 CONFIGURATION AND ENVIRONMENT
152 DEBUG: If set then $debug is set to this level.
154 VERBOSE: If set then $verbose is set to this level.
156 TRACE: If set then $trace is set to this level.
164 L<CGI::Carp|CGI::Carp>
168 L<Getopt::Long|Getopt::Long>
170 =head2 ClearSCM Perl Modules
184 <a href="http://clearscm.com/php/scm_man.php?file=clearadm/lib/Clearadm.pm">Clearadm</a><br>
185 <a href="http://clearscm.com/php/scm_man.php?file=clearadm/lib/ClearadmWeb.pm">ClearadmWeb</a><br>
186 <a href="http://clearscm.com/php/scm_man.php?file=lib/Display.pm">Display</a><br>
187 <a href="http://clearscm.com/php/scm_man.php?file=lib/Utils.pm">Utils</a><br>
192 =head1 BUGS AND LIMITATIONS
194 There are no known bugs in this script
196 Please report problems to Andrew DeFaria <Andrew@ClearSCM.com>.
198 =head1 LICENSE AND COPYRIGHT
200 Copyright (c) 2010, ClearSCM, Inc. All rights reserved.