remove comments and cleanup
This commit is contained in:
@@ -144,9 +144,6 @@ sub get_query($$$) {
|
||||
$limit
|
||||
};
|
||||
|
||||
# where lock_status='show'
|
||||
# use Data::Dumper;print STDERR Dumper($query);
|
||||
|
||||
return ( \$query, $bind_values );
|
||||
}
|
||||
|
||||
@@ -430,10 +427,10 @@ sub get_events($$$$) {
|
||||
for my $comment (@$comments) {
|
||||
my $event_id = $comment->{event_id};
|
||||
my $event = $events_by_id->{$event_id};
|
||||
next unless ( defined $event );
|
||||
next unless defined $event;
|
||||
$event->{comment_count}++;
|
||||
push @{ $event->{comments} }, $comment; # if ($params->{event_id}ne'');
|
||||
$event->{max_comment_id} = $comment->{id} if ( $comment->{id} > $event->{max_comment_id} );
|
||||
$event->{max_comment_id} = $comment->{id} if $comment->{id} > $event->{max_comment_id};
|
||||
for my $name ( keys %{ $config->{controllers} } ) {
|
||||
$comment->{ "controller_" . $name } = $config->{controllers}->{$name} || '';
|
||||
|
||||
@@ -545,7 +542,7 @@ sub sort_childs {
|
||||
push @{$sorted_nodes}, $node;
|
||||
|
||||
#return if node is leaf
|
||||
return $sorted_nodes unless ( defined $node->{childs} );
|
||||
return $sorted_nodes unless defined $node->{childs};
|
||||
|
||||
#process child nodes
|
||||
for my $child ( @{ $node->{childs} } ) {
|
||||
|
||||
@@ -15,7 +15,7 @@ our @EXPORT_OK =
|
||||
sub extractEventFromWikiText($;$) {
|
||||
my $params = shift;
|
||||
my $event = shift;
|
||||
$event = {} unless ( defined $event );
|
||||
$event = {} unless defined $event;
|
||||
|
||||
my $title = $params->{title} || '';
|
||||
my $content = $params->{content} || '';
|
||||
@@ -185,7 +185,7 @@ sub extractMeta ($$) {
|
||||
my $comments = shift;
|
||||
my $meta = shift;
|
||||
|
||||
$meta = [] unless ( defined $meta );
|
||||
$meta = [] unless defined $meta;
|
||||
|
||||
#push meta tags into meta list
|
||||
if ( defined $comments ) {
|
||||
|
||||
@@ -61,7 +61,6 @@ sub setAttributesFromSchedule ($$$){
|
||||
my $params = shift;
|
||||
my $event = shift;
|
||||
|
||||
#print 'setAttributesFromSchedule:'.Dumper($params);
|
||||
#set attributes from schedule
|
||||
my $schedules = series_dates::get(
|
||||
$config,
|
||||
@@ -167,7 +166,6 @@ sub getNewEvent($$$) {
|
||||
|
||||
my $serie = eventOps::setAttributesFromSeriesTemplate( $config, $params, $event );
|
||||
|
||||
#print Dumper($params);
|
||||
if ( $action eq 'show_new_event_from_schedule' ) {
|
||||
eventOps::setAttributesFromSchedule( $config, $params, $event );
|
||||
} else {
|
||||
@@ -221,16 +219,8 @@ sub createEvent($$$) {
|
||||
push @$checklist, 'schedule' if $action eq 'create_event_from_schedule';
|
||||
}
|
||||
|
||||
#use Data::Dumper;
|
||||
#print Dumper($checklist);
|
||||
#print Dumper($request);
|
||||
#print Dumper($event);
|
||||
|
||||
my $start = $event->{start_date}, my $end = time::add_minutes_to_datetime( $event->{start_date}, $event->{duration} );
|
||||
|
||||
#print Dumper($start);
|
||||
#print Dumper($end);
|
||||
|
||||
my $result = series_events::check_permission(
|
||||
$request,
|
||||
{
|
||||
@@ -246,7 +236,6 @@ sub createEvent($$$) {
|
||||
}
|
||||
);
|
||||
|
||||
#print Dumper(" start_date => $event->{start_date}");
|
||||
unless ( $result eq '1' ) {
|
||||
uac::print_error($result);
|
||||
return undef;
|
||||
|
||||
@@ -175,7 +175,7 @@ sub creole_to_plain($) {
|
||||
|
||||
sub html_to_plain ($) {
|
||||
my $s = shift;
|
||||
return '' unless ( defined $s );
|
||||
return '' unless defined $s;
|
||||
my $tree = HTML::Parse::parse_html( '<body>' . $s . '</body>' );
|
||||
my $formatter = HTML::FormatText->new( leftmargin => 0, rightmargin => 2000 );
|
||||
$s = $formatter->format($tree);
|
||||
|
||||
@@ -54,8 +54,6 @@ sub get ($$) {
|
||||
$conditions
|
||||
};
|
||||
|
||||
#print $query."\n".Dumper(\@bind_values);
|
||||
|
||||
my $entries = db::get( $dbh, $query, \@bind_values );
|
||||
return $entries->[0] || undef;
|
||||
}
|
||||
@@ -77,7 +75,6 @@ sub update($$) {
|
||||
set $values
|
||||
where token=?
|
||||
};
|
||||
print STDERR $query . Dumper( \@bind_values );
|
||||
db::put( $dbh, $query, \@bind_values );
|
||||
}
|
||||
|
||||
@@ -88,7 +85,6 @@ sub insert ($$) {
|
||||
return undef unless defined $entry->{user};
|
||||
|
||||
my $dbh = db::connect($config);
|
||||
print STDERR 'insert ' . Dumper($entry);
|
||||
return db::insert( $dbh, 'calcms_password_requests', $entry );
|
||||
}
|
||||
|
||||
@@ -120,7 +116,6 @@ sub delete ($$) {
|
||||
$conditions
|
||||
};
|
||||
|
||||
print STDERR "$query " . Dumper( \@bind_values );
|
||||
db::put( $dbh, $query, \@bind_values );
|
||||
}
|
||||
|
||||
@@ -137,8 +132,6 @@ sub sendToken ($$) {
|
||||
my $oldEntry = password_requests::get( $config, { user => $entry->{user} } );
|
||||
if ( defined $oldEntry ) {
|
||||
my $createdAt = $oldEntry->{created_at};
|
||||
print STDERR Dumper($oldEntry);
|
||||
print STDERR "createdAt=$createdAt\n";
|
||||
my $age = time() - time::datetime_to_time($createdAt);
|
||||
if ( $age < 60 ) {
|
||||
print STDERR "too many requests";
|
||||
@@ -196,18 +189,13 @@ sub changePassword ($$$) {
|
||||
return { error => 'entered passwords do not match' };
|
||||
}
|
||||
|
||||
#print STDERR "error at changing password:" . Dumper($errors);
|
||||
|
||||
my $crypt = auth::crypt_password( $params->{user_password} );
|
||||
$user = { id => $user->{id} };
|
||||
$user->{salt} = $crypt->{salt};
|
||||
$user->{pass} = $crypt->{crypt};
|
||||
|
||||
#print '<pre>'.Dumper($user).'</pre>';
|
||||
$config->{access}->{write} = 1;
|
||||
print STDERR "update user" . Dumper($user);
|
||||
my $result = uac::update_user( $config, $user );
|
||||
print STDERR "result:" . Dumper($result);
|
||||
$config->{access}->{write} = 0;
|
||||
return { success => "password changed for $userName" };
|
||||
}
|
||||
|
||||
@@ -235,7 +235,6 @@ sub sync ($$) {
|
||||
my $config = shift;
|
||||
my $options = shift;
|
||||
|
||||
print STDERR "upload " . Dumper($options);
|
||||
return undef unless defined $options->{project_id};
|
||||
return undef unless defined $options->{studio_id};
|
||||
return undef unless defined $options->{from};
|
||||
@@ -268,8 +267,6 @@ sub sync ($$) {
|
||||
my $dbh = db::connect($config);
|
||||
my $entries = db::get( $dbh, $query, $bind_values );
|
||||
|
||||
#print STDERR "entries:".Dumper($entries);
|
||||
|
||||
# get database entries by date
|
||||
my $entries_by_date = {};
|
||||
for my $entry (@$entries) {
|
||||
@@ -280,7 +277,6 @@ sub sync ($$) {
|
||||
|
||||
# remove outdated entries
|
||||
unless ( defined $update_by_date->{$start} ) {
|
||||
print STDERR "delete:" . Dumper($entry);
|
||||
playout::delete( $config, $dbh, $entry );
|
||||
my $result = series_events::set_playout_status(
|
||||
$config,
|
||||
@@ -298,7 +294,6 @@ sub sync ($$) {
|
||||
# update existing entries
|
||||
if ( defined $update_by_date->{$start} ) {
|
||||
next if has_changed( $entry, $update_by_date->{$start} ) == 0;
|
||||
print STDERR "update:" . Dumper($entry);
|
||||
playout::update( $config, $dbh, $entry, $update_by_date->{$start} );
|
||||
my $result = series_events::set_playout_status(
|
||||
$config,
|
||||
@@ -320,7 +315,6 @@ sub sync ($$) {
|
||||
unless ( defined $entries_by_date->{$start} ) {
|
||||
$entry->{project_id} = $project_id;
|
||||
$entry->{studio_id} = $studio_id;
|
||||
print STDERR "insert:" . Dumper($entry);
|
||||
playout::insert( $config, $dbh, $entry );
|
||||
my $result = series_events::set_playout_status(
|
||||
$config,
|
||||
@@ -377,8 +371,6 @@ sub update ($$$$) {
|
||||
}
|
||||
|
||||
my $entry = $oldEntry;
|
||||
print STDERR "update:" . Dumper($entry);
|
||||
|
||||
my $day_start = $config->{date}->{day_starting_hour};
|
||||
$entry->{end} = playout::getEnd( $entry->{start}, $entry->{duration} );
|
||||
$entry->{start_date} = time::add_hours_to_datetime( $entry->{start}, -$day_start );
|
||||
|
||||
@@ -365,9 +365,9 @@ sub remove_user ($$) {
|
||||
my $config = shift;
|
||||
my $condition = shift;
|
||||
|
||||
return unless ( defined $condition->{project_id} );
|
||||
return unless ( defined $condition->{studio_id} );
|
||||
return unless ( defined $condition->{series_id} );
|
||||
return unless defined $condition->{project_id};
|
||||
return unless defined $condition->{studio_id};
|
||||
return unless defined $condition->{series_id};
|
||||
|
||||
my @conditions = ();
|
||||
my @bind_values = ();
|
||||
|
||||
@@ -537,7 +537,6 @@ sub delete ($$) {
|
||||
};
|
||||
my $bind_values = [ $entry->{project_id}, $entry->{studio_id}, $entry->{series_id} ];
|
||||
|
||||
#print '<pre>$query'.$query.Dumper($bind_values).'</pre>';
|
||||
db::put( $dbh, $query, $bind_values );
|
||||
}
|
||||
|
||||
|
||||
@@ -106,8 +106,8 @@ sub set_episode{
|
||||
my $config = shift;
|
||||
my $entry = shift;
|
||||
|
||||
return undef unless ( defined $entry->{id} );
|
||||
return undef unless ( defined $entry->{episode} );
|
||||
return undef unless defined $entry->{id};
|
||||
return undef unless defined $entry->{episode};
|
||||
|
||||
my $query = qq{
|
||||
update calcms_events
|
||||
@@ -131,9 +131,9 @@ sub save_event_time($$) {
|
||||
my $config = shift;
|
||||
my $entry = shift;
|
||||
|
||||
return undef unless ( defined $entry->{id} );
|
||||
return undef unless ( defined $entry->{duration} );
|
||||
return undef unless ( defined $entry->{start_date} );
|
||||
return undef unless defined $entry->{id};
|
||||
return undef unless defined $entry->{duration};
|
||||
return undef unless defined $entry->{start_date};
|
||||
|
||||
my $dbh = db::connect($config);
|
||||
my $event = {
|
||||
@@ -173,7 +173,6 @@ sub save_event_time($$) {
|
||||
};
|
||||
push @$bind_values, $event->{id};
|
||||
|
||||
#print STDERR $update_sql."\n".Dumper($bind_values)."\n";
|
||||
db::put( $dbh, $update_sql, $bind_values );
|
||||
return $event;
|
||||
}
|
||||
|
||||
@@ -167,7 +167,6 @@ sub delete($$) {
|
||||
};
|
||||
my $bind_values = [ $entry->{project_id}, $entry->{studio_id}, $entry->{series_id}, $entry->{schedule_id} ];
|
||||
|
||||
#print '<pre>$query'.$query.Dumper($bind_values).'</pre>';
|
||||
db::put( $dbh, $query, $bind_values );
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ sub update {
|
||||
my $config = shift;
|
||||
my $entry = shift;
|
||||
|
||||
return undef unless ( defined $entry->{schedule_id} );
|
||||
return undef unless defined $entry->{schedule_id};
|
||||
|
||||
my $dbh = db::connect($config);
|
||||
|
||||
@@ -270,10 +270,9 @@ sub delete {
|
||||
my $config = shift;
|
||||
my $entry = shift;
|
||||
|
||||
#print STDERR "delete:".Dumper($entry);
|
||||
return unless ( defined $entry->{project_id} );
|
||||
return unless ( defined $entry->{studio_id} );
|
||||
return unless ( defined $entry->{schedule_id} );
|
||||
return unless defined $entry->{project_id};
|
||||
return unless defined $entry->{studio_id};
|
||||
return unless defined $entry->{schedule_id};
|
||||
|
||||
my $dbh = db::connect($config);
|
||||
|
||||
@@ -284,7 +283,6 @@ sub delete {
|
||||
};
|
||||
my $bind_values = [ $entry->{schedule_id} ];
|
||||
|
||||
#print '<pre>$query'.$query.Dumper($bind_values).'</pre>';
|
||||
db::put( $dbh, $query, $bind_values );
|
||||
}
|
||||
|
||||
@@ -297,8 +295,6 @@ sub can_studio_edit_events {
|
||||
my @conditions = ();
|
||||
my @bind_values = ();
|
||||
|
||||
#print Dumper($condition);
|
||||
|
||||
#return 0 unless defined $condition->{project_id};
|
||||
return 0 unless defined $condition->{studio_id};
|
||||
return 0 unless defined $condition->{start};
|
||||
@@ -363,8 +359,6 @@ sub getMergedDays {
|
||||
my @conditions = ();
|
||||
my @bind_values = ();
|
||||
|
||||
#print Dumper($condition);
|
||||
|
||||
#return 0 unless defined $condition->{project_id};
|
||||
return 0 unless defined $condition->{studio_id};
|
||||
return 0 unless defined $condition->{start};
|
||||
@@ -411,20 +405,13 @@ sub getMergedDays {
|
||||
order by start
|
||||
};
|
||||
|
||||
# print STDERR Dumper($query).Dumper(\@bind_values);
|
||||
|
||||
my $entries = db::get( $dbh, $query, \@bind_values );
|
||||
|
||||
# print STDERR Dumper($entries);
|
||||
|
||||
if ( scalar(@$entries) == 2 ) {
|
||||
if ( $entries->[0]->{end} eq $entries->[1]->{start} ) {
|
||||
$entries = {
|
||||
start => $entries->[0]->{start},
|
||||
end => $entries->[1]->{end}
|
||||
};
|
||||
|
||||
# print STDERR "found".Dumper($entries)."\n";
|
||||
return $entries;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,9 +56,6 @@ sub get($$) {
|
||||
order by start
|
||||
};
|
||||
|
||||
#print $query."\n";
|
||||
#print Dumper(\@bind_values);
|
||||
|
||||
my $entries = db::get( $dbh, $query, \@bind_values );
|
||||
for my $entry (@$entries) {
|
||||
$entry->{schedule_id} = $entry->{id};
|
||||
@@ -71,11 +68,11 @@ sub insert($$) {
|
||||
my $config = shift;
|
||||
my $entry = shift;
|
||||
|
||||
return unless ( defined $entry->{project_id} );
|
||||
return unless ( defined $entry->{studio_id} );
|
||||
return unless ( defined $entry->{start} );
|
||||
return unless ( defined $entry->{end} );
|
||||
return unless ( defined $entry->{frequency} );
|
||||
return unless defined $entry->{project_id};
|
||||
return unless defined $entry->{studio_id};
|
||||
return unless defined $entry->{start};
|
||||
return unless defined $entry->{end};
|
||||
return unless defined $entry->{frequency};
|
||||
|
||||
my $dbh = db::connect($config);
|
||||
return db::insert( $dbh, 'calcms_studio_timeslot_schedule', $entry );
|
||||
@@ -86,12 +83,12 @@ sub update($$) {
|
||||
my $config = shift;
|
||||
my $entry = shift;
|
||||
|
||||
return unless ( defined $entry->{project_id} );
|
||||
return unless ( defined $entry->{studio_id} );
|
||||
return unless ( defined $entry->{schedule_id} );
|
||||
return unless ( defined $entry->{start} );
|
||||
return unless ( defined $entry->{end} );
|
||||
return unless ( defined $entry->{frequency} );
|
||||
return unless defined $entry->{project_id};
|
||||
return unless defined $entry->{studio_id};
|
||||
return unless defined $entry->{schedule_id};
|
||||
return unless defined $entry->{start};
|
||||
return unless defined $entry->{end};
|
||||
return unless defined $entry->{frequency};
|
||||
|
||||
$entry->{id} = $entry->{schedule_id};
|
||||
delete $entry->{schedule_id};
|
||||
@@ -121,7 +118,7 @@ sub delete ($$){
|
||||
my $config = shift;
|
||||
my $entry = shift;
|
||||
|
||||
return unless ( defined $entry->{schedule_id} );
|
||||
return unless defined $entry->{schedule_id};
|
||||
|
||||
my $dbh = db::connect($config);
|
||||
|
||||
@@ -132,7 +129,6 @@ sub delete ($$){
|
||||
};
|
||||
my $bind_values = [ $entry->{schedule_id} ];
|
||||
|
||||
#print '<pre>$query'.$query.Dumper($bind_values).'</pre>';
|
||||
db::put( $dbh, $query, $bind_values );
|
||||
}
|
||||
|
||||
|
||||
@@ -481,7 +481,7 @@ sub check_datetime($) {
|
||||
|
||||
sub check_year_month($) {
|
||||
my $date = shift;
|
||||
return -1 unless ( defined $date );
|
||||
return -1 unless defined $date;
|
||||
return $date if ( $date eq '' );
|
||||
if ( $date =~ /(\d\d\d\d)\-(\d\d?)/ ) {
|
||||
return $1 . '-' . $2 . '-' . $3;
|
||||
|
||||
@@ -89,7 +89,7 @@ sub get_users_by_studio ($$) {
|
||||
my $config = shift;
|
||||
my $condition = shift;
|
||||
|
||||
return unless ( defined $condition->{studio_id} );
|
||||
return unless defined $condition->{studio_id};
|
||||
|
||||
my @conditions = ();
|
||||
my @bind_values = ();
|
||||
@@ -517,7 +517,7 @@ sub get_user_id ($$) {
|
||||
my $config = shift;
|
||||
my $user = shift;
|
||||
|
||||
return undef unless ( defined $user );
|
||||
return undef unless defined $user;
|
||||
|
||||
my $query = qq{
|
||||
select id
|
||||
@@ -535,7 +535,7 @@ sub get_role_id ($$) {
|
||||
my $config = shift;
|
||||
my $role = shift;
|
||||
|
||||
return undef unless ( defined $role );
|
||||
return undef unless defined $role;
|
||||
|
||||
my $query = qq{
|
||||
select id
|
||||
|
||||
@@ -80,8 +80,6 @@ sub get($$) {
|
||||
order by exclude, start
|
||||
};
|
||||
|
||||
#print STDERR $query."\n".Dumper(\@bind_values);
|
||||
|
||||
my $entries = db::get( $dbh, $query, \@bind_values );
|
||||
return $entries;
|
||||
}
|
||||
@@ -143,7 +141,6 @@ sub delete($$) {
|
||||
};
|
||||
my $bind_values = [ $entry->{project_id}, $entry->{studio_id}, $entry->{schedule_id} ];
|
||||
|
||||
#print '<pre>$query'.$query.Dumper($bind_values).'</pre>';
|
||||
return db::put( $dbh, $query, $bind_values );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user