5 =head1 NAME $RCSfile: processtask.cgi,v $
15 Andrew DeFaria <Andrew@ClearSCM.com>
23 Mon Oct 25 11:10:47 PDT 2008
27 $Date: 2011/04/09 05:38:26 $
33 Usage processtask.cgi: [-u|sage] [-ve|rbose] [-d|ebug]
34 action=[Add|Delete|Edit|Post]
38 -u|sage: Displays usage
40 -d|ebug: Output debug messages
42 action: Specifies to add, delete, edit or post an alert
43 task: Task to delete or edit
47 This script adds, deletes, edits or posts a schedule
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.2 $';
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;
89 unless ($opts{'delete.x'} or $opts{'edit.x'} or $opts{action}) {
90 displayError 'Action not defined!';
94 unless ($opts{action} eq 'Add') {
95 unless ($opts{name}) {
96 displayError 'Task not defined!';
103 if ($opts{action} eq 'Add') {
104 display h1 {class => 'center'}, 'Add Task';
106 } elsif ($opts{'delete.x'}) {
107 ($err, $msg) = $clearadm->DeleteTask ($opts{name});
109 if ($msg !~ /Records deleted/) {
110 displayError "Unable to delete task $opts{name}\n$msg";
112 display h1 {class => 'center'}, $title;
113 display h3 {class => 'center'}, "Task $opts{name} deleted";
117 } elsif ($opts{'edit.x'}) {
118 display h1 {class => 'center'}, 'Edit Task: ', $opts{name};
119 editTask ($opts{name});
120 } elsif ($opts{action} eq 'Post') {
121 delete $opts{action};
123 my %task = $clearadm->GetTask ($opts{name});
125 if (%task or $opts{oldname}) {
126 my $name = delete $opts{oldname};
128 $name ||= $opts{name};
130 ($err, $msg) = $clearadm->UpdateTask ($name, %opts);
133 displayError "$msg (Status: $err)";
135 display h1 {class => 'center'}, $title;
136 display h3 {class => 'center'}, "Task $opts{name} updated";
141 ($err, $msg) = $clearadm->AddTask (%opts);
144 displayError "$msg (Status: $err)";
147 display h1 {class => 'center'}, $title;
148 display h3 {class => 'center'}, "Task $opts{name} added";
154 displayError "Unknown action - $opts{action}";
161 =head1 CONFIGURATION AND ENVIRONMENT
163 DEBUG: If set then $debug is set to this level.
165 VERBOSE: If set then $verbose is set to this level.
167 TRACE: If set then $trace is set to this level.
175 L<CGI::Carp|CGI::Carp>
179 L<Getopt::Long|Getopt::Long>
181 =head2 ClearSCM Perl Modules
195 <a href="http://clearscm.com/php/scm_man.php?file=clearadm/lib/Clearadm.pm">Clearadm</a><br>
196 <a href="http://clearscm.com/php/scm_man.php?file=clearadm/lib/ClearadmWeb.pm">ClearadmWeb</a><br>
197 <a href="http://clearscm.com/php/scm_man.php?file=lib/Display.pm">Display</a><br>
198 <a href="http://clearscm.com/php/scm_man.php?file=lib/Utils.pm">Utils</a><br>
203 =head1 BUGS AND LIMITATIONS
205 There are no known bugs in this script
207 Please report problems to Andrew DeFaria <Andrew@ClearSCM.com>.
209 =head1 LICENSE AND COPYRIGHT
211 Copyright (c) 2010, ClearSCM, Inc. All rights reserved.