summaryrefslogtreecommitdiff
path: root/lib/RHRD/utils.pm
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-11-25 21:52:08 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-11-25 21:52:08 (GMT)
commitb40c235c699e737431ded7c4ccdc57c5c80be770 (patch)
treed697a81e8bc73c493f5132b6af74eff6cb85c14a /lib/RHRD/utils.pm
parent1eab56a6601fc41643cdc3d9372462edf3f5000d (diff)
implemented show types
Diffstat (limited to 'lib/RHRD/utils.pm')
-rwxr-xr-xlib/RHRD/utils.pm29
1 files changed, 27 insertions, 2 deletions
diff --git a/lib/RHRD/utils.pm b/lib/RHRD/utils.pm
index 63e51c4..834f9fa 100755
--- a/lib/RHRD/utils.pm
+++ b/lib/RHRD/utils.pm
@@ -69,6 +69,7 @@ use constant {
DB_PARAM_DOW_HINT => "must be between 1 and 7 (1=Monday, ..., 7=Sunday)",
DB_PARAM_STARTTIME_HINT => "must be in format HHMM (without seperator) in 24 hour format",
DB_PARAM_LEN_HINT => "must be a positive number below 1440",
+ DB_PARAM_SHOWTYPE_HINT => "only n, r and s are allowed with n -> normal, r -> re-run, s -> special",
CMDLINE_WEEK_HINT => "must be one of W1, W2, W3, W4",
CMDLINE_DOW_HINT => "must be one of MO, TU, WE, TH, FR, SA, SU",
@@ -103,8 +104,8 @@ sub dropbox_param_type_ok
{
my ($type) = @_;
- unless(defined($type) && ($type == 'S' || $type == 'M' || $type == 'J')) {
- return (0, "unkown type '" . (defined($type) ? $type : 'undef') . "'", DB_PARAM_TYPE_HINT);
+ unless(defined($type) && ($type eq 'S' || $type eq 'M' || $type eq 'J')) {
+ return (0, "unknown type '" . (defined($type) ? $type : 'undef') . "'", DB_PARAM_TYPE_HINT);
}
return (1, 'OK', DB_PARAM_TYPE_HINT);
}
@@ -149,6 +150,30 @@ sub dropbox_param_len_ok
return (1, 'OK', DB_PARAM_LEN_HINT);
}
+sub dropbox_param_showtype_ok
+{
+ my ($type) = @_;
+
+ unless(defined($type) && ($type eq 'n' || $type eq 'r' || $type eq 's')) {
+ return (0, "unknown show-type '" . (defined($type) ? $type : 'undef') . "'", DB_PARAM_SHOWTYPE_HINT);
+ }
+ return (1, 'OK', DB_PARAM_SHOWTYPE_HINT);
+}
+
+sub dropbox_param_showtype_to_string
+{
+ my ($type) = @_;
+
+ if($type eq 'n') {
+ return "regular";
+ } elsif($type eq 'r') {
+ return "re-run";
+ } elsif($type eq 's') {
+ return "special";
+ }
+ return "invalid show-type!";
+}
+
sub cmdline_rdweek
{
my ($dow) = @_;