fix weekdaysInMonth, thanks to jankowa. fix filters on aggregations
This commit is contained in:
@@ -416,7 +416,7 @@ sub get_week_of_month_dates{
|
|||||||
return undef if $frequency eq'';
|
return undef if $frequency eq'';
|
||||||
return undef if $frequency==0;
|
return undef if $frequency==0;
|
||||||
|
|
||||||
my $start_dates=time::get_nth_weekday_in_month($start, $end, $week, $weekday-1);
|
my $start_dates=time::get_nth_weekday_in_month($start, $end, $week, $weekday);
|
||||||
|
|
||||||
if ((defined $nextDay) && ($nextDay>0)){
|
if ((defined $nextDay) && ($nextDay>0)){
|
||||||
for (my $i=0;$i<@$start_dates;$i++){
|
for (my $i=0;$i<@$start_dates;$i++){
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ our @EXPORT_OK = qw(
|
|||||||
date_cond time_cond check_date check_time check_datetime check_year_month
|
date_cond time_cond check_date check_time check_datetime check_year_month
|
||||||
datetime_to_rfc822 get_datetime datetime_to_utc datetime_to_utc_datetime
|
datetime_to_rfc822 get_datetime datetime_to_utc datetime_to_utc_datetime
|
||||||
get_duration get_duration_seconds
|
get_duration get_duration_seconds
|
||||||
get_durations get_names get_all_names get_weekdays weekday_index
|
get_durations get_names get_all_names weekday_index
|
||||||
$names
|
$names
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -86,24 +86,24 @@ our $weekday_index={
|
|||||||
|
|
||||||
sub get_weekdays{
|
sub get_weekdays{
|
||||||
return{
|
return{
|
||||||
0 => 0,
|
|
||||||
1 => 1,
|
1 => 1,
|
||||||
2 => 2,
|
2 => 2,
|
||||||
3 => 3,
|
3 => 3,
|
||||||
4 => 4,
|
4 => 4,
|
||||||
5 => 5,
|
5 => 5,
|
||||||
6 => 6,
|
6 => 6,
|
||||||
'Mo'=>0,
|
7 => 7,
|
||||||
'Tu'=>1,
|
'Mo'=>1,
|
||||||
'Di'=>1,
|
'Tu'=>2,
|
||||||
'We'=>2,
|
'Di'=>2,
|
||||||
'Mi'=>2,
|
'We'=>3,
|
||||||
'Th'=>3,
|
'Mi'=>3,
|
||||||
'Do'=>3,
|
'Th'=>4,
|
||||||
'Fr'=>4,
|
'Do'=>4,
|
||||||
'Sa'=>5,
|
'Fr'=>5,
|
||||||
'Su'=>6,
|
'Sa'=>6,
|
||||||
'So'=>6
|
'Su'=>7,
|
||||||
|
'So'=>7
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -518,14 +518,15 @@ sub get_event_date{
|
|||||||
|
|
||||||
my $datetime=time::time_to_datetime(time());
|
my $datetime=time::time_to_datetime(time());
|
||||||
my $hour=(time::datetime_to_array($datetime))->[3];
|
my $hour=(time::datetime_to_array($datetime))->[3];
|
||||||
|
#print STDERR "datetime=$datetime hour=$hour\n";
|
||||||
#today: between 0:00 and starting_hour show last day
|
#today: between 0:00 and starting_hour show last day
|
||||||
if ($hour < $config->{date}->{day_starting_hour}){
|
if ($hour < $config->{date}->{day_starting_hour}){
|
||||||
my $date=time::datetime_to_array(time::add_hours_to_datetime($datetime,-24));
|
my $date=time::datetime_to_array(time::add_days_to_datetime($datetime,-1));
|
||||||
return $date->[0].'-'.$date->[1].'-'.$date->[2];
|
return join('-', ($date->[0], $date->[1], $date->[2]) );
|
||||||
}else{
|
}else{
|
||||||
#today: between starting_hour and end of day show current day
|
#today: between starting_hour and end of day show current day
|
||||||
my $date=time::datetime_to_array(time::time_to_datetime(time()));
|
my $date=time::datetime_to_array(time::time_to_datetime(time()));
|
||||||
return $date->[0]."-".$date->[1]."-".$date->[2];
|
return join('-', ($date->[0], $date->[1], $date->[2]) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -562,12 +563,19 @@ sub get_nth_weekday_in_month{
|
|||||||
my $start = shift; # datetime string
|
my $start = shift; # datetime string
|
||||||
my $end = shift; # datetime string
|
my $end = shift; # datetime string
|
||||||
my $nth = shift; # every nth week of month
|
my $nth = shift; # every nth week of month
|
||||||
my $weekday=shift; # weekday [0..6,'Mo'-'Su','Mo'-'Fr']
|
my $weekday = shift; # weekday [1..7,'Mo'-'Su','Mo'-'Fr']
|
||||||
|
|
||||||
|
return [] unless defined $start;
|
||||||
|
return [] unless defined $end;
|
||||||
|
return [] unless defined $nth;
|
||||||
|
return [] unless defined $weekday;
|
||||||
|
|
||||||
my $weekdays = time::get_weekdays();
|
my $weekdays = time::get_weekdays();
|
||||||
$weekday=$weekdays->{$weekday+1};
|
return [] unless defined $weekdays->{$weekday};
|
||||||
|
$weekday = $weekdays->{$weekday};
|
||||||
|
|
||||||
my $dates=[];
|
my $dates=[];
|
||||||
|
|
||||||
if ($start=~/(\d\d\d\d)-(\d\d)-(\d\d)[ T](\d\d)\:(\d\d)/){
|
if ($start=~/(\d\d\d\d)-(\d\d)-(\d\d)[ T](\d\d)\:(\d\d)/){
|
||||||
my $hour=int($4);
|
my $hour=int($4);
|
||||||
my $min=int($5);
|
my $min=int($5);
|
||||||
|
|||||||
@@ -58,14 +58,30 @@ sub get_user{
|
|||||||
# get all users
|
# get all users
|
||||||
sub get_users{
|
sub get_users{
|
||||||
my $config = shift;
|
my $config = shift;
|
||||||
|
my $condition = shift;
|
||||||
|
|
||||||
|
my @conditions=();
|
||||||
|
my @bind_values=();
|
||||||
|
|
||||||
|
for my $key ('name', 'email'){
|
||||||
|
my $value = $condition->{$key};
|
||||||
|
next unless defined $value;
|
||||||
|
next if $value eq '';
|
||||||
|
push @conditions, $key.'=?';
|
||||||
|
push @bind_values, $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $conditions='';
|
||||||
|
$conditions=" where ".join(" and ",@conditions) if (scalar @conditions>0);
|
||||||
|
|
||||||
my $query=qq{
|
my $query=qq{
|
||||||
select id, name, full_name, email, disabled, modified_at, created_at
|
select id, name, full_name, email, disabled, modified_at, created_at
|
||||||
from calcms_users
|
from calcms_users
|
||||||
|
$conditions
|
||||||
};
|
};
|
||||||
|
|
||||||
my $dbh = db::connect($config);
|
my $dbh = db::connect($config);
|
||||||
my $users=db::get($dbh, $query);
|
my $users = db::get($dbh, $query, \@bind_values);
|
||||||
return $users;
|
return $users;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,7 +109,7 @@ sub get_users_by_studio{
|
|||||||
}
|
}
|
||||||
|
|
||||||
my $conditions='';
|
my $conditions='';
|
||||||
$conditions=" and ".join(" and ",@conditions) if (@conditions>0);
|
$conditions=" and ".join(" and ",@conditions) if (scalar @conditions>0);
|
||||||
|
|
||||||
my $query=qq{
|
my $query=qq{
|
||||||
select distinct(u.id), u.name, u.full_name
|
select distinct(u.id), u.name, u.full_name
|
||||||
@@ -808,9 +824,11 @@ sub print_warn{
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub print_error{
|
sub print_error{
|
||||||
|
my $message=shift;
|
||||||
|
print STDERR "ERROR:".$message."\n";
|
||||||
print '<div class="error" head>'
|
print '<div class="error" head>'
|
||||||
.'<span class="ui-icon ui-icon-alert" style="float:left"></span> '
|
.'<span class="ui-icon ui-icon-alert" style="float:left"></span> '
|
||||||
.$_[0].
|
.$message.
|
||||||
'</div>'."\n";
|
'</div>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ sub get_week_of_month_dates{
|
|||||||
return undef if $frequency eq'';
|
return undef if $frequency eq'';
|
||||||
return undef if $frequency==0;
|
return undef if $frequency==0;
|
||||||
|
|
||||||
my $start_dates=time::get_nth_weekday_in_month($start, $end, $week, $weekday-1);
|
my $start_dates=time::get_nth_weekday_in_month($start, $end, $week, $weekday);
|
||||||
|
|
||||||
my $results=[];
|
my $results=[];
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,6 @@ if ( $0 =~ /aggregate.*?\.cgi$/ ) {
|
|||||||
my %params = $cgi->Vars();
|
my %params = $cgi->Vars();
|
||||||
my $params = \%params;
|
my $params = \%params;
|
||||||
|
|
||||||
#print STDERR Dumper($params);
|
|
||||||
|
|
||||||
my $config = config::get('config/config.cgi');
|
my $config = config::get('config/config.cgi');
|
||||||
my $debug = $config->{system}->{debug};
|
my $debug = $config->{system}->{debug};
|
||||||
my $mem_debug = $config->{system}->{debug_memory};
|
my $mem_debug = $config->{system}->{debug_memory};
|
||||||
@@ -44,8 +42,11 @@ if ( $0 =~ /aggregate.*?\.cgi$/ ) {
|
|||||||
$output_header .= "Content-type:text/html; charset=UTF-8;\n\n";
|
$output_header .= "Content-type:text/html; charset=UTF-8;\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
# $output_header.='<!DOCTYPE html>'."\n";
|
$params->{exclude_locations} = 1;
|
||||||
|
$params->{exclude_projects} = 1;
|
||||||
|
$params->{exclude_event_images} = 1;
|
||||||
|
|
||||||
|
# $output_header.='<!DOCTYPE html>'."\n";
|
||||||
my $request = {
|
my $request = {
|
||||||
url => $ENV{QUERY_STRING},
|
url => $ENV{QUERY_STRING},
|
||||||
params => {
|
params => {
|
||||||
@@ -54,6 +55,7 @@ if ( $0 =~ /aggregate.*?\.cgi$/ ) {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
$params = $request->{params}->{checked};
|
$params = $request->{params}->{checked};
|
||||||
|
#print STDERR Dumper($params);
|
||||||
|
|
||||||
my $mem = 0;
|
my $mem = 0;
|
||||||
log::init($request);
|
log::init($request);
|
||||||
|
|||||||
@@ -104,6 +104,8 @@ project Corax
|
|||||||
# limit creating comments in days before and after start of event
|
# limit creating comments in days before and after start of event
|
||||||
no_new_comments_before 10
|
no_new_comments_before 10
|
||||||
no_new_comments_after 60
|
no_new_comments_after 60
|
||||||
|
|
||||||
|
# hide_event_images 1
|
||||||
</permissions>
|
</permissions>
|
||||||
|
|
||||||
<access>
|
<access>
|
||||||
|
|||||||
@@ -747,7 +747,7 @@ a#calcms_search_show_details #plus{
|
|||||||
#player{
|
#player{
|
||||||
border:0;
|
border:0;
|
||||||
padding:0;
|
padding:0;
|
||||||
height:64px;
|
height:3rem;
|
||||||
}
|
}
|
||||||
#player:hover{
|
#player:hover{
|
||||||
opacity:0.9;
|
opacity:0.9;
|
||||||
|
|||||||
Reference in New Issue
Block a user