add draft status to events

This commit is contained in:
Milan
2018-01-25 20:50:44 +01:00
parent 459d36b7c7
commit 6222e2a63f
12 changed files with 101 additions and 28 deletions

View File

@@ -31,12 +31,12 @@ CREATE TABLE `calcms_audio_recordings` (
`path` varchar(300) NOT NULL, `path` varchar(300) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`size` bigint(20) unsigned NOT NULL DEFAULT '0', `size` bigint(20) unsigned NOT NULL DEFAULT '0',
`audioDuration` float DEFAULT '0', `audioDuration` float NOT NULL DEFAULT '0',
`eventDuration` int(11) DEFAULT '0', `eventDuration` int(11) NOT NULL DEFAULT '0',
`rmsLeft` float DEFAULT NULL, `rmsLeft` float NOT NULL,
`rmsRight` float DEFAULT NULL, `rmsRight` float NOT NULL,
`mastered` tinyint(1) DEFAULT '0', `mastered` tinyint(1) NOT NULL DEFAULT '0',
`processed` tinyint(1) DEFAULT '0', `processed` tinyint(1) NOT NULL DEFAULT '0',
`modified_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `modified_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `project_index` (`project_id`), KEY `project_index` (`project_id`),
@@ -178,6 +178,7 @@ CREATE TABLE `calcms_event_history` (
`series_id` int(10) unsigned DEFAULT NULL, `series_id` int(10) unsigned DEFAULT NULL,
`deleted` tinyint(1) unsigned DEFAULT '0', `deleted` tinyint(1) unsigned DEFAULT '0',
`project_id` int(10) unsigned NOT NULL, `project_id` int(10) unsigned NOT NULL,
`draft` tinyint(3) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `end` (`end`), KEY `end` (`end`),
KEY `start` (`start`), KEY `start` (`start`),
@@ -262,6 +263,7 @@ CREATE TABLE `calcms_events` (
`modified_by` varchar(20) DEFAULT NULL, `modified_by` varchar(20) DEFAULT NULL,
`archive_url` varchar(300) DEFAULT NULL, `archive_url` varchar(300) DEFAULT NULL,
`recurrence_count` int(10) unsigned NOT NULL DEFAULT '0', `recurrence_count` int(10) unsigned NOT NULL DEFAULT '0',
`draft` tinyint(1) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `end` (`end`), KEY `end` (`end`),
KEY `start` (`start`), KEY `start` (`start`),
@@ -281,7 +283,8 @@ CREATE TABLE `calcms_events` (
KEY `location` (`location`), KEY `location` (`location`),
KEY `published` (`published`), KEY `published` (`published`),
KEY `preproduced` (`playout`), KEY `preproduced` (`playout`),
KEY `archived` (`archived`) KEY `archived` (`archived`),
KEY `draft` (`draft`)
) ENGINE=MyISAM AUTO_INCREMENT=23271 DEFAULT CHARSET=utf8; ) ENGINE=MyISAM AUTO_INCREMENT=23271 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
@@ -391,8 +394,8 @@ CREATE TABLE `calcms_playout` (
`rms_right` float DEFAULT NULL, `rms_right` float DEFAULT NULL,
`rms_image` varchar(300) DEFAULT NULL, `rms_image` varchar(300) DEFAULT NULL,
`replay_gain` float DEFAULT NULL, `replay_gain` float DEFAULT NULL,
`updated_at` datetime DEFAULT CURRENT_TIMESTAMP, `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`modified_at` datetime DEFAULT NULL, `modified_at` datetime NOT NULL,
PRIMARY KEY (`project_id`,`studio_id`,`start`), PRIMARY KEY (`project_id`,`studio_id`,`start`),
KEY `project_id` (`project_id`), KEY `project_id` (`project_id`),
KEY `studio_id` (`studio_id`), KEY `studio_id` (`studio_id`),
@@ -586,6 +589,7 @@ CREATE TABLE `calcms_roles` (
`upload_audio_recordings` tinyint(1) unsigned NOT NULL, `upload_audio_recordings` tinyint(1) unsigned NOT NULL,
`delete_audio_recordings` tinyint(1) unsigned NOT NULL, `delete_audio_recordings` tinyint(1) unsigned NOT NULL,
`read_playout` tinyint(1) unsigned NOT NULL, `read_playout` tinyint(1) unsigned NOT NULL,
`update_event_status_draft` tinyint(1) unsigned NOT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `role_2` (`role`), UNIQUE KEY `role_2` (`role`),
KEY `studio_id` (`studio_id`), KEY `studio_id` (`studio_id`),
@@ -600,7 +604,7 @@ CREATE TABLE `calcms_roles` (
LOCK TABLES `calcms_roles` WRITE; LOCK TABLES `calcms_roles` WRITE;
/*!40000 ALTER TABLE `calcms_roles` DISABLE KEYS */; /*!40000 ALTER TABLE `calcms_roles` DISABLE KEYS */;
INSERT INTO `calcms_roles` VALUES (7,'Admin',1,1,1,1,1,1,1,1,1,1,1,1,1,1,7,1,1,1,'0000-00-00 00:00:00','2017-07-30 14:32:32',1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);/*!40000 ALTER TABLE `calcms_roles` ENABLE KEYS */; INSERT INTO `calcms_roles` VALUES (7,'Admin',1,1,1,1,1,1,1,1,1,1,1,1,1,1,7,1,1,1,'0000-00-00 00:00:00','2017-07-30 14:32:32',1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);/*!40000 ALTER TABLE `calcms_roles` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
-- --
@@ -1068,7 +1072,7 @@ CREATE TABLE `calcms_users` (
`full_name` varchar(30) DEFAULT NULL, `full_name` varchar(30) DEFAULT NULL,
`salt` varchar(32) NOT NULL, `salt` varchar(32) NOT NULL,
`pass` varchar(100) NOT NULL, `pass` varchar(100) NOT NULL,
`email` varchar(300) DEFAULT NULL, `email` varchar(300) NOT NULL,
`modified_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `modified_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`disabled` int(10) unsigned DEFAULT '0', `disabled` int(10) unsigned DEFAULT '0',

View File

@@ -80,4 +80,18 @@ ALTER TABLE `calcms_users`
CHANGE COLUMN created_at created_at timestamp NULL DEFAULT CURRENT_TIMESTAMP, CHANGE COLUMN created_at created_at timestamp NULL DEFAULT CURRENT_TIMESTAMP,
CHANGE COLUMN modified_at modified_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP; CHANGE COLUMN modified_at modified_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP;
ALTER TABLE `calcms_audio_recordings`
CHANGE COLUMN processed processed tinyint(1) NOT NULL DEFAULT '0',
CHANGE COLUMN modified_at modified_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
CHANGE COLUMN mastered mastered tinyint(1) NOT NULL DEFAULT '0',
CHANGE COLUMN eventDuration eventDuration int(11) NOT NULL DEFAULT '0',
CHANGE COLUMN rmsLeft rmsLeft float NOT NULL,
CHANGE COLUMN rmsRight rmsRight float NOT NULL,
CHANGE COLUMN audioDuration audioDuration float NOT NULL DEFAULT '0';
ALTER TABLE `calcms_events`
ADD COLUMN draft tinyint(1) unsigned NOT NULL DEFAULT '0' AFTER recurrence_count;
ALTER TABLE `calcms_users`
CHANGE COLUMN email email varchar(300) NOT NULL;

View File

@@ -630,6 +630,12 @@ sub get_query {
push @$bind_values, $published; push @$bind_values, $published;
} }
my $draft = $params->{draft} || '0';
if ( ( $draft eq '0' ) || ( $draft eq '1' ) ) {
push @$where_cond, 'draft=?';
push @$bind_values, $draft;
}
} else { } else {
# conditions by date # conditions by date
@@ -937,6 +943,14 @@ sub get_query {
push @$bind_values, $published; push @$bind_values, $published;
} }
#filter by draft, default =1, set to 'all' to see all
my $draft_cond = '';
my $draft = $params->{draft} || '0';
if ( ( $draft eq '0' ) || ( $draft eq '1' ) ) {
$draft_cond = 'draft=?';
push @$bind_values, $draft;
}
my $disable_event_sync_cond = ''; my $disable_event_sync_cond = '';
my $disable_event_sync = $params->{disable_event_sync} || ''; my $disable_event_sync = $params->{disable_event_sync} || '';
if ( ( $disable_event_sync eq '0' ) || ( $disable_event_sync eq '1' ) ) { if ( ( $disable_event_sync eq '0' ) || ( $disable_event_sync eq '1' ) ) {
@@ -960,6 +974,7 @@ sub get_query {
push @$where_cond, $search_cond if ( $search_cond =~ /\S/ ); push @$where_cond, $search_cond if ( $search_cond =~ /\S/ );
push @$where_cond, $project_cond if ( $project_cond =~ /\S/ ); push @$where_cond, $project_cond if ( $project_cond =~ /\S/ );
push @$where_cond, $published_cond if ( $published_cond =~ /\S/ ); push @$where_cond, $published_cond if ( $published_cond =~ /\S/ );
push @$where_cond, $draft_cond if ( $draft_cond =~ /\S/ );
push @$where_cond, $disable_event_sync_cond push @$where_cond, $disable_event_sync_cond
if ( $disable_event_sync_cond ne '' ); if ( $disable_event_sync_cond ne '' );
@@ -1016,6 +1031,7 @@ sub get_query {
,e.user_title ,e.user_title
,e.user_excerpt ,e.user_excerpt
,e.published ,e.published
,e.draft
,e.playout ,e.playout
,e.archived ,e.archived
,e.rerun ,e.rerun

View File

@@ -486,10 +486,17 @@ sub get_events{
push @conditions, 'e.location = ?'; push @conditions, 'e.location = ?';
push @bind_values, $options->{location}; push @bind_values, $options->{location};
} }
if(defined $options->{draft}){
push @conditions, 'e.draft = ?';
push @bind_values, $options->{draft};
}
my $conditions=''; my $conditions='';
if (@conditions>0){ if (@conditions>0){
$conditions=' and '.join(' and ', @conditions); $conditions=' and '.join(' and ', @conditions);
} }
my $limit=''; my $limit='';
if( (defined $options->{limit}) && ($limit=~/(\d+)/) ){ if( (defined $options->{limit}) && ($limit=~/(\d+)/) ){
$limit='limit '.$1; $limit='limit '.$1;
@@ -543,6 +550,7 @@ sub get_event{
my $studio_id = $options->{studio_id}||''; my $studio_id = $options->{studio_id}||'';
my $series_id = $options->{series_id}||''; my $series_id = $options->{series_id}||'';
my $event_id = $options->{event_id} ||''; my $event_id = $options->{event_id} ||'';
my $draft = $options->{draft} ||'';
unless(defined($options->{allow_any})){ unless(defined($options->{allow_any})){
if ($project_id eq''){ if ($project_id eq''){
@@ -569,6 +577,7 @@ sub get_event{
$queryOptions->{studio_id} = $studio_id if $studio_id ne ''; $queryOptions->{studio_id} = $studio_id if $studio_id ne '';
$queryOptions->{series_id} = $series_id if $series_id ne ''; $queryOptions->{series_id} = $series_id if $series_id ne '';
$queryOptions->{event_id} = $event_id if $event_id ne ''; $queryOptions->{event_id} = $event_id if $event_id ne '';
$queryOptions->{draft} = $draft if $draft ne '';
my $events=series::get_events($config, $queryOptions); my $events=series::get_events($config, $queryOptions);
@@ -1113,6 +1122,7 @@ sub update_recurring_events{
project_id => $options->{project_id}, project_id => $options->{project_id},
studio_id => $options->{studio_id}, studio_id => $options->{studio_id},
series_id => $options->{series_id}, series_id => $options->{series_id},
draft => 0
} }
); );
@$events=sort { $a->{start} cmp $b->{start}} @$events; @$events=sort { $a->{start} cmp $b->{start}} @$events;

View File

@@ -72,12 +72,13 @@ sub save_content{
for my $key ('series_name', 'title', 'excerpt', 'content', 'html_content', for my $key ('series_name', 'title', 'excerpt', 'content', 'html_content',
'user_title', 'user_excerpt', 'topic', 'html_topic', 'user_title', 'user_excerpt', 'topic', 'html_topic',
'episode', 'image', 'podcast_url', 'archive_url', 'episode', 'image', 'podcast_url', 'archive_url',
'live', 'published', 'playout', 'archived', 'rerun', 'disable_event_sync', 'live', 'published', 'playout', 'archived', 'rerun', 'draft', 'disable_event_sync',
'modified_by' 'modified_by'
){ ){
push @keys, $key if defined $entry->{$key}; push @keys, $key if defined $entry->{$key};
} }
$entry->{episode}=undef if((defined $entry->{episode}) && ($entry->{episode}eq'0')); $entry->{episode} = undef if (defined $entry->{episode}) && ($entry->{episode} eq '0');
$entry->{published} = 0 if (defined $entry->{draft}) && ($entry->{draft} eq '1');
my $values =join(",", map {$_.'=?'} (@keys)); my $values =join(",", map {$_.'=?'} (@keys));
my @bind_values =map {$entry->{$_}} (@keys); my @bind_values =map {$entry->{$_}} (@keys);
@@ -89,7 +90,7 @@ sub save_content{
where id=? where id=?
}; };
#print STDERR $query.Dumper(\@bind_values); print STDERR $query.Dumper(\@bind_values);
db::put($dbh, $query, \@bind_values); db::put($dbh, $query, \@bind_values);
return $entry; return $entry;
} }
@@ -307,6 +308,9 @@ sub check_permission{
my $series_name=$series->[0]->{series_name}||''; my $series_name=$series->[0]->{series_name}||'';
$series_name.=' - '.$series->[0]->{title} if $series->[0]->{series_name} ne ''; $series_name.=' - '.$series->[0]->{title} if $series->[0]->{series_name} ne '';
my $draft = 0;
$draft = 1 if (defined $options->{draft}) && ($options->{draft} == 1 );
#check all items from checklist #check all items from checklist
if((defined $check->{user})&&(uac::is_user_assigned_to_studio($request, $options)==0)){ if((defined $check->{user})&&(uac::is_user_assigned_to_studio($request, $options)==0)){
return "User '$request->{user}' is not assigned to studio $studio_name ($options->{studio_id})"; return "User '$request->{user}' is not assigned to studio $studio_name ($options->{studio_id})";
@@ -328,7 +332,7 @@ sub check_permission{
return "User $request->{user} cannot create events for series '$series_name' ($options->{series_id})"; return "User $request->{user} cannot create events for series '$series_name' ($options->{series_id})";
} }
if((defined $check->{studio_timeslots})&&(studio_timeslot_dates::can_studio_edit_events($config, $options)==0)){ if( ($draft==0) && (defined $check->{studio_timeslots}) && (studio_timeslot_dates::can_studio_edit_events($config, $options)==0) ){
return "requested time is not assigned to studio '$studio_name' ($options->{studio_id})"; return "requested time is not assigned to studio '$studio_name' ($options->{studio_id})";
} }
@@ -340,7 +344,7 @@ sub check_permission{
} }
# prevent editing events that are over for more than 14 days # prevent editing events that are over for more than 14 days
if(defined $check->{event_age}){ if( ($draft==0) && (defined $check->{event_age}) ){
if (series::is_event_older_than_days($config, { if (series::is_event_older_than_days($config, {
project_id => $options->{project_id}, project_id => $options->{project_id},
studio_id => $options->{studio_id}, studio_id => $options->{studio_id},
@@ -356,7 +360,7 @@ sub check_permission{
} }
#check if schedule event exists for given date #check if schedule event exists for given date
if(defined $check->{schedule}){ if( ($draft == 0) && (defined $check->{schedule}) ){
return "unknown series" unless defined $series; return "unknown series" unless defined $series;
return "missing start_at at check_permission" unless defined $options->{start_date}; return "missing start_at at check_permission" unless defined $options->{start_date};
#TODO: check "is_event_scheduled" if start_at could be moved to start_date #TODO: check "is_event_scheduled" if start_at could be moved to start_date
@@ -414,7 +418,7 @@ sub insert_event{
$event->{'html_topic'} = markup::creole_to_html($event->{'topic'}) if defined $event->{'topic'}; $event->{'html_topic'} = markup::creole_to_html($event->{'topic'}) if defined $event->{'topic'};
#add event status #add event status
for my $attr ('live', 'published', 'playout', 'archived', 'rerun', 'disable_event_sync'){ for my $attr ('live', 'published', 'playout', 'archived', 'rerun', 'draft', 'disable_event_sync'){
$event->{$attr}=$params->{$attr}||0; $event->{$attr}=$params->{$attr}||0;
} }

View File

@@ -18,6 +18,10 @@ our $defaultColors=[
name => 'color_event', name => 'color_event',
css => '#content .event', css => '#content .event',
color => '#c5e1a5' color => '#c5e1a5'
},{
name => 'color_draft',
css => '#content .draft',
color => '#eeeeee',
},{ },{
name => 'color_schedule', name => 'color_schedule',
css => '#content .schedule', css => '#content .schedule',

View File

@@ -40,6 +40,5 @@ if ($0=~/comments.*?\.cgi$/){
print $output; print $output;
} }
#do not delete last line #do not delete last line
1; 1;

View File

@@ -246,6 +246,8 @@ sub showCalendar {
delete $options->{date_range_include} if ( $params->{list} == 1 ); delete $options->{date_range_include} if ( $params->{list} == 1 );
} }
$options->{draft}=0 unless $params->{list}==1;
#get events sorted by date #get events sorted by date
$events = getSeriesEvents( $config, $request, $options, $params ); $events = getSeriesEvents( $config, $request, $options, $params );
unless ( $params->{list} == 1 ) { unless ( $params->{list} == 1 ) {
@@ -723,6 +725,7 @@ sub showEventList {
<th class="episode">$params->{loc}->{label_episode}</th> <th class="episode">$params->{loc}->{label_episode}</th>
<th class="rerun" title="$params->{loc}->{label_rerun}"><img src="image/32/rerun.png"></th> <th class="rerun" title="$params->{loc}->{label_rerun}"><img src="image/32/rerun.png"></th>
<th class="live" title="$params->{loc}->{label_live}"><img src="image/32/live.png"></th> <th class="live" title="$params->{loc}->{label_live}"><img src="image/32/live.png"></th>
<th class="draft" title="$params->{loc}->{label_draft}"><img src="image/32/draft.png"></th>
<th class="archive" title="$params->{loc}->{label_archived}"><img src="image/32/archived.png"></th> <th class="archive" title="$params->{loc}->{label_archived}"><img src="image/32/archived.png"></th>
</tr> </tr>
</thead> </thead>
@@ -754,7 +757,7 @@ sub showEventList {
$class .= ' error' if defined $event->{error}; $class .= ' error' if defined $event->{error};
$class .= ' no_series' if ( ( $class eq 'event' ) && ( $event->{series_id} eq '-1' ) ); $class .= ' no_series' if ( ( $class eq 'event' ) && ( $event->{series_id} eq '-1' ) );
for my $filter ( 'rerun', 'archived', 'playout', 'published', 'live', 'disable_event_sync' ) { for my $filter ( 'rerun', 'archived', 'playout', 'published', 'live', 'disable_event_sync', 'draft' ) {
$class .= ' ' . $filter if ( ( defined $event->{$filter} ) && ( $event->{$filter} eq '1' ) ); $class .= ' ' . $filter if ( ( defined $event->{$filter} ) && ( $event->{$filter} eq '1' ) );
} }
$class .= ' preproduced' unless ( ( defined $event->{'live'} ) && ( $event->{'live'} eq '1' ) ); $class .= ' preproduced' unless ( ( defined $event->{'live'} ) && ( $event->{'live'} eq '1' ) );
@@ -772,6 +775,7 @@ sub showEventList {
$event->{user_title} ||= ''; $event->{user_title} ||= '';
$event->{episode} ||= ''; $event->{episode} ||= '';
$event->{rerun} ||= ''; $event->{rerun} ||= '';
$event->{draft} ||= '';
$id ||= ''; $id ||= '';
$class ||= ''; $class ||= '';
@@ -790,6 +794,11 @@ sub showEventList {
$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 );
my $draft = $event->{draft} || '0';
$draft='-' if $draft eq '0';
$draft='x' if $draft eq '1';
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 '';
@@ -804,6 +813,7 @@ sub showEventList {
. qq!<td class="title">$title</td>! . qq!<td class="title">$title</td>!
. qq!<td class="episode">$event->{episode}</td>! . qq!<td class="episode">$event->{episode}</td>!
. qq!<td class="rerun">$rerun</td>! . qq!<td class="rerun">$rerun</td>!
. qq!<td class="draft">$draft</td>!
. qq!<td class="live">$live</td>! . qq!<td class="live">$live</td>!
. qq!<td class="archived">$archived</td>! . qq!<td class="archived">$archived</td>!
. qq!</tr>! . "\n"; . qq!</tr>! . "\n";
@@ -1358,7 +1368,7 @@ sub print_event {
$class .= ' no_series' if ( ( $class eq 'event' ) && ( $event->{series_id} eq '-1' ) ); $class .= ' no_series' if ( ( $class eq 'event' ) && ( $event->{series_id} eq '-1' ) );
$class .= " error x$event->{error}" if defined $event->{error}; $class .= " error x$event->{error}" if defined $event->{error};
for my $filter ( 'rerun', 'archived', 'playout', 'published', 'live', 'disable_event_sync' ) { for my $filter ( 'rerun', 'archived', 'playout', 'published', 'live', 'disable_event_sync', 'draft' ) {
$class .= ' ' . $filter if ( ( defined $event->{$filter} ) && ( $event->{$filter} eq '1' ) ); $class .= ' ' . $filter if ( ( defined $event->{$filter} ) && ( $event->{$filter} eq '1' ) );
} }
$class .= ' preproduced' unless ( ( defined $event->{'live'} ) && ( $event->{'live'} eq '1' ) ); $class .= ' preproduced' unless ( ( defined $event->{'live'} ) && ( $event->{'live'} eq '1' ) );
@@ -1455,6 +1465,7 @@ sub find_errors {
next if defined $event->{grid}; next if defined $event->{grid};
next if defined $event->{work}; next if defined $event->{work};
next if defined $event->{play}; next if defined $event->{play};
next if (defined $event->{draft}) && ($event->{draft} == 1);
next unless defined $event->{ystart}; next unless defined $event->{ystart};
next unless defined $event->{yend}; next unless defined $event->{yend};
$event->{check_errors} = 1; $event->{check_errors} = 1;
@@ -1583,7 +1594,7 @@ sub printToolbar {
<select id="filter" name="filter" onchange="reloadCalendar()"> <select id="filter" name="filter" onchange="reloadCalendar()">
}; };
for my $filter ( 'no markup', 'conflicts', 'rerun', 'archived', 'playout', 'published', 'live', 'disable_event_sync' ) { for my $filter ( 'no markup', 'conflicts', 'rerun', 'archived', 'playout', 'published', 'live', 'disable_event_sync', 'draft' ) {
my $key = $filter; my $key = $filter;
$key =~ s/ /_/g; $key =~ s/ /_/g;
@@ -1733,6 +1744,7 @@ sub getSeriesEvents {
permissions => $request->{permissions} permissions => $request->{permissions}
}; };
$request2->{params}->{checked}->{published} = 'all'; $request2->{params}->{checked}->{published} = 'all';
$request2->{params}->{checked}->{draft} = '1' if $params->{list}==1;
delete $request2->{params}->{checked}->{exclude_locations} delete $request2->{params}->{checked}->{exclude_locations}
if ( ( $params->{studio_id} == -1 ) && ( defined $request2->{params}->{checked}->{exclude_locations} ) ); if ( ( $params->{studio_id} == -1 ) && ( defined $request2->{params}->{checked}->{exclude_locations} ) );

View File

@@ -166,6 +166,7 @@ sub show_event {
unless ( defined $event ) { unless ( defined $event ) {
uac::print_error("event not found"); uac::print_error("event not found");
} }
#print STDERR "show:".Dumper($event->{draft});
my $editLock = 1; my $editLock = 1;
if ( ( defined $permissions->{update_event_after_week} ) && ( $permissions->{update_event_after_week} eq '1' ) ) { if ( ( defined $permissions->{update_event_after_week} ) && ( $permissions->{update_event_after_week} eq '1' ) ) {
@@ -196,7 +197,8 @@ sub show_event {
#project_id => $params->{project_id}, #project_id => $params->{project_id},
#studio_id => $params->{studio_id}, #studio_id => $params->{studio_id},
#series_id => $params->{series_id}, #series_id => $params->{series_id},
event_id => $params->{source_event_id} event_id => $params->{source_event_id},
draft => 0,
} }
); );
if ( defined $event2 ) { if ( defined $event2 ) {
@@ -582,6 +584,7 @@ sub save_event {
studio_id => $params->{studio_id}, studio_id => $params->{studio_id},
series_id => $params->{series_id}, series_id => $params->{series_id},
event_id => $params->{event_id}, event_id => $params->{event_id},
draft => $params->{draft},
start => $start, start => $start,
end => $end, end => $end,
}; };
@@ -616,7 +619,7 @@ sub save_event {
} }
#status field #status field
for my $key ( 'live', 'published', 'playout', 'archived', 'rerun', 'disable_event_sync' ) { for my $key ( 'live', 'published', 'playout', 'archived', 'rerun', 'disable_event_sync', 'draft' ) {
next unless defined $permissions->{ 'update_event_status_' . $key }; next unless defined $permissions->{ 'update_event_status_' . $key };
if ( $permissions->{ 'update_event_status_' . $key } eq '1' ) { if ( $permissions->{ 'update_event_status_' . $key } eq '1' ) {
$entry->{$key} = $params->{$key} || 0; $entry->{$key} = $params->{$key} || 0;
@@ -717,8 +720,9 @@ sub create_event {
studio_id => $params->{studio_id}, studio_id => $params->{studio_id},
series_id => $params->{series_id}, series_id => $params->{series_id},
start_date => $params->{start_date}, start_date => $params->{start_date},
draft => $params->{draft},
start => $start, start => $start,
end => $end end => $end,
} }
); );
@@ -942,9 +946,10 @@ sub check_params {
} }
#checkboxes #checkboxes
for my $param ( 'live', 'published', 'playout', 'archived', 'rerun', 'disable_event_sync', 'get_rerun' ) { for my $param ( 'live', 'published', 'playout', 'archived', 'rerun', 'draft', 'disable_event_sync', 'get_rerun' ) {
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /([01])/ ) ) { if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /([01])/ ) ) {
$checked->{$param} = $1; $checked->{$param} = $1;
# print STDERR "check $param = $1\n";
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 B

View File

@@ -111,6 +111,8 @@ sub show_events {
studio_id => $params->{studio_id}, studio_id => $params->{studio_id},
from_date => time::time_to_date(), from_date => time::time_to_date(),
till_date => time::time_to_date( time() + $duration * 24 * 60 * 60 ), till_date => time::time_to_date( time() + $duration * 24 * 60 * 60 ),
draft => 0,
published => 1
}; };
my $events = series::get_events( $config, $options ); my $events = series::get_events( $config, $options );
@@ -158,6 +160,8 @@ sub sendMail {
studio_id => $params->{studio_id}, studio_id => $params->{studio_id},
series_id => $params->{series_id}, series_id => $params->{series_id},
event_id => $params->{event_id}, event_id => $params->{event_id},
draft => 0,
published => 0,
}; };
my $events = series::get_events( $config, $options ); my $events = series::get_events( $config, $options );

View File

@@ -69,6 +69,7 @@ print "Content-type:text/html; charset=UTF-8;\n\n";
return unless uac::check( $config, $params, $user_presets ) == 1; return unless uac::check( $config, $params, $user_presets ) == 1;
show_events( $config, $request ); show_events( $config, $request );
#TODO: filter by published, draft
sub show_events { sub show_events {
my $config = shift; my $config = shift;
my $request = shift; my $request = shift;