fix: t::WebGUI::PseudoRequest now works properly
add: Added some additional vars to Calendar Week view fix: WebGUI::DateTime now handles MySQL strings more robustly
This commit is contained in:
parent
74b688810f
commit
991aac998a
5 changed files with 85 additions and 15 deletions
|
|
@ -1019,7 +1019,6 @@ sub viewDay {
|
||||||
### Get all the events in this time period
|
### Get all the events in this time period
|
||||||
# Get the range of the epoch of this day
|
# Get the range of the epoch of this day
|
||||||
my $dt = WebGUI::DateTime->new($session, $params->{start});
|
my $dt = WebGUI::DateTime->new($session, $params->{start});
|
||||||
$dt->set_locale($i18n->get("locale"));
|
|
||||||
$dt->truncate( to => "day");
|
$dt->truncate( to => "day");
|
||||||
|
|
||||||
my @events = $self->getEventsIn($dt->toMysql,$dt->clone->add(days => 1)->toMysql);
|
my @events = $self->getEventsIn($dt->toMysql,$dt->clone->add(days => 1)->toMysql);
|
||||||
|
|
@ -1113,7 +1112,6 @@ sub viewMonth {
|
||||||
#### Get all the events in this time period
|
#### Get all the events in this time period
|
||||||
# Get the range of the epoch of this month
|
# Get the range of the epoch of this month
|
||||||
my $dt = WebGUI::DateTime->new($self->session, $params->{start});
|
my $dt = WebGUI::DateTime->new($self->session, $params->{start});
|
||||||
$dt->set_locale($i18n->get("locale"));
|
|
||||||
$dt->truncate( to => "month");
|
$dt->truncate( to => "month");
|
||||||
|
|
||||||
my @events
|
my @events
|
||||||
|
|
@ -1292,7 +1290,6 @@ sub viewWeek {
|
||||||
for my $event (@events) {
|
for my $event (@events) {
|
||||||
# Get the week this event is in, and add it to that week in
|
# Get the week this event is in, and add it to that week in
|
||||||
# the template variables
|
# the template variables
|
||||||
|
|
||||||
my $dt_event_start = $event->getDateTimeStart;
|
my $dt_event_start = $event->getDateTimeStart;
|
||||||
my $dt_event_end = $event->getDateTimeEnd;
|
my $dt_event_end = $event->getDateTimeEnd;
|
||||||
$dt_event_start->set_locale($i18n->get("locale"));
|
$dt_event_start->set_locale($i18n->get("locale"));
|
||||||
|
|
@ -1311,6 +1308,7 @@ sub viewWeek {
|
||||||
$var->{"pagePrevUrl"}
|
$var->{"pagePrevUrl"}
|
||||||
= $self->getUrl("type=week;start=" . $dt->clone->subtract(weeks=>1)->toMysql);
|
= $self->getUrl("type=week;start=" . $dt->clone->subtract(weeks=>1)->toMysql);
|
||||||
|
|
||||||
|
$var->{"startMonth" } = $dt->month;
|
||||||
$var->{"startMonthName" } = $dt->month_name;
|
$var->{"startMonthName" } = $dt->month_name;
|
||||||
$var->{"startMonthAbbr" } = $dt->month_abbr;
|
$var->{"startMonthAbbr" } = $dt->month_abbr;
|
||||||
$var->{"startDayOfMonth" } = $dt->day_of_month;
|
$var->{"startDayOfMonth" } = $dt->day_of_month;
|
||||||
|
|
@ -1318,6 +1316,7 @@ sub viewWeek {
|
||||||
$var->{"startDayAbbr" } = $dt->day_abbr;
|
$var->{"startDayAbbr" } = $dt->day_abbr;
|
||||||
$var->{"startYear" } = $dt->year;
|
$var->{"startYear" } = $dt->year;
|
||||||
|
|
||||||
|
$var->{"endMonth" } = $dtEnd->month;
|
||||||
$var->{"endMonthName" } = $dtEnd->month_name;
|
$var->{"endMonthName" } = $dtEnd->month_name;
|
||||||
$var->{"endMonthAbbr" } = $dtEnd->month_abbr;
|
$var->{"endMonthAbbr" } = $dtEnd->month_abbr;
|
||||||
$var->{"endDayOfMonth" } = $dtEnd->day_of_month;
|
$var->{"endDayOfMonth" } = $dtEnd->day_of_month;
|
||||||
|
|
|
||||||
|
|
@ -611,16 +611,23 @@ DateTime
|
||||||
sub _splitMysql
|
sub _splitMysql
|
||||||
{
|
{
|
||||||
my $string = shift;
|
my $string = shift;
|
||||||
my ($y,$m,$d,$h,$n,$s) = split /\D+/,$string;
|
my %hash;
|
||||||
my %hash = (
|
|
||||||
year => $y,
|
@hash{ qw( year month day hour minute second ) }
|
||||||
month => $m,
|
= $string =~ m{
|
||||||
day => $d,
|
(\d+) # Year
|
||||||
hour => $h,
|
\D*
|
||||||
minute => $n,
|
(\d+) # Month
|
||||||
second => $s,
|
\D*
|
||||||
);
|
(\d+) # Day
|
||||||
|
\D*
|
||||||
|
(\d+) # Hours
|
||||||
|
\D*
|
||||||
|
(\d+) # Minutes
|
||||||
|
\D*
|
||||||
|
(\d+) # Seconds
|
||||||
|
}x;
|
||||||
|
|
||||||
return %hash;
|
return %hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -221,6 +221,9 @@ our $HELP = {
|
||||||
'name' => 'pagePrevUrl',
|
'name' => 'pagePrevUrl',
|
||||||
'description' => 'pagePrevUrl weekVar'
|
'description' => 'pagePrevUrl weekVar'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'name' => 'startMonth',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'name' => 'startMonthName'
|
'name' => 'startMonthName'
|
||||||
},
|
},
|
||||||
|
|
@ -239,6 +242,9 @@ our $HELP = {
|
||||||
{
|
{
|
||||||
'name' => 'startYear'
|
'name' => 'startYear'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'name' => 'endMonth',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'name' => 'endMonthName'
|
'name' => 'endMonthName'
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -276,6 +276,18 @@ our $I18N = {
|
||||||
context => q{Description of what the Calendar Update Feeds workflow activity does},
|
context => q{Description of what the Calendar Update Feeds workflow activity does},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'workflow generateRecurringEvents' => {
|
||||||
|
message => q{Generate Recurring Events},
|
||||||
|
lastUpdated => 0,
|
||||||
|
context => q{The name of the CalendarGenerateRecurringEvents workflow activity},
|
||||||
|
},
|
||||||
|
|
||||||
|
'workflow generateRecurringEvents description' => {
|
||||||
|
message => q{This activity generates recurring events for calendars. }
|
||||||
|
. q{This activity also maintains recurring events in the future.},
|
||||||
|
lastUpdated => 0,
|
||||||
|
context => q{Description of what the CalendarGenerateRecurringEvents workflow activity does},
|
||||||
|
},
|
||||||
|
|
||||||
#################### HELP PAGES ####################
|
#################### HELP PAGES ####################
|
||||||
|
|
||||||
|
|
@ -510,6 +522,11 @@ our $I18N = {
|
||||||
lastUpdated => 1171171998,
|
lastUpdated => 1171171998,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'startMonth' => {
|
||||||
|
message => q{The number (1-12) of the month this week starts.},
|
||||||
|
lastUpdated => 1171043883,
|
||||||
|
},
|
||||||
|
|
||||||
'startMonthName' => {
|
'startMonthName' => {
|
||||||
message => q|The name of the month this week starts.|,
|
message => q|The name of the month this week starts.|,
|
||||||
lastUpdated => 1171043883,
|
lastUpdated => 1171043883,
|
||||||
|
|
@ -540,6 +557,11 @@ our $I18N = {
|
||||||
lastUpdated => 1171043883,
|
lastUpdated => 1171043883,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'endMonth' => {
|
||||||
|
message => q{The number (1-12) of the month this week ends.},
|
||||||
|
lastUpdated => 117104883,
|
||||||
|
},
|
||||||
|
|
||||||
'endMonthName' => {
|
'endMonthName' => {
|
||||||
message => q|The name of the month this week ends.|,
|
message => q|The name of the month this week ends.|,
|
||||||
lastUpdated => 1171043883,
|
lastUpdated => 1171043883,
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,25 @@ sub body {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $value = shift;
|
my $value = shift;
|
||||||
return keys %{ $self->{body} } unless defined $value;
|
return keys %{ $self->{body} } unless defined $value;
|
||||||
return $self->{body}->{$value};
|
if ($self->{body}->{$value}) {
|
||||||
|
if (wantarray && ref $self->{body}->{$value} eq "ARRAY") {
|
||||||
|
return @{$self->{body}->{$value}};
|
||||||
|
}
|
||||||
|
elsif (ref $self->{body}->{$value} eq "ARRAY") {
|
||||||
|
return $self->{body}->{$value}->[0];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return $self->{body}->{$value};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (wantarray) {
|
||||||
|
return ();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub setup_body {
|
sub setup_body {
|
||||||
|
|
@ -73,7 +91,25 @@ sub param {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $value = shift;
|
my $value = shift;
|
||||||
return keys %{ $self->{param} } unless defined $value;
|
return keys %{ $self->{param} } unless defined $value;
|
||||||
return $self->{param}->{$value};
|
if ($self->{param}->{$value}) {
|
||||||
|
if (wantarray && ref $self->{param}->{$value} eq "ARRAY") {
|
||||||
|
return @{$self->{param}->{$value}};
|
||||||
|
}
|
||||||
|
elsif (ref $self->{param}->{$value} eq "ARRAY") {
|
||||||
|
return $self->{param}->{$value}->[0];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return $self->{param}->{$value};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (wantarray) {
|
||||||
|
return ();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub setup_param {
|
sub setup_param {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue