fix array length determining and cleanup
This commit is contained in:
@@ -1,48 +0,0 @@
|
|||||||
# UTF8DBI.pm re-implementation by Pavel Kudinov http://search.cpan.org/~kudinov/
|
|
||||||
# originally from: http://dysphoria.net/code/perl-utf8/
|
|
||||||
# And patched again by Andrew Forrest, Jan 2007
|
|
||||||
|
|
||||||
use DBI 1.21;
|
|
||||||
use utf8;
|
|
||||||
use Encode();
|
|
||||||
|
|
||||||
package UTF8DBI;
|
|
||||||
use base DBI;
|
|
||||||
|
|
||||||
sub _utf8_ {
|
|
||||||
if ( ref $_ eq 'ARRAY' ) { _utf8_() foreach @$_ }
|
|
||||||
elsif ( ref $_ eq 'HASH' ) { _utf8_() foreach values %$_ }
|
|
||||||
else {
|
|
||||||
Encode::_utf8_on($_);
|
|
||||||
if ( Encode::is_utf8($_) && !Encode::is_utf8( $_, 1 ) ) {
|
|
||||||
|
|
||||||
#$_ = '⁂malformed-UTF8‼' #die "Malformed utf8 string in database"
|
|
||||||
#print data_string_desc($_)."\n"
|
|
||||||
#data_string_desc(STRING);
|
|
||||||
#Encode::decode_utf8($_);
|
|
||||||
#;
|
|
||||||
#Encode::_utf8_off($_);
|
|
||||||
#Encode::decode_utf8($_);
|
|
||||||
#Encode::encode_utf8($_);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$_;
|
|
||||||
}
|
|
||||||
|
|
||||||
package UTF8DBI::db;
|
|
||||||
use base DBI::db;
|
|
||||||
|
|
||||||
sub selectrow_arrayref { return UTF8DBI::_utf8_ for shift->SUPER::selectrow_arrayref(@_) }
|
|
||||||
sub selectrow_hashref { return UTF8DBI::_utf8_ for shift->SUPER::selectrow_hashref(@_) }
|
|
||||||
sub selectall_arrayref { return UTF8DBI::_utf8_ for shift->SUPER::selectall_arrayref(@_) }
|
|
||||||
sub selectall_hashref { return UTF8DBI::_utf8_ for shift->SUPER::selectall_hashref(@_) }
|
|
||||||
sub selectcol_arrayref { return UTF8DBI::_utf8_ for shift->SUPER::selectcol_arrayref(@_) }
|
|
||||||
|
|
||||||
sub selectrow_array { @{ shift->selectrow_arrayref(@_) } }
|
|
||||||
|
|
||||||
package UTF8DBI::st;
|
|
||||||
use base DBI::st;
|
|
||||||
|
|
||||||
sub fetch { return UTF8DBI::_utf8_ for shift->SUPER::fetch(@_) }
|
|
||||||
|
|
||||||
1;
|
|
||||||
@@ -115,9 +115,9 @@ sub get_calendar {
|
|||||||
|
|
||||||
#set query string for caching
|
#set query string for caching
|
||||||
my $options = [];
|
my $options = [];
|
||||||
push( @$options, 'date=' . $params->{date} ) if ( $params->{date} ne '' );
|
push @$options, 'date=' . $params->{date} if $params->{date} ne '';
|
||||||
push( @$options, 'from_date=' . $params->{from_date} ) if ( $params->{from_date} ne '' );
|
push @$options, 'from_date=' . $params->{from_date} if $params->{from_date} ne '';
|
||||||
push( @$options, 'till_date=' . $params->{till_date} ) if ( $params->{till_date} ne '' );
|
push @$options, 'till_date=' . $params->{till_date} if $params->{till_date} ne '';
|
||||||
$ENV{QUERY_STRING} = '' . join( "&", @$options );
|
$ENV{QUERY_STRING} = '' . join( "&", @$options );
|
||||||
|
|
||||||
my $content = '';
|
my $content = '';
|
||||||
@@ -270,10 +270,10 @@ sub check_params {
|
|||||||
#set query string for caching
|
#set query string for caching
|
||||||
if ( ( !exists $ENV{QUERY_STRING} ) || ( $ENV{QUERY_STRING} eq '' ) ) {
|
if ( ( !exists $ENV{QUERY_STRING} ) || ( $ENV{QUERY_STRING} eq '' ) ) {
|
||||||
my $options = [];
|
my $options = [];
|
||||||
push( @$options, 'date=' . $date ) if $date ne '';
|
push @$options, 'date=' . $date if $date ne '';
|
||||||
push( @$options, 'from_date=' . $from_date ) if $from_date ne '';
|
push @$options, 'from_date=' . $from_date if $from_date ne '';
|
||||||
push( @$options, 'till_date=' . $till_date ) if $till_date ne '';
|
push @$options, 'till_date=' . $till_date if $till_date ne '';
|
||||||
push( @$options, 'event_id=' . $event_id ) if $event_id ne '';
|
push @$options, 'event_id=' . $event_id if $event_id ne '';
|
||||||
$ENV{QUERY_STRING} = '' . join( "&", @$options );
|
$ENV{QUERY_STRING} = '' . join( "&", @$options );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -147,8 +147,8 @@ sub set {
|
|||||||
sub save {
|
sub save {
|
||||||
my $cache = shift;
|
my $cache = shift;
|
||||||
|
|
||||||
return if ( $cache->{action} ne 'save' );
|
return if $cache->{action} ne 'save';
|
||||||
return if ( ( !defined $cache->{filename} ) || ( $cache->{filename} eq '' ) );
|
return if ( !defined $cache->{filename} ) || ( $cache->{filename} eq '' );
|
||||||
|
|
||||||
log::save_file( $cache->{filename}, $cache->{content} );
|
log::save_file( $cache->{filename}, $cache->{content} );
|
||||||
chmod 0664, $cache->{filename};
|
chmod 0664, $cache->{filename};
|
||||||
|
|||||||
@@ -264,8 +264,8 @@ sub get {
|
|||||||
};
|
};
|
||||||
|
|
||||||
$week_result->{class} .= ' selected'
|
$week_result->{class} .= ' selected'
|
||||||
if ( ( ( defined $params->{from_date} ) && ( $start_date eq $params->{from_date} ) )
|
if ( ( defined $params->{from_date} ) && ( $start_date eq $params->{from_date} ) )
|
||||||
|| ( ( defined $params->{till_date} ) && ( $end_date eq $params->{till_date} ) ) );
|
|| ( ( defined $params->{till_date} ) && ( $end_date eq $params->{till_date} ) );
|
||||||
$week_result->{class} .= " week_$weekCounter";
|
$week_result->{class} .= " week_$weekCounter";
|
||||||
$week_result->{class} =~ s/^\s+//g;
|
$week_result->{class} =~ s/^\s+//g;
|
||||||
|
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ sub modify_results {
|
|||||||
|
|
||||||
$result->{content} = markup::html_to_plain( $result->{html_content} );
|
$result->{content} = markup::html_to_plain( $result->{html_content} );
|
||||||
$result->{short_content} = markup::html_to_plain( $result->{short_content} );
|
$result->{short_content} = markup::html_to_plain( $result->{short_content} );
|
||||||
$result->{excerpt} = "lass dich ueberraschen" if ( ( defined $result->{excerpt} ) && ( $result->{excerpt} eq '' ) );
|
$result->{excerpt} = "lass dich ueberraschen" if ( defined $result->{excerpt} ) && ( $result->{excerpt} eq '' );
|
||||||
$result->{excerpt} = markup::html_to_plain( $result->{excerpt} );
|
$result->{excerpt} = markup::html_to_plain( $result->{excerpt} );
|
||||||
$result->{title} = markup::html_to_plain( $result->{title} );
|
$result->{title} = markup::html_to_plain( $result->{title} );
|
||||||
$result->{series_name} = markup::html_to_plain( $result->{series_name} );
|
$result->{series_name} = markup::html_to_plain( $result->{series_name} );
|
||||||
@@ -240,7 +240,7 @@ sub render {
|
|||||||
my $template_parameters = \%template_parameters;
|
my $template_parameters = \%template_parameters;
|
||||||
|
|
||||||
$template_parameters->{comments} = $results;
|
$template_parameters->{comments} = $results;
|
||||||
$template_parameters->{comment_count} = (@$results) + 0;
|
$template_parameters->{comment_count} = scalar(@$results) + 0;
|
||||||
$template_parameters->{one_result} = 1 if ( $template_parameters->{comment_count} == 1 );
|
$template_parameters->{one_result} = 1 if ( $template_parameters->{comment_count} == 1 );
|
||||||
$template_parameters->{allow}->{new_comments} = 1 if ( $params->{allow}->{new_comments} );
|
$template_parameters->{allow}->{new_comments} = 1 if ( $params->{allow}->{new_comments} );
|
||||||
|
|
||||||
@@ -277,7 +277,7 @@ sub check {
|
|||||||
my $comments = db::get( $dbh, $query, $bind_values );
|
my $comments = db::get( $dbh, $query, $bind_values );
|
||||||
|
|
||||||
my @comments = @$comments;
|
my @comments = @$comments;
|
||||||
return 0 if ( @comments > 0 );
|
return 0 if scalar @comments > 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,7 +311,7 @@ sub get_level {
|
|||||||
my $comments = db::get( $dbh, $query, $bind_values );
|
my $comments = db::get( $dbh, $query, $bind_values );
|
||||||
|
|
||||||
my @comments = @$comments;
|
my @comments = @$comments;
|
||||||
if ( @comments > 0 ) {
|
if ( scalar @comments > 0 ) {
|
||||||
return $comments->[0]->{level} + 1;
|
return $comments->[0]->{level} + 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -417,7 +417,7 @@ sub get_events {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#get events from comment's event ids
|
#get events from comment's event ids
|
||||||
return [] if ( ( keys %{$event_ids} ) == 0 );
|
return [] if ( scalar keys %{$event_ids} ) == 0;
|
||||||
|
|
||||||
#my $quoted_event_ids=join "," ,(map {$dbh->quote($_)}(keys %{$event_ids}));
|
#my $quoted_event_ids=join "," ,(map {$dbh->quote($_)}(keys %{$event_ids}));
|
||||||
my @bind_values = keys %{$event_ids};
|
my @bind_values = keys %{$event_ids};
|
||||||
@@ -513,7 +513,7 @@ sub set_lock_status {
|
|||||||
};
|
};
|
||||||
$bind_values = [$id];
|
$bind_values = [$id];
|
||||||
my $comments = db::get( $dbh, $query, $bind_values );
|
my $comments = db::get( $dbh, $query, $bind_values );
|
||||||
if ( @$comments > 0 ) {
|
if ( scalar @$comments > 0 ) {
|
||||||
$comment->{event_id} = $comments->[0]->{event_id};
|
$comment->{event_id} = $comments->[0]->{event_id};
|
||||||
update_comment_count( $dbh, $comment );
|
update_comment_count( $dbh, $comment );
|
||||||
}
|
}
|
||||||
@@ -550,7 +550,7 @@ sub update_comment_count {
|
|||||||
my $comments = db::get( $dbh, $query, $bind_values );
|
my $comments = db::get( $dbh, $query, $bind_values );
|
||||||
|
|
||||||
my $count = 0;
|
my $count = 0;
|
||||||
$count = $comments->[0]->{count} if ( @$comments > 0 );
|
$count = $comments->[0]->{count} if scalar @$comments > 0;
|
||||||
$query = qq{
|
$query = qq{
|
||||||
update calcms_events
|
update calcms_events
|
||||||
set comment_count=?
|
set comment_count=?
|
||||||
@@ -671,9 +671,9 @@ sub check_params {
|
|||||||
$comment->{debug} = $1;
|
$comment->{debug} = $1;
|
||||||
}
|
}
|
||||||
|
|
||||||
log::error( $config, 'missing parameter a' ) if ( ( defined $params->{limit} ) && ( $comment->{limit} eq '' ) );
|
log::error( $config, 'missing parameter a' ) if ( defined $params->{limit} ) && ( $comment->{limit} eq '' );
|
||||||
log::error( $config, 'missing parameter b' ) if ( ( defined $params->{event_id} ) && ( $comment->{event_id} eq '' ) );
|
log::error( $config, 'missing parameter b' ) if ( defined $params->{event_id} ) && ( $comment->{event_id} eq '' );
|
||||||
log::error( $config, 'missing parameter c' ) if ( ( defined $params->{event_start} ) && ( $comment->{event_start} eq '' ) );
|
log::error( $config, 'missing parameter c' ) if ( defined $params->{event_start} ) && ( $comment->{event_start} eq '' );
|
||||||
|
|
||||||
my $delta_days = 1;
|
my $delta_days = 1;
|
||||||
if ( $comment->{event_start} ne '' ) {
|
if ( $comment->{event_start} ne '' ) {
|
||||||
|
|||||||
@@ -13,11 +13,6 @@ our $config = undef;
|
|||||||
sub get {
|
sub get {
|
||||||
my $filename = shift;
|
my $filename = shift;
|
||||||
|
|
||||||
#return config if known
|
|
||||||
#my $age=(-M $filename);
|
|
||||||
#return $config::config if ((defined $config::config) && ($age <= $config::modified_at));
|
|
||||||
|
|
||||||
#reload config if changed
|
|
||||||
my $configuration = new Config::General(
|
my $configuration = new Config::General(
|
||||||
-ConfigFile => $filename,
|
-ConfigFile => $filename,
|
||||||
-UTF8 => 1
|
-UTF8 => 1
|
||||||
@@ -25,8 +20,6 @@ sub get {
|
|||||||
$config::config = $configuration->{DefaultConfig}->{config};
|
$config::config = $configuration->{DefaultConfig}->{config};
|
||||||
$config::modified_at = $age;
|
$config::modified_at = $age;
|
||||||
|
|
||||||
#print STDERR "reload $filename\n";
|
|
||||||
|
|
||||||
return $config::config;
|
return $config::config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ sub extractEventFromWikiText {
|
|||||||
#meta
|
#meta
|
||||||
if ( defined $event->{comments} ) {
|
if ( defined $event->{comments} ) {
|
||||||
my $meta = extractMeta( $event->{comments} );
|
my $meta = extractMeta( $event->{comments} );
|
||||||
$event->{meta} = $meta if ( @$meta > 0 );
|
$event->{meta} = $meta if scalar @$meta > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $event;
|
return $event;
|
||||||
@@ -149,7 +149,7 @@ sub eventToWikiText {
|
|||||||
my $title = '';
|
my $title = '';
|
||||||
if ( $event->{program} ne '' ) {
|
if ( $event->{program} ne '' ) {
|
||||||
$title = $event->{program};
|
$title = $event->{program};
|
||||||
$title .= ': ' if ( ( $event->{series_name} ne '' ) || ( $event->{title} ne '' ) );
|
$title .= ': ' if ( $event->{series_name} ne '' ) || ( $event->{title} ne '' );
|
||||||
}
|
}
|
||||||
if ( $event->{series_name} ne '' ) {
|
if ( $event->{series_name} ne '' ) {
|
||||||
$title .= $event->{series_name};
|
$title .= $event->{series_name};
|
||||||
@@ -157,7 +157,8 @@ sub eventToWikiText {
|
|||||||
}
|
}
|
||||||
$title .= $event->{title};
|
$title .= $event->{title};
|
||||||
if ( $event->{categories} ) {
|
if ( $event->{categories} ) {
|
||||||
$title .= ' (' . join( ",", @{ $event->{categories} } ) . ')' if ( @{ $event->{categories} } > 0 );
|
my $categories = $event->{categories};
|
||||||
|
$title .= ' (' . join( ",", @$categories ) . ')' if ( scalar @$categories > 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
my $meta = extractMeta( $event->{comments}, $event->{meta} );
|
my $meta = extractMeta( $event->{comments}, $event->{meta} );
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ sub connect {
|
|||||||
my $options = shift;
|
my $options = shift;
|
||||||
my $request = shift;
|
my $request = shift;
|
||||||
|
|
||||||
return $request->{connection} if ( ( defined $request ) && ( defined $request->{connection} ) );
|
return $request->{connection} if ( defined $request ) && ( defined $request->{connection} );
|
||||||
|
|
||||||
my $access_options = $options->{access};
|
my $access_options = $options->{access};
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ sub setAttributesFromSeriesTemplate {
|
|||||||
series_id => $params->{series_id},
|
series_id => $params->{series_id},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
if ( @$series != 1 ) {
|
if ( scalar @$series != 1 ) {
|
||||||
uac::print_error("series not found");
|
uac::print_error("series not found");
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
@@ -261,7 +261,7 @@ sub createEvent {
|
|||||||
series_id => $event->{series_id},
|
series_id => $event->{series_id},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
if ( @$series != 1 ) {
|
if ( scalar @$series != 1 ) {
|
||||||
uac::print_error("series not found");
|
uac::print_error("series not found");
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
@@ -279,7 +279,7 @@ sub createEvent {
|
|||||||
uac::print_error("studio not found");
|
uac::print_error("studio not found");
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
unless ( @$studios == 1 ) {
|
unless ( scalar @$studios == 1 ) {
|
||||||
uac::print_error("studio not found");
|
uac::print_error("studio not found");
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,8 +80,6 @@ sub get {
|
|||||||
|
|
||||||
my $changes = db::get( $dbh, $query, \@bind_values );
|
my $changes = db::get( $dbh, $query, \@bind_values );
|
||||||
|
|
||||||
#print STDERR Dumper($changes);
|
|
||||||
|
|
||||||
for my $change (@$changes) {
|
for my $change (@$changes) {
|
||||||
$change->{change_id} = $change->{id};
|
$change->{change_id} = $change->{id};
|
||||||
delete $change->{id};
|
delete $change->{id};
|
||||||
@@ -112,7 +110,7 @@ sub insert {
|
|||||||
|
|
||||||
$entry->{modified_at} = time::time_to_datetime( time() );
|
$entry->{modified_at} = time::time_to_datetime( time() );
|
||||||
|
|
||||||
$entry->{event_id} = $entry->{id} if ( ( defined $entry->{id} ) && ( !( defined $entry->{event_id} ) ) );
|
$entry->{event_id} = $entry->{id} if ( defined $entry->{id} ) && ( !( defined $entry->{event_id} ) );
|
||||||
delete $entry->{id};
|
delete $entry->{id};
|
||||||
|
|
||||||
#TODO:filter for existing attributes
|
#TODO:filter for existing attributes
|
||||||
|
|||||||
@@ -381,11 +381,11 @@ sub modify_results {
|
|||||||
#detect if images are in content or topic field
|
#detect if images are in content or topic field
|
||||||
my $image_in_text = 0;
|
my $image_in_text = 0;
|
||||||
$image_in_text = 1
|
$image_in_text = 1
|
||||||
if ( ( defined $result->{content} )
|
if ( defined $result->{content} )
|
||||||
&& ( $result->{content} =~ /<img / ) );
|
&& ( $result->{content} =~ /<img / );
|
||||||
$image_in_text = 1
|
$image_in_text = 1
|
||||||
if ( ( defined $result->{topic} )
|
if ( defined $result->{topic} )
|
||||||
&& ( $result->{topic} =~ /<img / ) );
|
&& ( $result->{topic} =~ /<img / );
|
||||||
$result->{no_image_in_text} = 1 if $image_in_text == 0;
|
$result->{no_image_in_text} = 1 if $image_in_text == 0;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@@ -935,26 +935,23 @@ sub get_query {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#print STDERR $search_cond."\n";
|
|
||||||
|
|
||||||
my $project_cond = '';
|
my $project_cond = '';
|
||||||
|
|
||||||
# if ($filter_by_project eq'1'){
|
my $project = undef;
|
||||||
my $project = undef; #$params->{default_project};
|
|
||||||
$project = $params->{project}
|
$project = $params->{project}
|
||||||
if ( ( defined $params->{project} ) && ( $params->{project} ne '' ) );
|
if ( defined $params->{project} ) && ( $params->{project} ne '' );
|
||||||
|
|
||||||
my $project_name = '';
|
my $project_name = '';
|
||||||
$project_name = $project->{name}
|
$project_name = $project->{name}
|
||||||
if ( ( defined $project )
|
if ( defined $project )
|
||||||
&& ( defined $project->{name} )
|
&& ( defined $project->{name} )
|
||||||
&& ( $project->{name} ne '' ) );
|
&& ( $project->{name} ne '' );
|
||||||
|
|
||||||
if ( ( $project_name ne '' ) && ( $project_name ne 'all' ) ) {
|
if ( ( $project_name ne '' ) && ( $project_name ne 'all' ) ) {
|
||||||
$project_cond = '(project=?)';
|
$project_cond = '(project=?)';
|
||||||
push @$bind_values, $project_name;
|
push @$bind_values, $project_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
# }
|
|
||||||
|
|
||||||
#filter by published, default =1, set to 'all' to see all
|
#filter by published, default =1, set to 'all' to see all
|
||||||
my $published_cond = '';
|
my $published_cond = '';
|
||||||
my $published = $params->{published} || '1';
|
my $published = $params->{published} || '1';
|
||||||
@@ -1182,7 +1179,7 @@ sub render {
|
|||||||
|
|
||||||
#$template_parameters->{tags} = $tags;
|
#$template_parameters->{tags} = $tags;
|
||||||
|
|
||||||
if ( @$results == 0 ) {
|
if ( scalar @$results == 0 ) {
|
||||||
if ( ( $params->{search} ne '' )
|
if ( ( $params->{search} ne '' )
|
||||||
|| ( $params->{category} ne '' )
|
|| ( $params->{category} ne '' )
|
||||||
|| ( $params->{series_name} ne '' ) )
|
|| ( $params->{series_name} ne '' ) )
|
||||||
@@ -1193,7 +1190,7 @@ sub render {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ( ( !defined $params->{event_id} ) || ( $params->{event_id} eq '' ) ) {
|
if ( ( !defined $params->{event_id} ) || ( $params->{event_id} eq '' ) ) {
|
||||||
$template_parameters->{event_count} = @$results . '';
|
$template_parameters->{event_count} = scalar @$results . '';
|
||||||
$template_parameters->{first_of_list} = $results->[0]->{event_id};
|
$template_parameters->{first_of_list} = $results->[0]->{event_id};
|
||||||
}
|
}
|
||||||
my $start = $results->[0]->{start_datetime} || '';
|
my $start = $results->[0]->{start_datetime} || '';
|
||||||
@@ -1362,7 +1359,7 @@ sub get_next_event_of_series {
|
|||||||
};
|
};
|
||||||
|
|
||||||
$events = db::get( $dbh, $query, $bind_values );
|
$events = db::get( $dbh, $query, $bind_values );
|
||||||
return undef unless @$events == 1;
|
return undef unless scalar @$events == 1;
|
||||||
|
|
||||||
return $events->[0]->{id};
|
return $events->[0]->{id};
|
||||||
}
|
}
|
||||||
@@ -1463,7 +1460,7 @@ sub get_by_image {
|
|||||||
my $events = db::get( $dbh, $query, $bind_values );
|
my $events = db::get( $dbh, $query, $bind_values );
|
||||||
|
|
||||||
# print STDERR Dumper($events);
|
# print STDERR Dumper($events);
|
||||||
return undef if ( @$events == 0 );
|
return undef if scalar @$events == 0;
|
||||||
return $events->[0];
|
return $events->[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1615,7 +1612,7 @@ sub check_params {
|
|||||||
$found = 1 if ( $key eq $time_of_day );
|
$found = 1 if ( $key eq $time_of_day );
|
||||||
}
|
}
|
||||||
log::error( $config, 'invalid time_of_day' )
|
log::error( $config, 'invalid time_of_day' )
|
||||||
if ( ( $time_of_day ne '' ) && ( $found == 0 ) );
|
if ( $time_of_day ne '' ) && ( $found == 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
my $tag = $params->{tag} || '';
|
my $tag = $params->{tag} || '';
|
||||||
@@ -1717,7 +1714,7 @@ sub check_params {
|
|||||||
|
|
||||||
my $get = 'all';
|
my $get = 'all';
|
||||||
$get = 'no_content'
|
$get = 'no_content'
|
||||||
if ( ( defined $params->{get} ) && ( $params->{get} eq 'no_content' ) );
|
if ( defined $params->{get} ) && ( $params->{get} eq 'no_content' );
|
||||||
|
|
||||||
my $search = $params->{search} || '';
|
my $search = $params->{search} || '';
|
||||||
if ( ( defined $search ) && ( $search ne '' ) ) {
|
if ( ( defined $search ) && ( $search ne '' ) ) {
|
||||||
|
|||||||
@@ -14,11 +14,7 @@ sub send {
|
|||||||
'Data' => $mail->{'Data'},
|
'Data' => $mail->{'Data'},
|
||||||
);
|
);
|
||||||
|
|
||||||
#print '<pre>';
|
|
||||||
$msg->print( \*STDERR );
|
$msg->print( \*STDERR );
|
||||||
|
|
||||||
#print '</pre>';
|
|
||||||
|
|
||||||
$msg->send;
|
$msg->send;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -145,9 +145,6 @@ sub sync {
|
|||||||
my $studio_id = $options->{studio_id};
|
my $studio_id = $options->{studio_id};
|
||||||
my $updates = $options->{events};
|
my $updates = $options->{events};
|
||||||
|
|
||||||
#print STDERR "sync\n";
|
|
||||||
#print STDERR Dumper($updates);
|
|
||||||
|
|
||||||
# get new entries by date
|
# get new entries by date
|
||||||
my $update_by_date = {};
|
my $update_by_date = {};
|
||||||
for my $entry (@$updates) {
|
for my $entry (@$updates) {
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ sub is_studio_assigned {
|
|||||||
|
|
||||||
my $dbh = db::connect($config);
|
my $dbh = db::connect($config);
|
||||||
my $project_studios = db::get( $dbh, $query, $bind_values );
|
my $project_studios = db::get( $dbh, $query, $bind_values );
|
||||||
return 1 if @$project_studios == 1;
|
return 1 if scalar @$project_studios == 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -352,7 +352,7 @@ sub is_series_assigned {
|
|||||||
|
|
||||||
my $dbh = db::connect($config);
|
my $dbh = db::connect($config);
|
||||||
my $project_series = db::get( $dbh, $query, $bind_values );
|
my $project_series = db::get( $dbh, $query, $bind_values );
|
||||||
return 1 if @$project_series == 1;
|
return 1 if scalar @$project_series == 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
use warnings "all";
|
|
||||||
use strict;
|
|
||||||
|
|
||||||
package projects;
|
|
||||||
|
|
||||||
print STDERR "projects.pm is not used anymore!\n";
|
|
||||||
|
|
||||||
#do not delete last line!
|
|
||||||
1;
|
|
||||||
@@ -286,7 +286,7 @@ sub delete {
|
|||||||
series_id => $series_id
|
series_id => $series_id
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
if ( @$series_assignments > 1 ) {
|
if ( scalar @$series_assignments > 1 ) {
|
||||||
print STDERR "do not delete series, due to assigned to other project or studio";
|
print STDERR "do not delete series, due to assigned to other project or studio";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -367,7 +367,7 @@ sub add_user {
|
|||||||
|
|
||||||
my $dbh = db::connect($config);
|
my $dbh = db::connect($config);
|
||||||
my $results = db::get( $dbh, $query, $bind_values );
|
my $results = db::get( $dbh, $query, $bind_values );
|
||||||
return unless ( @$results == 0 );
|
return unless scalar @$results == 0;
|
||||||
|
|
||||||
$query = qq{
|
$query = qq{
|
||||||
insert calcms_user_series
|
insert calcms_user_series
|
||||||
@@ -429,7 +429,7 @@ sub search_events {
|
|||||||
|
|
||||||
my $series_name = $options->{series_name} || '';
|
my $series_name = $options->{series_name} || '';
|
||||||
my $title = $options->{title} || '';
|
my $title = $options->{title} || '';
|
||||||
return undef if ( ( $series_name eq '' ) && ( $title eq '' ) );
|
return undef if ( $series_name eq '' ) && ( $title eq '' );
|
||||||
|
|
||||||
$series_name =~ s/[^a-zA-Z0-9 \-]+/\?/g;
|
$series_name =~ s/[^a-zA-Z0-9 \-]+/\?/g;
|
||||||
$title =~ s/[^a-zA-Z0-9 \-]+/\?/g;
|
$title =~ s/[^a-zA-Z0-9 \-]+/\?/g;
|
||||||
@@ -853,10 +853,10 @@ sub assign_event {
|
|||||||
return undef unless defined $entry->{studio_id};
|
return undef unless defined $entry->{studio_id};
|
||||||
return undef unless defined $entry->{series_id};
|
return undef unless defined $entry->{series_id};
|
||||||
return undef unless defined $entry->{event_id};
|
return undef unless defined $entry->{event_id};
|
||||||
$entry->{manual} = 0 unless ( ( defined $entry->{manual} ) && ( $entry->{manual} eq '1' ) );
|
$entry->{manual} = 0 unless ( defined $entry->{manual} ) && ( $entry->{manual} eq '1' );
|
||||||
|
|
||||||
my $conditions = '';
|
my $conditions = '';
|
||||||
$conditions = 'and manual=1' if ( $entry->{manual} eq '1' );
|
$conditions = 'and manual=1' if $entry->{manual} eq '1';
|
||||||
|
|
||||||
my $query = qq{
|
my $query = qq{
|
||||||
select * from calcms_series_events
|
select * from calcms_series_events
|
||||||
@@ -866,12 +866,12 @@ sub assign_event {
|
|||||||
my $dbh = db::connect($config);
|
my $dbh = db::connect($config);
|
||||||
my $results = db::get( $dbh, $query, $bind_values );
|
my $results = db::get( $dbh, $query, $bind_values );
|
||||||
|
|
||||||
if ( @$results > 1 ) {
|
if ( scalar @$results > 1 ) {
|
||||||
print STDERR
|
print STDERR
|
||||||
"multiple assignments of project_id=$entry->{project_id}, studio_id=$entry->{studio_id}, series_id=$entry->{series_id}, event_id=$entry->{event_id}\n";
|
"multiple assignments of project_id=$entry->{project_id}, studio_id=$entry->{studio_id}, series_id=$entry->{series_id}, event_id=$entry->{event_id}\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( @$results == 1 ) {
|
if ( scalar @$results == 1 ) {
|
||||||
print STDERR
|
print STDERR
|
||||||
"already assigned: project_id=$entry->{project_id}, studio_id=$entry->{studio_id}, series_id=$entry->{series_id}, event_id=$entry->{event_id}\n";
|
"already assigned: project_id=$entry->{project_id}, studio_id=$entry->{studio_id}, series_id=$entry->{series_id}, event_id=$entry->{event_id}\n";
|
||||||
return;
|
return;
|
||||||
@@ -898,7 +898,7 @@ sub unassign_event {
|
|||||||
return unless defined $entry->{event_id};
|
return unless defined $entry->{event_id};
|
||||||
|
|
||||||
my $conditions = '';
|
my $conditions = '';
|
||||||
$conditions = 'and manual=1' if ( ( defined $entry->{manual} ) && ( $entry->{manual} eq '1' ) );
|
$conditions = 'and manual=1' if ( defined $entry->{manual} ) && ( $entry->{manual} eq '1' );
|
||||||
|
|
||||||
my $query = qq{
|
my $query = qq{
|
||||||
delete from calcms_series_events
|
delete from calcms_series_events
|
||||||
@@ -925,7 +925,7 @@ sub add_series_ids_to_events {
|
|||||||
push @event_ids, $event->{event_id};
|
push @event_ids, $event->{event_id};
|
||||||
}
|
}
|
||||||
|
|
||||||
return if ( @event_ids == 0 );
|
return if scalar @event_ids == 0;
|
||||||
|
|
||||||
my @bind_values = @event_ids;
|
my @bind_values = @event_ids;
|
||||||
my $event_ids = join( ',', map { '?' } @event_ids );
|
my $event_ids = join( ',', map { '?' } @event_ids );
|
||||||
@@ -939,7 +939,7 @@ sub add_series_ids_to_events {
|
|||||||
};
|
};
|
||||||
my $results = db::get( $dbh, $query, \@bind_values );
|
my $results = db::get( $dbh, $query, \@bind_values );
|
||||||
my @results = @$results;
|
my @results = @$results;
|
||||||
return [] unless ( @results > 0 );
|
return [] unless scalar @results > 0;
|
||||||
|
|
||||||
#build hash of series ids by event ids
|
#build hash of series ids by event ids
|
||||||
my $assignments_by_event_id = {};
|
my $assignments_by_event_id = {};
|
||||||
@@ -1032,7 +1032,7 @@ sub set_event_ids {
|
|||||||
event_id => $event_id,
|
event_id => $event_id,
|
||||||
manual => 0
|
manual => 0
|
||||||
}
|
}
|
||||||
) unless ( defined $event_id_hash->{$event_id} );
|
) unless defined $event_id_hash->{$event_id};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1051,9 +1051,9 @@ sub can_user_update_events {
|
|||||||
return 0 unless defined $options->{studio_id};
|
return 0 unless defined $options->{studio_id};
|
||||||
return 0 unless defined $options->{series_id};
|
return 0 unless defined $options->{series_id};
|
||||||
|
|
||||||
return 1 if ( ( defined $permissions->{update_event_of_others} ) && ( $permissions->{update_event_of_others} eq '1' ) );
|
return 1 if ( defined $permissions->{update_event_of_others} ) && ( $permissions->{update_event_of_others} eq '1' );
|
||||||
return 1 if ( ( defined $permissions->{is_admin} ) && ( $permissions->{is_admin} eq '1' ) );
|
return 1 if ( defined $permissions->{is_admin} ) && ( $permissions->{is_admin} eq '1' );
|
||||||
return 0 if ( $permissions->{update_event_of_series} ne '1' );
|
return 0 if $permissions->{update_event_of_series} ne '1';
|
||||||
|
|
||||||
return is_series_assigned_to_user( $request, $options );
|
return is_series_assigned_to_user( $request, $options );
|
||||||
}
|
}
|
||||||
@@ -1072,9 +1072,9 @@ sub can_user_create_events {
|
|||||||
return 0 unless defined $options->{studio_id};
|
return 0 unless defined $options->{studio_id};
|
||||||
return 0 unless defined $options->{series_id};
|
return 0 unless defined $options->{series_id};
|
||||||
|
|
||||||
return 1 if ( ( defined $permissions->{create_event} ) && ( $permissions->{create_event} eq '1' ) );
|
return 1 if ( defined $permissions->{create_event} ) && ( $permissions->{create_event} eq '1' );
|
||||||
return 1 if ( ( defined $permissions->{is_admin} ) && ( $permissions->{is_admin} eq '1' ) );
|
return 1 if ( defined $permissions->{is_admin} ) && ( $permissions->{is_admin} eq '1' );
|
||||||
return 0 if ( $permissions->{create_event_of_series} ne '1' );
|
return 0 if $permissions->{create_event_of_series} ne '1';
|
||||||
|
|
||||||
return is_series_assigned_to_user( $request, $options );
|
return is_series_assigned_to_user( $request, $options );
|
||||||
}
|
}
|
||||||
@@ -1100,7 +1100,7 @@ sub is_series_assigned_to_user {
|
|||||||
name => $request->{user}
|
name => $request->{user}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
return 0 if ( @$series_users == 0 );
|
return 0 if scalar @$series_users == 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1127,7 +1127,7 @@ sub is_event_assigned_to_user {
|
|||||||
user => $request->{user},
|
user => $request->{user},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
return "user is not assigned to studio" if @$user_studios == 0;
|
return "user is not assigned to studio" if scalar @$user_studios == 0;
|
||||||
my $studio = $user_studios->[0];
|
my $studio = $user_studios->[0];
|
||||||
my $location = $studio->{location};
|
my $location = $studio->{location};
|
||||||
return "could not get studio location" if $location eq '';
|
return "could not get studio location" if $location eq '';
|
||||||
@@ -1153,7 +1153,7 @@ sub is_event_assigned_to_user {
|
|||||||
. " location $location,"
|
. " location $location,"
|
||||||
. " series $options->{series_id}"
|
. " series $options->{series_id}"
|
||||||
. " and event $options->{event_id}"
|
. " and event $options->{event_id}"
|
||||||
if @$events == 0;
|
if scalar @$events == 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ sub is_event_scheduled {
|
|||||||
start_at => $options->{start_at}
|
start_at => $options->{start_at}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
return 0 if ( @$schedules != 1 );
|
return 0 if scalar @$schedules != 1;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -390,8 +390,8 @@ sub get_schedule_dates {
|
|||||||
|
|
||||||
my $is_exclude = $options->{exclude} || 0;
|
my $is_exclude = $options->{exclude} || 0;
|
||||||
my $dates = [];
|
my $dates = [];
|
||||||
return $dates if ( ( $is_exclude eq '1' ) && ( $schedule->{exclude} ne '1' ) );
|
return $dates if ( $is_exclude eq '1' ) && ( $schedule->{exclude} ne '1' );
|
||||||
return $dates if ( ( $is_exclude eq '0' ) && ( $schedule->{exclude} eq '1' ) );
|
return $dates if ( $is_exclude eq '0' ) && ( $schedule->{exclude} eq '1' );
|
||||||
|
|
||||||
if ( $schedule->{period_type} eq 'single' ) {
|
if ( $schedule->{period_type} eq 'single' ) {
|
||||||
$dates = get_single_date( $schedule->{start}, $schedule->{duration} );
|
$dates = get_single_date( $schedule->{start}, $schedule->{duration} );
|
||||||
@@ -445,7 +445,7 @@ sub get_week_of_month_dates {
|
|||||||
$c++;
|
$c++;
|
||||||
my @start = @{ time::datetime_to_array($start_datetime) };
|
my @start = @{ time::datetime_to_array($start_datetime) };
|
||||||
next unless @start >= 6;
|
next unless @start >= 6;
|
||||||
next if ( ( $c % $frequency ) != 0 );
|
next if ( $c % $frequency ) != 0;
|
||||||
|
|
||||||
my @end_datetime = Date::Calc::Add_Delta_DHMS(
|
my @end_datetime = Date::Calc::Add_Delta_DHMS(
|
||||||
$start[0], $start[1], $start[2], # start date
|
$start[0], $start[1], $start[2], # start date
|
||||||
@@ -503,19 +503,19 @@ sub get_dates {
|
|||||||
$date->{start} = sprintf( "%04d-%02d-%02d", @start_date ) . ' ' . $start_time;
|
$date->{start} = sprintf( "%04d-%02d-%02d", @start_date ) . ' ' . $start_time;
|
||||||
return undef if $duration eq '';
|
return undef if $duration eq '';
|
||||||
|
|
||||||
return undef if ( ( $frequency eq '' ) || ( $end_date eq '' ) );
|
return undef if ( $frequency eq '' ) || ( $end_date eq '' );
|
||||||
|
|
||||||
#continue on recurring date
|
#continue on recurring date
|
||||||
my @end = @{ time::datetime_to_array($end_date) };
|
my @end = @{ time::datetime_to_array($end_date) };
|
||||||
return unless @end >= 3;
|
return unless scalar @end >= 3;
|
||||||
my @end_date = ( $end[0], $end[1], $end[2] );
|
my @end_date = ( $end[0], $end[1], $end[2] );
|
||||||
|
|
||||||
my $today = time::time_to_date();
|
my $today = time::time_to_date();
|
||||||
my ( $year, $month, $day ) = split( /\-/, $today );
|
my ( $year, $month, $day ) = split( /\-/, $today );
|
||||||
|
|
||||||
my $dates = [];
|
my $dates = [];
|
||||||
return $dates if ( $end_date lt $today );
|
return $dates if $end_date lt $today;
|
||||||
return $dates if ( $frequency < 1 );
|
return $dates if $frequency < 1;
|
||||||
|
|
||||||
my $j = Date::Calc::Delta_Days( @start_date, @end_date );
|
my $j = Date::Calc::Delta_Days( @start_date, @end_date );
|
||||||
my $c = 0;
|
my $c = 0;
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ sub is_event_assigned {
|
|||||||
my $bind_values = [ $entry->{project_id}, $entry->{studio_id}, $entry->{series_id}, $entry->{event_id} ];
|
my $bind_values = [ $entry->{project_id}, $entry->{studio_id}, $entry->{series_id}, $entry->{event_id} ];
|
||||||
my $results = db::get( $dbh, $sql, $bind_values );
|
my $results = db::get( $dbh, $sql, $bind_values );
|
||||||
|
|
||||||
return 1 if @$results >= 1;
|
return 1 if scalar @$results >= 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,7 +296,7 @@ sub check_permission {
|
|||||||
#check if permissions are set (like create_event)
|
#check if permissions are set (like create_event)
|
||||||
my $found = 0;
|
my $found = 0;
|
||||||
for my $permission ( split /\,/, $options->{permission} ) {
|
for my $permission ( split /\,/, $options->{permission} ) {
|
||||||
$found = 1 if ( ( defined $permissions->{$permission} ) && ( $permissions->{$permission} ) eq '1' );
|
$found = 1 if ( defined $permissions->{$permission} ) && ( $permissions->{$permission} ) eq '1' ;
|
||||||
}
|
}
|
||||||
return 'missing permission to ' . $options->{permission} if $found == 0;
|
return 'missing permission to ' . $options->{permission} if $found == 0;
|
||||||
delete $options->{permission};
|
delete $options->{permission};
|
||||||
@@ -320,7 +320,7 @@ sub check_permission {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
return "unknown studio" unless defined $studios;
|
return "unknown studio" unless defined $studios;
|
||||||
return "unknown studio" unless ( @$studios == 1 );
|
return "unknown studio" unless scalar @$studios == 1;
|
||||||
my $studio = $studios->[0];
|
my $studio = $studios->[0];
|
||||||
my $studio_name = $studio->{name} || '';
|
my $studio_name = $studio->{name} || '';
|
||||||
|
|
||||||
@@ -431,7 +431,7 @@ sub insert_event {
|
|||||||
return 0 unless defined $studio->{location};
|
return 0 unless defined $studio->{location};
|
||||||
|
|
||||||
my $projects = project::get( $config, { project_id => $project_id } );
|
my $projects = project::get( $config, { project_id => $project_id } );
|
||||||
if ( @$projects == 0 ) {
|
if ( scalar @$projects == 0 ) {
|
||||||
print STDERR "project not found at insert event\n";
|
print STDERR "project not found at insert event\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ use lib qw(/home/radio/calcms/calcms/);
|
|||||||
|
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
use Apache::DBI();
|
use Apache::DBI();
|
||||||
|
|
||||||
#$Apache::DBI::DEBUG = 2;
|
#$Apache::DBI::DEBUG = 2;
|
||||||
|
|
||||||
use Time::Local();
|
use Time::Local();
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ sub check {
|
|||||||
return "Please select a studio" if ( $options->{studio_id} eq '' );
|
return "Please select a studio" if ( $options->{studio_id} eq '' );
|
||||||
my $studios = studios::get( $config, { studio_id => $options->{studio_id} } );
|
my $studios = studios::get( $config, { studio_id => $options->{studio_id} } );
|
||||||
return "Sorry. unknown studio" unless defined $studios;
|
return "Sorry. unknown studio" unless defined $studios;
|
||||||
return "Sorry. unknown studio" unless @$studios == 1;
|
return "Sorry. unknown studio" unless scalar @$studios == 1;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ sub process {
|
|||||||
# add current project
|
# add current project
|
||||||
unless ( defined $params->{project_title} ) {
|
unless ( defined $params->{project_title} ) {
|
||||||
my $projects = project::get_with_dates( $config, { name => $config->{project} } );
|
my $projects = project::get_with_dates( $config, { name => $config->{project} } );
|
||||||
if ( @$projects == 1 ) {
|
if ( scalar @$projects == 1 ) {
|
||||||
my $project = $projects->[0];
|
my $project = $projects->[0];
|
||||||
foreach my $key ( keys %$project ) {
|
foreach my $key ( keys %$project ) {
|
||||||
$params->{ 'project_' . $key } = $project->{$key};
|
$params->{ 'project_' . $key } = $project->{$key};
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ sub add_days_to_date {
|
|||||||
# convert unix time to datetime format
|
# convert unix time to datetime format
|
||||||
sub time_to_datetime {
|
sub time_to_datetime {
|
||||||
my $time = shift;
|
my $time = shift;
|
||||||
$time = time() unless ( ( defined $time ) && ( $time ne '' ) );
|
$time = time() unless ( defined $time ) && ( $time ne '' );
|
||||||
my @t = localtime($time);
|
my @t = localtime($time);
|
||||||
return sprintf( '%04d-%02d-%02d %02d:%02d:%02d', $t[5] + 1900, $t[4] + 1, $t[3], $t[2], $t[1], $t[0] );
|
return sprintf( '%04d-%02d-%02d %02d:%02d:%02d', $t[5] + 1900, $t[4] + 1, $t[3], $t[2], $t[1], $t[0] );
|
||||||
}
|
}
|
||||||
@@ -229,7 +229,7 @@ sub time_to_datetime {
|
|||||||
# convert unix time to date format
|
# convert unix time to date format
|
||||||
sub time_to_date {
|
sub time_to_date {
|
||||||
my $time = shift;
|
my $time = shift;
|
||||||
$time = time() unless ( ( defined $time ) && ( $time ne '' ) );
|
$time = time() unless ( defined $time ) && ( $time ne '' );
|
||||||
my @t = localtime($time);
|
my @t = localtime($time);
|
||||||
return sprintf( '%04d-%02d-%02d', $t[5] + 1900, $t[4] + 1, $t[3] );
|
return sprintf( '%04d-%02d-%02d', $t[5] + 1900, $t[4] + 1, $t[3] );
|
||||||
}
|
}
|
||||||
@@ -431,7 +431,7 @@ sub datetime_cond {
|
|||||||
sub check_date {
|
sub check_date {
|
||||||
my $date = shift;
|
my $date = shift;
|
||||||
|
|
||||||
return "" if ( ( !defined $date ) || ( $date eq '' ) );
|
return "" if ( !defined $date ) || ( $date eq '' );
|
||||||
if ( $date =~ /(\d\d\d\d)\-(\d\d?)\-(\d\d?)/ ) {
|
if ( $date =~ /(\d\d\d\d)\-(\d\d?)\-(\d\d?)/ ) {
|
||||||
return $1 . '-' . $2 . '-' . $3;
|
return $1 . '-' . $2 . '-' . $3;
|
||||||
} elsif ( $date =~ /(\d\d?)\.(\d\d?)\.(\d\d\d\d)/ ) {
|
} elsif ( $date =~ /(\d\d?)\.(\d\d?)\.(\d\d\d\d)/ ) {
|
||||||
@@ -445,8 +445,8 @@ sub check_date {
|
|||||||
|
|
||||||
sub check_time {
|
sub check_time {
|
||||||
my $time = shift;
|
my $time = shift;
|
||||||
return "" if ( ( !defined $time ) || ( $time eq '' ) );
|
return "" if ( !defined $time ) || ( $time eq '' );
|
||||||
return $time if ( ( $time eq 'now' ) || ( $time eq 'future' ) );
|
return $time if ( $time eq 'now' ) || ( $time eq 'future' );
|
||||||
if ( $time =~ /(\d\d?)\:(\d\d?)/ ) {
|
if ( $time =~ /(\d\d?)\:(\d\d?)/ ) {
|
||||||
return $1 . ':' . $2;
|
return $1 . ':' . $2;
|
||||||
}
|
}
|
||||||
@@ -456,7 +456,7 @@ sub check_time {
|
|||||||
sub check_datetime {
|
sub check_datetime {
|
||||||
my $date = shift;
|
my $date = shift;
|
||||||
|
|
||||||
return "" if ( ( !defined $date ) || ( $date eq '' ) );
|
return "" if ( !defined $date ) || ( $date eq '' );
|
||||||
if ( $date =~ /(\d\d\d\d)\-(\d\d?)\-(\d\d?)[T ](\d\d?)\:(\d\d?)/ ) {
|
if ( $date =~ /(\d\d\d\d)\-(\d\d?)\-(\d\d?)[T ](\d\d?)\:(\d\d?)/ ) {
|
||||||
return sprintf( "%04d-%02d-%02dT%02d:%02d", $1, $2, $3, $4, $5 );
|
return sprintf( "%04d-%02d-%02dT%02d:%02d", $1, $2, $3, $4, $5 );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ sub get_user {
|
|||||||
|
|
||||||
my $dbh = db::connect($config);
|
my $dbh = db::connect($config);
|
||||||
my $users = db::get( $dbh, $query, $bind_values );
|
my $users = db::get( $dbh, $query, $bind_values );
|
||||||
if ( @$users != 1 ) {
|
if ( scalar @$users != 1 ) {
|
||||||
print STDERR "cannot find user '$user'\n";
|
print STDERR "cannot find user '$user'\n";
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
@@ -503,7 +503,7 @@ sub get_user_permissions {
|
|||||||
&& ( $permission ne 'studio_id' )
|
&& ( $permission ne 'studio_id' )
|
||||||
&& ( $permission ne 'project_id' ) )
|
&& ( $permission ne 'project_id' ) )
|
||||||
{
|
{
|
||||||
$user_permissions->{$permission} = 1 if ( ( defined $user_role->{$permission} ) && ( $user_role->{$permission} ne '0' ) );
|
$user_permissions->{$permission} = 1 if ( defined $user_role->{$permission} ) && ( $user_role->{$permission} ne '0' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -524,7 +524,7 @@ sub get_user_id {
|
|||||||
};
|
};
|
||||||
my $dbh = db::connect($config);
|
my $dbh = db::connect($config);
|
||||||
my $users = db::get( $dbh, $query, [$user] );
|
my $users = db::get( $dbh, $query, [$user] );
|
||||||
return undef if ( @$users == 0 );
|
return undef if scalar @$users == 0;
|
||||||
return $users->[0]->{id};
|
return $users->[0]->{id};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -542,7 +542,7 @@ sub get_role_id {
|
|||||||
};
|
};
|
||||||
my $dbh = db::connect($config);
|
my $dbh = db::connect($config);
|
||||||
my $roles = db::get( $dbh, $query, [$role] );
|
my $roles = db::get( $dbh, $query, [$role] );
|
||||||
return undef if ( @$roles == 0 );
|
return undef if scalar @$roles == 0;
|
||||||
return $roles->[0]->{id};
|
return $roles->[0]->{id};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -565,7 +565,7 @@ sub assign_user_role {
|
|||||||
};
|
};
|
||||||
my $dbh = db::connect($config);
|
my $dbh = db::connect($config);
|
||||||
my $user_roles = db::get( $dbh, $query, [ $options->{project_id}, $options->{studio_id}, $options->{user_id}, $options->{role_id} ] );
|
my $user_roles = db::get( $dbh, $query, [ $options->{project_id}, $options->{studio_id}, $options->{user_id}, $options->{role_id} ] );
|
||||||
return undef if ( @$user_roles > 0 );
|
return undef if scalar @$user_roles > 0;
|
||||||
|
|
||||||
#insert entry
|
#insert entry
|
||||||
my $entry = {
|
my $entry = {
|
||||||
@@ -622,7 +622,7 @@ sub is_user_assigned_to_studio {
|
|||||||
};
|
};
|
||||||
|
|
||||||
my $user_studios = uac::get_studios_by_user( $config, $options2 );
|
my $user_studios = uac::get_studios_by_user( $config, $options2 );
|
||||||
return 1 if ( @$user_studios == 1 );
|
return 1 if scalar @$user_studios == 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -672,7 +672,7 @@ sub get_user_presets {
|
|||||||
|
|
||||||
#get all projects by user
|
#get all projects by user
|
||||||
my $projects = uac::get_projects_by_user( $config, { user => $user } );
|
my $projects = uac::get_projects_by_user( $config, { user => $user } );
|
||||||
return { error => "no project is assigned to user" } if ( @$projects == 0 );
|
return { error => "no project is assigned to user" } if scalar @$projects == 0;
|
||||||
|
|
||||||
$projects = project::get($config) if ( @$admin_roles > 0 );
|
$projects = project::get($config) if ( @$admin_roles > 0 );
|
||||||
my @projects = reverse sort { $a->{end_date} cmp $b->{end_date} } (@$projects);
|
my @projects = reverse sort { $a->{end_date} cmp $b->{end_date} } (@$projects);
|
||||||
@@ -695,13 +695,13 @@ sub get_user_presets {
|
|||||||
|
|
||||||
#check if studios are assigned to project
|
#check if studios are assigned to project
|
||||||
my $studios = project::get_studios( $config, { project_id => $project_id } );
|
my $studios = project::get_studios( $config, { project_id => $project_id } );
|
||||||
$error = "no studio is assigned to project" if ( @$studios == 0 );
|
$error = "no studio is assigned to project" if scalar @$studios == 0;
|
||||||
|
|
||||||
if ( @$admin_roles == 0 ) {
|
if ( scalar @$admin_roles == 0 ) {
|
||||||
|
|
||||||
#get all studios by user
|
#get all studios by user
|
||||||
$studios = uac::get_studios_by_user( $config, { user => $user, project_id => $project_id } );
|
$studios = uac::get_studios_by_user( $config, { user => $user, project_id => $project_id } );
|
||||||
$error = "no studio is assigned to user" if ( @$studios == 0 );
|
$error = "no studio is assigned to user" if scalar @$studios == 0;
|
||||||
if ( ( $studio_id ne '' ) && ( $studio_id ne '-1' ) ) {
|
if ( ( $studio_id ne '' ) && ( $studio_id ne '-1' ) ) {
|
||||||
my $studioFound = 0;
|
my $studioFound = 0;
|
||||||
for my $studio (@$studios) {
|
for my $studio (@$studios) {
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ sub getColors {
|
|||||||
$key =~ s/\s+$//;
|
$key =~ s/\s+$//;
|
||||||
$value =~ s/^\s+//;
|
$value =~ s/^\s+//;
|
||||||
$value =~ s/\s+$//;
|
$value =~ s/\s+$//;
|
||||||
$colorMap->{$key}->{color} = $value if ( ( $key ne '' ) && ( $value ne '' ) && ( defined $colorMap->{$key} ) );
|
$colorMap->{$key}->{color} = $value if ( $key ne '' ) && ( $value ne '' ) && ( defined $colorMap->{$key} ) ;
|
||||||
}
|
}
|
||||||
return $colors;
|
return $colors;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ sub increase {
|
|||||||
|
|
||||||
#print STDERR "exist:".Dumper($columns);
|
#print STDERR "exist:".Dumper($columns);
|
||||||
|
|
||||||
if ( @$entries == 0 ) {
|
if ( scalar @$entries == 0 ) {
|
||||||
my $entry = {
|
my $entry = {
|
||||||
project_id => $options->{project_id},
|
project_id => $options->{project_id},
|
||||||
studio_id => $options->{studio_id},
|
studio_id => $options->{studio_id},
|
||||||
@@ -232,7 +232,7 @@ sub increase {
|
|||||||
|
|
||||||
#print STDERR "user_stats::insert\n";
|
#print STDERR "user_stats::insert\n";
|
||||||
return insert( $config, $entry );
|
return insert( $config, $entry );
|
||||||
} elsif ( @$entries == 1 ) {
|
} elsif ( scalar @$entries == 1 ) {
|
||||||
my $entry = $entries->[0];
|
my $entry = $entries->[0];
|
||||||
$entry->{$usecase}++ if defined
|
$entry->{$usecase}++ if defined
|
||||||
|
|
||||||
|
|||||||
@@ -222,8 +222,8 @@ sub get_schedule_dates {
|
|||||||
|
|
||||||
my $is_exclude = $options->{exclude} || 0;
|
my $is_exclude = $options->{exclude} || 0;
|
||||||
my $dates = [];
|
my $dates = [];
|
||||||
return $dates if ( ( $is_exclude eq '1' ) && ( $schedule->{exclude} ne '1' ) );
|
return $dates if ( $is_exclude eq '1' ) && ( $schedule->{exclude} ne '1' );
|
||||||
return $dates if ( ( $is_exclude eq '0' ) && ( $schedule->{exclude} eq '1' ) );
|
return $dates if ( $is_exclude eq '0' ) && ( $schedule->{exclude} eq '1' );
|
||||||
|
|
||||||
if ( $schedule->{period_type} eq 'single' ) {
|
if ( $schedule->{period_type} eq 'single' ) {
|
||||||
$dates = get_single_date( $schedule->{start}, $schedule->{duration} );
|
$dates = get_single_date( $schedule->{start}, $schedule->{duration} );
|
||||||
@@ -265,7 +265,7 @@ sub get_week_of_month_dates {
|
|||||||
$c++;
|
$c++;
|
||||||
my @start = @{ time::datetime_to_array($start_datetime) };
|
my @start = @{ time::datetime_to_array($start_datetime) };
|
||||||
next unless @start >= 6;
|
next unless @start >= 6;
|
||||||
next if ( ( $c % $frequency ) != 0 );
|
next if ( $c % $frequency ) != 0;
|
||||||
|
|
||||||
my @end_datetime = Date::Calc::Add_Delta_DHMS(
|
my @end_datetime = Date::Calc::Add_Delta_DHMS(
|
||||||
$start[0], $start[1], $start[2], # start date
|
$start[0], $start[1], $start[2], # start date
|
||||||
@@ -323,7 +323,7 @@ sub get_dates {
|
|||||||
$date->{start} = sprintf( "%04d-%02d-%02d", @start_date ) . ' ' . $start_time;
|
$date->{start} = sprintf( "%04d-%02d-%02d", @start_date ) . ' ' . $start_time;
|
||||||
return undef if $duration eq '';
|
return undef if $duration eq '';
|
||||||
|
|
||||||
return undef if ( ( $frequency eq '' ) || ( $end_date eq '' ) );
|
return undef if ( $frequency eq '' ) || ( $end_date eq '' );
|
||||||
|
|
||||||
#continue on recurring date
|
#continue on recurring date
|
||||||
my @end = @{ time::datetime_to_array($end_date) };
|
my @end = @{ time::datetime_to_array($end_date) };
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
use warnings "all";
|
use warnings "all";
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
use URI::Escape();
|
use URI::Escape();
|
||||||
use Encode();
|
use Encode();
|
||||||
@@ -32,7 +31,7 @@ my $r = shift;
|
|||||||
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 ( $user, $expires ) = auth::get_user( $cgi, $config );
|
my ( $user, $expires ) = auth::get_user( $cgi, $config );
|
||||||
return if ( ( !defined $user ) || ( $user eq '' ) );
|
return if ( !defined $user ) || ( $user eq '' );
|
||||||
|
|
||||||
#print STDERR $params->{project_id}."\n";
|
#print STDERR $params->{project_id}."\n";
|
||||||
my $user_presets = uac::get_user_presets(
|
my $user_presets = uac::get_user_presets(
|
||||||
@@ -45,9 +44,9 @@ my $user_presets = uac::get_user_presets(
|
|||||||
);
|
);
|
||||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||||
$params->{studio_id} = $params->{default_studio_id}
|
$params->{studio_id} = $params->{default_studio_id}
|
||||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
if ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' );
|
||||||
$params->{project_id} = $user_presets->{project_id}
|
$params->{project_id} = $user_presets->{project_id}
|
||||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
if ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' );
|
||||||
|
|
||||||
#print STDERR $params->{project_id}."\n";
|
#print STDERR $params->{project_id}."\n";
|
||||||
my $request = {
|
my $request = {
|
||||||
@@ -81,7 +80,7 @@ unless ( $permissions->{scan_series_events} == 1 ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( defined $params->{action} ) {
|
if ( defined $params->{action} ) {
|
||||||
assign_series( $config, $request ) if ( $params->{action} eq 'assign_series' );
|
assign_series( $config, $request ) if $params->{action} eq 'assign_series';
|
||||||
}
|
}
|
||||||
show_events( $config, $request );
|
show_events( $config, $request );
|
||||||
|
|
||||||
@@ -98,11 +97,11 @@ sub show_events {
|
|||||||
|
|
||||||
my $projects = project::get( $config, { project_id => $params->{project_id} } );
|
my $projects = project::get( $config, { project_id => $params->{project_id} } );
|
||||||
my $project = $projects->[0];
|
my $project = $projects->[0];
|
||||||
return unless ( @$projects == 1 );
|
return unless scalar @$projects == 1 ;
|
||||||
|
|
||||||
my $studios = studios::get( $config, { project_id => $params->{project_id}, studio_id => $params->{studio_id} } );
|
my $studios = studios::get( $config, { project_id => $params->{project_id}, studio_id => $params->{studio_id} } );
|
||||||
my $studio = $studios->[0];
|
my $studio = $studios->[0];
|
||||||
return unless ( @$studios == 1 );
|
return unless scalar @$studios == 1 ;
|
||||||
|
|
||||||
my $project_name = $project->{name};
|
my $project_name = $project->{name};
|
||||||
my $studio_name = $studio->{location};
|
my $studio_name = $studio->{location};
|
||||||
|
|||||||
@@ -45,9 +45,9 @@ my $user_presets = uac::get_user_presets(
|
|||||||
);
|
);
|
||||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||||
$params->{studio_id} = $params->{default_studio_id}
|
$params->{studio_id} = $params->{default_studio_id}
|
||||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
if ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' );
|
||||||
$params->{project_id} = $user_presets->{project_id}
|
$params->{project_id} = $user_presets->{project_id}
|
||||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
if ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' );
|
||||||
|
|
||||||
#print STDERR $params->{project_id}."\n";
|
#print STDERR $params->{project_id}."\n";
|
||||||
my $request = {
|
my $request = {
|
||||||
@@ -154,7 +154,7 @@ sub show_events {
|
|||||||
push @$conditions, 'e.location=?';
|
push @$conditions, 'e.location=?';
|
||||||
push @$bind_values, $studio_name;
|
push @$bind_values, $studio_name;
|
||||||
}
|
}
|
||||||
$conditions = ' and ' . join( ' and ', @$conditions ) if ( @$conditions > 0 );
|
$conditions = ' and ' . join( ' and ', @$conditions ) if scalar(@$conditions) > 0;
|
||||||
$query = qq{
|
$query = qq{
|
||||||
select e.id, program, project, location, start, series_name, title, episode, rerun
|
select e.id, program, project, location, start, series_name, title, episode, rerun
|
||||||
from calcms_events e left join calcms_series_events se on se.event_id =e.id
|
from calcms_events e left join calcms_series_events se on se.event_id =e.id
|
||||||
@@ -254,7 +254,7 @@ sub assign_events {
|
|||||||
series_id => $entry->{series_id},
|
series_id => $entry->{series_id},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
if ( @$series == 0 ) {
|
if ( scalar(@$series) == 0 ) {
|
||||||
|
|
||||||
# assign series to project/studio
|
# assign series to project/studio
|
||||||
project::assign_series(
|
project::assign_series(
|
||||||
@@ -279,7 +279,7 @@ sub assign_events {
|
|||||||
series_id => $entry->{series_id},
|
series_id => $entry->{series_id},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
if ( @$series == 1 ) {
|
if ( scalar(@$series) == 1 ) {
|
||||||
my $serie = $series->[0];
|
my $serie = $series->[0];
|
||||||
|
|
||||||
#set event's series name to value from series
|
#set event's series name to value from series
|
||||||
|
|||||||
@@ -143,6 +143,7 @@ sub uploadRecording {
|
|||||||
$params->{error} .= $fileInfo->{error} if defined $fileInfo->{error};
|
$params->{error} .= $fileInfo->{error} if defined $fileInfo->{error};
|
||||||
$params->{path} = $fileInfo->{path};
|
$params->{path} = $fileInfo->{path};
|
||||||
$params->{size} = $fileInfo->{size};
|
$params->{size} = $fileInfo->{size};
|
||||||
|
|
||||||
#$params->{duration} = $fileInfo->{duration};
|
#$params->{duration} = $fileInfo->{duration};
|
||||||
$params = updateDatabase( $config, $params, $user ) if $params->{error} eq '';
|
$params = updateDatabase( $config, $params, $user ) if $params->{error} eq '';
|
||||||
} else {
|
} else {
|
||||||
@@ -292,6 +293,7 @@ sub showAudioRecordings {
|
|||||||
event_id => $params->{event_id},
|
event_id => $params->{event_id},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
#print Dumper($audioRecordings);
|
#print Dumper($audioRecordings);
|
||||||
for my $recording (@$audioRecordings) {
|
for my $recording (@$audioRecordings) {
|
||||||
$recording->{size} =~ s/(\d)(\d\d\d)$/$1\.$2/g;
|
$recording->{size} =~ s/(\d)(\d\d\d)$/$1\.$2/g;
|
||||||
@@ -402,6 +404,7 @@ sub updateDatabase {
|
|||||||
created_by => $user,
|
created_by => $user,
|
||||||
eventDuration => $eventDuration
|
eventDuration => $eventDuration
|
||||||
};
|
};
|
||||||
|
|
||||||
#print STDERR "updateDatabase:" . Dumper($entry);
|
#print STDERR "updateDatabase:" . Dumper($entry);
|
||||||
|
|
||||||
#connect
|
#connect
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ my $r = shift;
|
|||||||
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 ( $user, $expires ) = auth::get_user( $cgi, $config );
|
my ( $user, $expires ) = auth::get_user( $cgi, $config );
|
||||||
return if ( ( !defined $user ) || ( $user eq '' ) );
|
return if ( !defined $user ) || ( $user eq '' );
|
||||||
|
|
||||||
my $user_presets = uac::get_user_presets(
|
my $user_presets = uac::get_user_presets(
|
||||||
$config,
|
$config,
|
||||||
@@ -238,10 +238,12 @@ sub showCalendar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( $params->{search} =~ /\S/ ) {
|
if ( $params->{search} =~ /\S/ ) {
|
||||||
|
if ( $params->{list} == 1 ) {
|
||||||
$options->{search} = $params->{search};
|
$options->{search} = $params->{search};
|
||||||
delete $options->{from_date} if ( $params->{list} == 1 );
|
delete $options->{from_date};
|
||||||
delete $options->{till_date} if ( $params->{list} == 1 );
|
delete $options->{till_date};
|
||||||
delete $options->{date_range_include} if ( $params->{list} == 1 );
|
delete $options->{date_range_include};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$options->{draft} = 0 unless $params->{list} == 1;
|
$options->{draft} = 0 unless $params->{list} == 1;
|
||||||
@@ -291,9 +293,11 @@ sub showCalendar {
|
|||||||
|
|
||||||
if ( $params->{search} =~ /\S/ ) {
|
if ( $params->{search} =~ /\S/ ) {
|
||||||
$options->{search} = $params->{search};
|
$options->{search} = $params->{search};
|
||||||
delete $options->{from} if ( $params->{list} == 1 );
|
if ( $params->{list} == 1 ) {
|
||||||
delete $options->{till} if ( $params->{list} == 1 );
|
delete $options->{from};
|
||||||
delete $options->{date_range_include} if ( $params->{list} == 1 );
|
delete $options->{till};
|
||||||
|
delete $options->{date_range_include};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#get all series dates
|
#get all series dates
|
||||||
@@ -473,12 +477,12 @@ sub showCalendar {
|
|||||||
if ( $event->{start} =~ /(\d\d)\:\d\d\:\d\d$/ ) {
|
if ( $event->{start} =~ /(\d\d)\:\d\d\:\d\d$/ ) {
|
||||||
my $hour = $1;
|
my $hour = $1;
|
||||||
$hour += 24 if $hour < $start_of_day;
|
$hour += 24 if $hour < $start_of_day;
|
||||||
$min_hour = $hour if ( ( $hour < $min_hour ) && ( $hour >= $start_of_day ) );
|
$min_hour = $hour if ( $hour < $min_hour ) && ( $hour >= $start_of_day );
|
||||||
}
|
}
|
||||||
if ( $event->{end} =~ /(\d\d)\:\d\d\:\d\d$/ ) {
|
if ( $event->{end} =~ /(\d\d)\:\d\d\:\d\d$/ ) {
|
||||||
my $hour = $1;
|
my $hour = $1;
|
||||||
$hour += 24 if $hour <= $start_of_day;
|
$hour += 24 if $hour <= $start_of_day;
|
||||||
$max_hour = $hour if ( ( $hour > $max_hour ) && ( $hour <= $end_of_day ) );
|
$max_hour = $hour if ( $hour > $max_hour ) && ( $hour <= $end_of_day );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$cal_options->{min_hour} = $min_hour;
|
$cal_options->{min_hour} = $min_hour;
|
||||||
@@ -532,8 +536,6 @@ sub showCalendar {
|
|||||||
</html>
|
</html>
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if ( $params->{part} == 1 ) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -725,7 +727,8 @@ sub showEventList {
|
|||||||
my $events_by_day = shift;
|
my $events_by_day = shift;
|
||||||
my $language = $params->{language};
|
my $language = $params->{language};
|
||||||
|
|
||||||
print qq{
|
my $out = '';
|
||||||
|
$out = qq{
|
||||||
<div id="event_list">
|
<div id="event_list">
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
@@ -803,8 +806,6 @@ sub showEventList {
|
|||||||
|
|
||||||
my $rerun = $event->{rerun} || '-';
|
my $rerun = $event->{rerun} || '-';
|
||||||
|
|
||||||
#$rerun='-' if $rerun eq '0';
|
|
||||||
#$rerun='x' if $rerun eq '1';
|
|
||||||
$rerun = " [" . markup::base26( $event->{recurrence_count} + 1 ) . "]"
|
$rerun = " [" . markup::base26( $event->{recurrence_count} + 1 ) . "]"
|
||||||
if ( defined $event->{recurrence_count} ) && ( $event->{recurrence_count} ne '' ) && ( $event->{recurrence_count} > 0 );
|
if ( defined $event->{recurrence_count} ) && ( $event->{recurrence_count} ne '' ) && ( $event->{recurrence_count} > 0 );
|
||||||
|
|
||||||
@@ -815,7 +816,8 @@ sub showEventList {
|
|||||||
my $title = $event->{title};
|
my $title = $event->{title};
|
||||||
$title .= ': ' . $event->{user_title} if $event->{user_title} ne '';
|
$title .= ': ' . $event->{user_title} if $event->{user_title} ne '';
|
||||||
|
|
||||||
print qq!<tr id="$id" class="$class" date="$event->{start}" >!
|
$out .=
|
||||||
|
qq!<tr id="$id" class="$class" start="$event->{start}" >!
|
||||||
. qq!<td class="day_of_year">!
|
. qq!<td class="day_of_year">!
|
||||||
. time::dayOfYear( $event->{start} )
|
. time::dayOfYear( $event->{start} )
|
||||||
. q!</td>!
|
. q!</td>!
|
||||||
@@ -832,8 +834,12 @@ sub showEventList {
|
|||||||
. qq!</tr>! . "\n";
|
. qq!</tr>! . "\n";
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
|
if ( $i % 100 == 0 ) {
|
||||||
|
print $out;
|
||||||
|
$out = '';
|
||||||
}
|
}
|
||||||
print qq{
|
}
|
||||||
|
$out .= qq{
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@@ -851,14 +857,14 @@ sub showEventList {
|
|||||||
studio_id => $studio_id
|
studio_id => $studio_id
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
print q{<div id="event_no_series" style="display:none">};
|
$out .= q{<div id="event_no_series" style="display:none">};
|
||||||
print addEventsToSeries( $series, $params )
|
$out .= addEventsToSeries( $series, $params )
|
||||||
if ( ( defined $permissions->{assign_series_events} ) && ( $permissions->{assign_series_events} eq '1' ) );
|
if ( defined $permissions->{assign_series_events} ) && ( $permissions->{assign_series_events} eq '1' );
|
||||||
print createSeries($params) if ( ( defined $permissions->{create_series} ) && ( $permissions->{create_series} eq '1' ) );
|
$out .= createSeries($params) if ( defined $permissions->{create_series} ) && ( $permissions->{create_series} eq '1' );
|
||||||
print q{</div>};
|
$out .= q{</div>};
|
||||||
}
|
}
|
||||||
|
|
||||||
print qq{
|
$out .= qq{
|
||||||
</div><!--content-->
|
</div><!--content-->
|
||||||
</center>
|
</center>
|
||||||
<script>
|
<script>
|
||||||
@@ -873,6 +879,8 @@ sub showEventList {
|
|||||||
</html>
|
</html>
|
||||||
} if $params->{part} == 0;
|
} if $params->{part} == 0;
|
||||||
|
|
||||||
|
print $out;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub calcCalendarTable {
|
sub calcCalendarTable {
|
||||||
@@ -1167,7 +1175,7 @@ sub printSeries {
|
|||||||
my $out = '';
|
my $out = '';
|
||||||
|
|
||||||
#add schedule entry for series
|
#add schedule entry for series
|
||||||
if ( ( defined $permissions->{update_schedule} ) && ( $permissions->{update_schedule} eq '1' ) && ( @$series > 0 ) ) {
|
if ( ( defined $permissions->{update_schedule} ) && ( $permissions->{update_schedule} eq '1' ) && ( scalar(@$series) > 0 ) ) {
|
||||||
$out .= q{<div id="series" style="display:none">};
|
$out .= q{<div id="series" style="display:none">};
|
||||||
$out .= addSeries( $series, $params );
|
$out .= addSeries( $series, $params );
|
||||||
$out .= q{</div>};
|
$out .= q{</div>};
|
||||||
@@ -1235,7 +1243,7 @@ sub addSeries {
|
|||||||
my $params = shift;
|
my $params = shift;
|
||||||
|
|
||||||
return unless defined $series;
|
return unless defined $series;
|
||||||
return unless @$series > 0;
|
return unless scalar @$series > 0;
|
||||||
|
|
||||||
my $out = '';
|
my $out = '';
|
||||||
$out .= q{
|
$out .= q{
|
||||||
@@ -1283,7 +1291,7 @@ sub addEventsToSeries {
|
|||||||
my $params = shift;
|
my $params = shift;
|
||||||
|
|
||||||
return unless defined $series;
|
return unless defined $series;
|
||||||
return unless @$series > 0;
|
return unless scalar @$series > 0;
|
||||||
my $project_id = $params->{project_id};
|
my $project_id = $params->{project_id};
|
||||||
my $studio_id = $params->{studio_id};
|
my $studio_id = $params->{studio_id};
|
||||||
|
|
||||||
@@ -1490,15 +1498,15 @@ sub find_errors {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#check next events
|
#check next events
|
||||||
for my $i ( 0 .. @$events - 1 ) {
|
for my $i ( 0 .. scalar(@$events) - 1 ) {
|
||||||
my $event = $events->[$i];
|
my $event = $events->[$i];
|
||||||
next unless defined $event->{check_errors};
|
next unless defined $event->{check_errors};
|
||||||
|
|
||||||
#look for conflicts with next 5 events of day
|
#look for conflicts with next 5 events of day
|
||||||
my $min_index = $i + 1;
|
my $min_index = $i + 1;
|
||||||
next if $min_index >= @$events;
|
next if $min_index >= scalar @$events;
|
||||||
my $max_index = $i + 8;
|
my $max_index = $i + 8;
|
||||||
$max_index = @$events - 1 if $max_index >= @$events;
|
$max_index = scalar(@$events) - 1 if $max_index >= (@$events);
|
||||||
for my $j ( $min_index .. $max_index ) {
|
for my $j ( $min_index .. $max_index ) {
|
||||||
my $event2 = $events->[$j];
|
my $event2 = $events->[$j];
|
||||||
next unless defined $event2->{check_errors};
|
next unless defined $event2->{check_errors};
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ sub showComments {
|
|||||||
|
|
||||||
my $events = [];
|
my $events = [];
|
||||||
my $comment_count = 0;
|
my $comment_count = 0;
|
||||||
if ( @$results > 0 ) {
|
if ( scalar(@$results) > 0 ) {
|
||||||
my $comments = modify_comments( $request, $results );
|
my $comments = modify_comments( $request, $results );
|
||||||
|
|
||||||
$comments = comments::sort( $config, $comments );
|
$comments = comments::sort( $config, $comments );
|
||||||
@@ -151,9 +151,9 @@ sub showComments {
|
|||||||
$template_parameters->{search} = markup::fix_utf8( $request->{params}->{original}->{search} );
|
$template_parameters->{search} = markup::fix_utf8( $request->{params}->{original}->{search} );
|
||||||
$template_parameters->{events} = $events;
|
$template_parameters->{events} = $events;
|
||||||
$template_parameters->{debug} = $config->{system}->{debug};
|
$template_parameters->{debug} = $config->{system}->{debug};
|
||||||
$template_parameters->{event_count} = @$events + 0;
|
$template_parameters->{event_count} = scalar(@$events);
|
||||||
$template_parameters->{comment_count} = $comment_count;
|
$template_parameters->{comment_count} = $comment_count;
|
||||||
$template_parameters->{is_empty} = 1 if ( @$events == 0 );
|
$template_parameters->{is_empty} = 1 if scalar @$events == 0;
|
||||||
$template_parameters->{projects} = project::get_with_dates($config);
|
$template_parameters->{projects} = project::get_with_dates($config);
|
||||||
$template_parameters->{controllers} = $config->{controllers};
|
$template_parameters->{controllers} = $config->{controllers};
|
||||||
$template_parameters->{allow} = $permissions;
|
$template_parameters->{allow} = $permissions;
|
||||||
|
|||||||
@@ -373,7 +373,7 @@ sub getJson {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( @$series == 1 ) {
|
if ( scalar @$series == 1 ) {
|
||||||
my $serie = $series->[0];
|
my $serie = $series->[0];
|
||||||
$event->{has_single_events} = $serie->{has_single_events};
|
$event->{has_single_events} = $serie->{has_single_events};
|
||||||
if ( $event->{has_single_events} eq '1' ) {
|
if ( $event->{has_single_events} eq '1' ) {
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ sub show_image {
|
|||||||
);
|
);
|
||||||
|
|
||||||
#print STDERR Dumper($imagesByNames);
|
#print STDERR Dumper($imagesByNames);
|
||||||
$selectedImage = $imagesByNames->[0] if scalar(@$imagesByNames) > 0;
|
$selectedImage = $imagesByNames->[0] if scalar @$imagesByNames > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $finalResults = [];
|
my $finalResults = [];
|
||||||
|
|||||||
@@ -350,6 +350,7 @@ sub process_image {
|
|||||||
|
|
||||||
#$image->Normalize();
|
#$image->Normalize();
|
||||||
$image->Write( 'jpg:' . $image_path );
|
$image->Write( 'jpg:' . $image_path );
|
||||||
|
|
||||||
#write thumb
|
#write thumb
|
||||||
my $thumb = $image;
|
my $thumb = $image;
|
||||||
$thumb->Trim2Square;
|
$thumb->Trim2Square;
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ sub save_project {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
my $projects = project::get( $config, { name => $entry->{name} } );
|
my $projects = project::get( $config, { name => $entry->{name} } );
|
||||||
if ( @$projects > 0 ) {
|
if ( scalar @$projects > 0 ) {
|
||||||
uac::print_error("project with name '$entry->{name}' already exists");
|
uac::print_error("project with name '$entry->{name}' already exists");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -334,12 +334,6 @@ sub show_roles {
|
|||||||
#add permission rows
|
#add permission rows
|
||||||
$columns = sort_columns($columns);
|
$columns = sort_columns($columns);
|
||||||
|
|
||||||
# print '<pre>';
|
|
||||||
# for my $key (@$columns){
|
|
||||||
# printf (" %-40s => '',\n", "'".$key."'");
|
|
||||||
# }
|
|
||||||
# print '</pre>';
|
|
||||||
|
|
||||||
for my $key (@$columns) {
|
for my $key (@$columns) {
|
||||||
next
|
next
|
||||||
if ( $key eq 'level'
|
if ( $key eq 'level'
|
||||||
|
|||||||
@@ -361,9 +361,6 @@ sub save_series {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
#print STDERR "done\n";
|
|
||||||
#my @series_ids=@$series_ids;
|
|
||||||
|
|
||||||
if ( $params->{action} eq 'create' ) {
|
if ( $params->{action} eq 'create' ) {
|
||||||
|
|
||||||
unless ( $permissions->{create_series} == 1 ) {
|
unless ( $permissions->{create_series} == 1 ) {
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ use studios;
|
|||||||
use series;
|
use series;
|
||||||
use template;
|
use template;
|
||||||
use playout;
|
use playout;
|
||||||
|
|
||||||
binmode STDOUT, ":utf8";
|
binmode STDOUT, ":utf8";
|
||||||
|
|
||||||
my $r = shift;
|
my $r = shift;
|
||||||
|
|||||||
5
website/agenda/planung/showImage.cgi
Normal file → Executable file
5
website/agenda/planung/showImage.cgi
Normal file → Executable file
@@ -72,6 +72,11 @@ sub showImage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
my $filename = images::getInternalPath( $config, $params );
|
my $filename = images::getInternalPath( $config, $params );
|
||||||
|
unless ( defined $filename ) {
|
||||||
|
uac::permissions_denied("could not find path");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
unless ( -e $filename ) {
|
unless ( -e $filename ) {
|
||||||
uac::permissions_denied("read $filename");
|
uac::permissions_denied("read $filename");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ sub delete_studio {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
unless ( @$studio_assignments == 0 ) {
|
unless ( scalar @$studio_assignments == 0 ) {
|
||||||
uac::print_info("Studio unassigned from project");
|
uac::print_info("Studio unassigned from project");
|
||||||
uac::print_warn("Studio is assigned to other projects, so it will not be deleted");
|
uac::print_warn("Studio is assigned to other projects, so it will not be deleted");
|
||||||
return undef;
|
return undef;
|
||||||
@@ -141,7 +141,7 @@ sub save_studio {
|
|||||||
studios::update( $config, $entry );
|
studios::update( $config, $entry );
|
||||||
} else {
|
} else {
|
||||||
my $studios = studios::get( $config, { name => $entry->{name} } );
|
my $studios = studios::get( $config, { name => $entry->{name} } );
|
||||||
if ( @$studios > 0 ) {
|
if ( scalar @$studios > 0 ) {
|
||||||
uac::print_error("studio with name '$entry->{name}' already exists");
|
uac::print_error("studio with name '$entry->{name}' already exists");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -166,7 +166,7 @@ sub save_studio {
|
|||||||
has_single_events => 1
|
has_single_events => 1
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
if ( @$single_series == 0 ) {
|
if ( scalar @$single_series == 0 ) {
|
||||||
series::insert(
|
series::insert(
|
||||||
$config,
|
$config,
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,10 +51,6 @@
|
|||||||
|
|
||||||
<div> <a href="user_settings.cgi?project_id=<TMPL_VAR project_id>&studio_id=<TMPL_VAR default_studio_id>"><TMPL_VAR .loc.profile></a> </div>
|
<div> <a href="user_settings.cgi?project_id=<TMPL_VAR project_id>&studio_id=<TMPL_VAR default_studio_id>"><TMPL_VAR .loc.profile></a> </div>
|
||||||
|
|
||||||
<TMPL_IF .allow.is_admin>
|
|
||||||
<div> <a href="error_log.cgi"><TMPL_VAR .loc.errors></a> </div>
|
|
||||||
</TMPL_IF>
|
|
||||||
|
|
||||||
<div> <a href="help.cgi?project_id=<TMPL_VAR project_id>&studio_id=<TMPL_VAR default_studio_id>"><TMPL_VAR .loc.help></a> </div>
|
<div> <a href="help.cgi?project_id=<TMPL_VAR project_id>&studio_id=<TMPL_VAR default_studio_id>"><TMPL_VAR .loc.help></a> </div>
|
||||||
|
|
||||||
<select id="studio_id" name="studio_id" onchange="set_studio($(this).val())">
|
<select id="studio_id" name="studio_id" onchange="set_studio($(this).val())">
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ my $dbh = db::connect($config);
|
|||||||
my $template_parameters = {};
|
my $template_parameters = {};
|
||||||
$template_parameters->{projects} = getProjects( $dbh, $config, $params );
|
$template_parameters->{projects} = getProjects( $dbh, $config, $params );
|
||||||
$template_parameters->{debug} = $config->{system}->{debug};
|
$template_parameters->{debug} = $config->{system}->{debug};
|
||||||
$template_parameters->{server_cache} = $config->{cache}->{server_cache} if ( $config->{cache}->{server_cache} );
|
$template_parameters->{server_cache} = $config->{cache}->{server_cache} if $config->{cache}->{server_cache} ;
|
||||||
$template_parameters->{use_client_cache} = $config->{cache}->{use_client_cache} if ( $config->{cache}->{use_client_cache} );
|
$template_parameters->{use_client_cache} = $config->{cache}->{use_client_cache} if $config->{cache}->{use_client_cache} ;
|
||||||
|
|
||||||
#output template
|
#output template
|
||||||
my $template = $params->{template};
|
my $template = $params->{template};
|
||||||
@@ -103,9 +103,9 @@ sub getProjects {
|
|||||||
$project->{js_name} =~ s/\_+/\_/g;
|
$project->{js_name} =~ s/\_+/\_/g;
|
||||||
|
|
||||||
#mark last series_name entry of all non empty projects
|
#mark last series_name entry of all non empty projects
|
||||||
if ( ( defined $series_names ) && ( @$series_names > 0 ) ) {
|
if ( ( defined $series_names ) && ( scalar @$series_names > 0 ) ) {
|
||||||
$series_names->[-1]->{last} = 1;
|
$series_names->[-1]->{last} = 1;
|
||||||
$prev_series_names->[-1]->{last} = 0 if ( ( defined $prev_series_names ) && ( @$prev_series_names > 0 ) );
|
$prev_series_names->[-1]->{last} = 0 if ( defined $prev_series_names ) && ( sclar @$prev_series_names > 0 ) ;
|
||||||
$prev_series_names = $series_names;
|
$prev_series_names = $series_names;
|
||||||
}
|
}
|
||||||
push @$results, $project;
|
push @$results, $project;
|
||||||
|
|||||||
Reference in New Issue
Block a user