diff --git a/lib/calcms/series_dates.pm b/lib/calcms/series_dates.pm index 3df09a9..9eb53b0 100644 --- a/lib/calcms/series_dates.pm +++ b/lib/calcms/series_dates.pm @@ -416,7 +416,7 @@ sub get_week_of_month_dates{ return undef if $frequency eq''; 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)){ for (my $i=0;$i<@$start_dates;$i++){ diff --git a/lib/calcms/time.pm b/lib/calcms/time.pm index 0a5a118..c8e8285 100644 --- a/lib/calcms/time.pm +++ b/lib/calcms/time.pm @@ -24,7 +24,7 @@ our @EXPORT_OK = qw( 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 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 ); @@ -86,24 +86,24 @@ our $weekday_index={ sub get_weekdays{ return{ - 0 => 0, 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, - 'Mo'=>0, - 'Tu'=>1, - 'Di'=>1, - 'We'=>2, - 'Mi'=>2, - 'Th'=>3, - 'Do'=>3, - 'Fr'=>4, - 'Sa'=>5, - 'Su'=>6, - 'So'=>6 + 7 => 7, + 'Mo'=>1, + 'Tu'=>2, + 'Di'=>2, + 'We'=>3, + 'Mi'=>3, + 'Th'=>4, + 'Do'=>4, + 'Fr'=>5, + 'Sa'=>6, + 'Su'=>7, + 'So'=>7 }; } @@ -518,14 +518,15 @@ sub get_event_date{ my $datetime=time::time_to_datetime(time()); 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 if ($hour < $config->{date}->{day_starting_hour}){ - my $date=time::datetime_to_array(time::add_hours_to_datetime($datetime,-24)); - return $date->[0].'-'.$date->[1].'-'.$date->[2]; + my $date=time::datetime_to_array(time::add_days_to_datetime($datetime,-1)); + return join('-', ($date->[0], $date->[1], $date->[2]) ); }else{ #today: between starting_hour and end of day show current day 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]) ); } } @@ -559,15 +560,22 @@ sub get_datetime{ #get list of nth weekday in month from start to end sub get_nth_weekday_in_month{ - my $start=shift; # datetime string - my $end=shift; # datetime string - my $nth=shift; # every nth week of month - my $weekday=shift; # weekday [0..6,'Mo'-'Su','Mo'-'Fr'] + my $start = shift; # datetime string + my $end = shift; # datetime string + my $nth = shift; # every nth week of month + my $weekday = shift; # weekday [1..7,'Mo'-'Su','Mo'-'Fr'] - my $weekdays=time::get_weekdays(); - $weekday=$weekdays->{$weekday+1}; + return [] unless defined $start; + return [] unless defined $end; + return [] unless defined $nth; + return [] unless defined $weekday; + + my $weekdays = time::get_weekdays(); + return [] unless defined $weekdays->{$weekday}; + $weekday = $weekdays->{$weekday}; my $dates=[]; + if ($start=~/(\d\d\d\d)-(\d\d)-(\d\d)[ T](\d\d)\:(\d\d)/){ my $hour=int($4); my $min=int($5); diff --git a/lib/calcms/uac.pm b/lib/calcms/uac.pm index 9b312d3..754ee98 100644 --- a/lib/calcms/uac.pm +++ b/lib/calcms/uac.pm @@ -57,15 +57,31 @@ sub get_user{ # get all 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{ select id, name, full_name, email, disabled, modified_at, created_at from calcms_users + $conditions }; - my $dbh=db::connect($config); - my $users=db::get($dbh, $query); + my $dbh = db::connect($config); + my $users = db::get($dbh, $query, \@bind_values); return $users; } @@ -93,7 +109,7 @@ sub get_users_by_studio{ } my $conditions=''; - $conditions=" and ".join(" and ",@conditions) if (@conditions>0); + $conditions=" and ".join(" and ",@conditions) if (scalar @conditions>0); my $query=qq{ select distinct(u.id), u.name, u.full_name @@ -808,9 +824,11 @@ sub print_warn{ } sub print_error{ + my $message=shift; + print STDERR "ERROR:".$message."\n"; print '
' .' ' - .$_[0]. + .$message. '
'."\n"; } diff --git a/lib/calcms/work_dates.pm b/lib/calcms/work_dates.pm index c945ad5..e53af98 100644 --- a/lib/calcms/work_dates.pm +++ b/lib/calcms/work_dates.pm @@ -247,7 +247,7 @@ sub get_week_of_month_dates{ return undef if $frequency eq''; 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=[]; diff --git a/website/agenda/aggregate.cgi b/website/agenda/aggregate.cgi index 42c2890..022471a 100755 --- a/website/agenda/aggregate.cgi +++ b/website/agenda/aggregate.cgi @@ -31,8 +31,6 @@ if ( $0 =~ /aggregate.*?\.cgi$/ ) { my %params = $cgi->Vars(); my $params = \%params; - #print STDERR Dumper($params); - my $config = config::get('config/config.cgi'); my $debug = $config->{system}->{debug}; 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.=''."\n"; + $params->{exclude_locations} = 1; + $params->{exclude_projects} = 1; + $params->{exclude_event_images} = 1; + # $output_header.=''."\n"; my $request = { url => $ENV{QUERY_STRING}, params => { @@ -54,6 +55,7 @@ if ( $0 =~ /aggregate.*?\.cgi$/ ) { }, }; $params = $request->{params}->{checked}; + #print STDERR Dumper($params); my $mem = 0; log::init($request); diff --git a/website/agenda/config/config.cgi.off b/website/agenda/config/config.cgi.off index 9a2ed6f..0a7e592 100755 --- a/website/agenda/config/config.cgi.off +++ b/website/agenda/config/config.cgi.off @@ -104,6 +104,8 @@ project Corax # limit creating comments in days before and after start of event no_new_comments_before 10 no_new_comments_after 60 + + # hide_event_images 1 diff --git a/website/agenda/css/calcms.css b/website/agenda/css/calcms.css index c63d195..ad968aa 100644 --- a/website/agenda/css/calcms.css +++ b/website/agenda/css/calcms.css @@ -747,7 +747,7 @@ a#calcms_search_show_details #plus{ #player{ border:0; padding:0; - height:64px; + height:3rem; } #player:hover{ opacity:0.9;