[wellwell-devel] [wellwell] Make maximum of [datetime list] configurable and proportional to the scope.
Stefan Hornburg
wellwell-devel at rt.icdevgroup.org
Tue Jun 22 08:07:00 UTC 2010
commit 87ad6f8e0bd52c6c28d70561e9e3349011401378
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date: Tue Jun 22 10:03:39 2010 +0200
Make maximum of [datetime list] configurable and proportional to the scope.
global/datetime.tag | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/global/datetime.tag b/global/datetime.tag
index 712baa3..1dcfb2e 100644
--- a/global/datetime.tag
+++ b/global/datetime.tag
@@ -186,7 +186,7 @@ sub {
return $from_dt;
}
} elsif ($function eq 'list') {
- my ($daily, $span, @list, $duration, $days);
+ my ($daily, $span, @list, $duration, $days, $month_limit, $month_mult, $month_max);
# daily is default scope
$scope ||= 'day';
@@ -203,13 +203,19 @@ sub {
return;
}
+ $month_limit = $::Limit->{datetime_list} || 24;
+
if ($scope eq 'year') {
$daily = DateTime::Event::Recurrence->yearly();
+ $month_mult = 365;
} elsif ($scope eq 'month') {
+ $month_mult = 30;
$daily = DateTime::Event::Recurrence->monthly();
} elsif ($scope eq 'week') {
+ $month_mult = 7;
$daily = DateTime::Event::Recurrence->weekly();
} elsif ($scope eq 'day') {
+ $month_mult = 1;
$daily = DateTime::Event::Recurrence->daily();
} else {
$Tag->error({name => 'datetime',
@@ -228,9 +234,12 @@ sub {
return;
}
- if ($duration->in_units('months') > 24) {
+ $month_max = $month_limit * $month_mult;
+
+ if ($duration->in_units('months') > $month_max) {
$Tag->error({name => 'datetime',
- set => sprintf('exceeded maximum length of daily list')});
+ set => sprintf('Exceeded maximum for list in months: %d',
+ $month_max)});
return;
}
More information about the wellwell-devel
mailing list