add playout section
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
-- MySQL dump 10.13 Distrib 5.5.55, for debian-linux-gnu (x86_64)
|
||||
-- MySQL dump 10.13 Distrib 5.7.20, for Linux (x86_64)
|
||||
--
|
||||
-- Host: localhost Database: calcms
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 5.5.55-0ubuntu0.14.04.1
|
||||
-- Server version 5.7.20-0ubuntu0.16.04.1
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
@@ -29,9 +29,15 @@ CREATE TABLE `calcms_audio_recordings` (
|
||||
`event_id` int(11) NOT NULL,
|
||||
`created_by` varchar(100) NOT NULL,
|
||||
`path` varchar(300) NOT NULL,
|
||||
`md5` varchar(100) NOT NULL,
|
||||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`size` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
`audioDuration` float DEFAULT '0',
|
||||
`eventDuration` int(11) DEFAULT '0',
|
||||
`rmsLeft` float DEFAULT NULL,
|
||||
`rmsRight` float DEFAULT NULL,
|
||||
`mastered` tinyint(1) DEFAULT '0',
|
||||
`processed` tinyint(1) DEFAULT '0',
|
||||
`modified_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `project_index` (`project_id`),
|
||||
KEY `studio_index` (`studio_id`),
|
||||
@@ -384,14 +390,17 @@ CREATE TABLE `calcms_playout` (
|
||||
`rms_left` float DEFAULT NULL,
|
||||
`rms_right` float DEFAULT NULL,
|
||||
`rms_image` varchar(300) DEFAULT NULL,
|
||||
`relpay_gain` float DEFAULT NULL,
|
||||
`replay_gain` float DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT CURRENT_TIMESTAMP,
|
||||
`modified_at` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`project_id`,`studio_id`,`start`),
|
||||
KEY `project_id` (`project_id`),
|
||||
KEY `studio_id` (`studio_id`),
|
||||
KEY `start` (`start`),
|
||||
KEY `end` (`end`),
|
||||
KEY `start_date` (`start_date`),
|
||||
KEY `end_date` (`end_date`)
|
||||
KEY `end_date` (`end_date`),
|
||||
KEY `modified_at` (`modified_at`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
@@ -576,6 +585,7 @@ CREATE TABLE `calcms_roles` (
|
||||
`update_comment_status_read` tinyint(1) unsigned NOT NULL,
|
||||
`upload_audio_recordings` tinyint(1) unsigned NOT NULL,
|
||||
`delete_audio_recordings` tinyint(1) unsigned NOT NULL,
|
||||
`read_playout` tinyint(1) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `role_2` (`role`),
|
||||
KEY `studio_id` (`studio_id`),
|
||||
@@ -590,8 +600,7 @@ CREATE TABLE `calcms_roles` (
|
||||
|
||||
LOCK TABLES `calcms_roles` WRITE;
|
||||
/*!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','2016-05-16 13:53:46',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);/*!40000 ALTER TABLE `calcms_roles` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
@@ -696,7 +705,8 @@ CREATE TABLE `calcms_series_events` (
|
||||
KEY `event_id` (`event_id`),
|
||||
KEY `studio_id` (`studio_id`),
|
||||
KEY `project_id` (`project_id`),
|
||||
KEY `manual` (`manual`)
|
||||
KEY `manual` (`manual`),
|
||||
KEY `pse` (`project_id`,`studio_id`,`event_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
@@ -730,8 +740,8 @@ CREATE TABLE `calcms_series_schedule` (
|
||||
`period_type` varchar(16) DEFAULT NULL,
|
||||
`month` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`project_id` int(10) unsigned NOT NULL DEFAULT '1',
|
||||
`start_offset` int(11) NOT NULL DEFAULT '0',
|
||||
`nextDay` int(11) NOT NULL DEFAULT '0',
|
||||
`start_offset` int(11) DEFAULT '0',
|
||||
`nextDay` int(11) DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `series_id` (`series_id`),
|
||||
KEY `studio_id` (`studio_id`),
|
||||
@@ -1165,4 +1175,4 @@ UNLOCK TABLES;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2017-04-29 13:34:58
|
||||
-- Dump completed on 2018-01-14 17:23:51
|
||||
|
||||
@@ -16,8 +16,9 @@ our %EXPORT_TAGS = ( 'all' => [ @EXPORT_OK ] );
|
||||
|
||||
# columns:
|
||||
# id, project_id, studio_id, event_id
|
||||
# created_by, created_at
|
||||
# path, md5
|
||||
# path, size, created_by, created_at
|
||||
# mastered, processed
|
||||
# audioDuration, eventDuration, rmsLeft, rmsRight
|
||||
|
||||
sub debug;
|
||||
|
||||
@@ -88,16 +89,22 @@ sub get{
|
||||
,studio_id
|
||||
,event_id
|
||||
,path
|
||||
,md5
|
||||
,size
|
||||
,created_by
|
||||
,created_at
|
||||
,modified_at
|
||||
,mastered
|
||||
,processed
|
||||
,audioDuration
|
||||
,eventDuration
|
||||
,rmsLeft
|
||||
,rmsRight
|
||||
from calcms_audio_recordings
|
||||
$whereClause
|
||||
order by created_at desc
|
||||
};
|
||||
|
||||
print STDERR Dumper($query).Dumper($bind_values);
|
||||
#print STDERR Dumper($query).Dumper($bind_values);
|
||||
my $entries=db::get($dbh, $query, $bind_values);
|
||||
return $entries;
|
||||
}
|
||||
@@ -109,21 +116,31 @@ sub update{
|
||||
my $dbh = shift;
|
||||
my $entry = shift;
|
||||
|
||||
print STDERR "update:".Dumper($entry);
|
||||
#print STDERR "update:".Dumper($entry);
|
||||
|
||||
my $day_start=$config->{date}->{day_starting_hour};
|
||||
|
||||
my $bind_values=[
|
||||
$entry->{path}, $entry->{md5}, $entry->{size}, $entry->{created_by}, $entry->{created_at},
|
||||
$entry->{path}, $entry->{size},
|
||||
$entry->{created_by}, $entry->{created_at},
|
||||
$entry->{modified_at} || time::time_to_datetime(time()),
|
||||
$entry->{processed}, $entry->{mastered},
|
||||
$entry->{eventDuration}, $entry->{audioDuration},
|
||||
$entry->{rmsLeft}, $entry->{rmsRight},
|
||||
$entry->{project_id}, $entry->{studio_id}, $entry->{event_id}
|
||||
];
|
||||
|
||||
my $query=qq{
|
||||
update calcms_audio_recordings
|
||||
set path=?, md5=?, size=?, created_by=?, created_at=?
|
||||
set path=?, size=?,
|
||||
created_by=?, created_at=?,
|
||||
modified_at=?,
|
||||
processed=?, mastered=?,
|
||||
eventDuration=?, audioDuration=?,
|
||||
rmsLeft=?, rmsRight=?
|
||||
where project_id=? and studio_id=? and event_id=?
|
||||
};
|
||||
print STDERR Dumper($query).Dumper($bind_values);
|
||||
#print STDERR Dumper($query).Dumper($bind_values);
|
||||
return db::put($dbh, $query, $bind_values);
|
||||
}
|
||||
|
||||
@@ -138,15 +155,20 @@ sub insert{
|
||||
return undef unless defined $entry->{event_id};
|
||||
return undef unless defined $entry->{path};
|
||||
|
||||
print STDERR "insert into audio_recordings:".Dumper($entry);
|
||||
#print STDERR "insert into audio_recordings:".Dumper($entry);
|
||||
return db::insert($dbh, 'calcms_audio_recordings', {
|
||||
project_id => $entry->{project_id},
|
||||
studio_id => $entry->{studio_id},
|
||||
event_id => $entry->{event_id},
|
||||
path => $entry->{path},
|
||||
size => $entry->{size},
|
||||
md5 => $entry->{md5},
|
||||
created_by => $entry->{created_by},
|
||||
eventDuration => $entry->{eventDuration},
|
||||
audioDuration => $entry->{audioDuration},
|
||||
rmsLeft => $entry->{rmsLeft},
|
||||
rmsRight => $entry->{rmsRight},
|
||||
processed => $entry->{processed},
|
||||
mastered => $entry->{mastered} || '0',
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -18,8 +18,22 @@ use studios;
|
||||
|
||||
require Exporter;
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT_OK =
|
||||
qw(init get_cached_or_render get modify_results get_query render get_running_event_id delete check_params configure_cache get_duration calc_dates get_keys add_recordings);
|
||||
our @EXPORT_OK = qw(
|
||||
init
|
||||
get_cached_or_render
|
||||
get
|
||||
modify_results
|
||||
get_query
|
||||
render
|
||||
get_running_event_id
|
||||
delete
|
||||
check_params
|
||||
configure_cache
|
||||
get_duration
|
||||
calc_dates
|
||||
get_keys
|
||||
add_recordings
|
||||
);
|
||||
our %EXPORT_TAGS = ( 'all' => [@EXPORT_OK] );
|
||||
|
||||
sub init {
|
||||
@@ -1050,7 +1064,7 @@ sub get_query {
|
||||
$query .= ', ar.path';
|
||||
$query .= ', ar.size';
|
||||
$query .= ', ar.created_by uploaded_by';
|
||||
$query .= ', ar.created_at uploaded_at';
|
||||
$query .= ', ar.modified_at uploaded_at';
|
||||
#push @$where_cond, 'e.id=ar.event_id';
|
||||
}
|
||||
|
||||
@@ -1457,9 +1471,12 @@ sub get_duration {
|
||||
my $timezone = $config->{date}->{time_zone};
|
||||
my $start = time::get_datetime( $event->{start}, $timezone );
|
||||
my $end = time::get_datetime( $event->{end}, $timezone );
|
||||
#my $seconds = $end->subtract($start)->in_units("minutes");
|
||||
#return $seconds;
|
||||
return undef unless defined $start;
|
||||
return undef unless defined $end;
|
||||
my $duration = $end->epoch() - $start->epoch();
|
||||
#print STDERR "duration=$duration, end=".$end->datetime()." start=".$start->datetime()."\n";
|
||||
return $duration / 60;
|
||||
}
|
||||
|
||||
|
||||
@@ -86,6 +86,9 @@ sub get{
|
||||
my $conditions='';
|
||||
$conditions=" where ".join(" and ",@conditions) if (@conditions>0);
|
||||
|
||||
my $order='start';
|
||||
$order=$condition->{order} if (defined $condition->{order} ) && ($condition->{order} ne'');
|
||||
|
||||
my $query=qq{
|
||||
select date(start) start_date
|
||||
,date(end) end_date
|
||||
@@ -111,9 +114,12 @@ sub get{
|
||||
,rms_left
|
||||
,rms_right
|
||||
,rms_image
|
||||
,modified_at
|
||||
,updated_at
|
||||
from calcms_playout
|
||||
$conditions
|
||||
order by start
|
||||
order by $order
|
||||
$limit
|
||||
};
|
||||
|
||||
#print STDERR Dumper($query).Dumper(\@bind_values);
|
||||
@@ -128,7 +134,7 @@ sub sync{
|
||||
my $options=shift;
|
||||
|
||||
#print STDERR Dumper($config);
|
||||
#print STDERR Dumper($options);
|
||||
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} ;
|
||||
@@ -227,7 +233,7 @@ sub has_changed{
|
||||
my $newEntry=shift;
|
||||
|
||||
my $update=0;
|
||||
for my $key ('duration', 'errors', 'file', 'channels', 'format', 'format_version', 'format_profile', 'format_settings', 'stream_size', 'bitrate', 'bitrate_mode', 'sampling_rate', 'writing_library'){
|
||||
for my $key ('duration', 'errors', 'file', 'channels', 'format', 'format_version', 'format_profile', 'format_settings', 'stream_size', 'bitrate', 'bitrate_mode', 'sampling_rate', 'writing_library', 'modified_at'){
|
||||
return 1 if ($oldEntry->{$key}||'') ne ($newEntry->{$key}||'');
|
||||
}
|
||||
return 0;
|
||||
@@ -242,7 +248,7 @@ sub update{
|
||||
|
||||
return if has_changed($oldEntry, $newEntry)==0;
|
||||
|
||||
for my $key ('duration', 'errors', 'file', 'channels', 'format', 'format_version', 'format_profile', 'format_settings', 'stream_size', 'bitrate', 'bitrate_mode', 'sampling_rate', 'writing_library', 'rms_left', 'rms_right', 'rms_image', 'replay_gain'){
|
||||
for my $key ('duration', 'errors', 'file', 'channels', 'format', 'format_version', 'format_profile', 'format_settings', 'stream_size', 'bitrate', 'bitrate_mode', 'sampling_rate', 'writing_library', 'rms_left', 'rms_right', 'rms_image', 'replay_gain', 'modified_at'){
|
||||
if (($oldEntry->{$key}||'') ne ($newEntry->{$key}||'')){
|
||||
$oldEntry->{$key}=$newEntry->{$key};
|
||||
}
|
||||
@@ -262,7 +268,7 @@ sub update{
|
||||
$entry->{channels}, $entry->{'format'}, $entry->{format_version}, $entry->{format_profile}, $entry->{format_settings}, $entry->{stream_size},
|
||||
$entry->{bitrate}, $entry->{bitrate_mode}, $entry->{sampling_rate}, $entry->{writing_library},
|
||||
$entry->{rms_left}, $entry->{rms_right}, $entry->{rms_image},
|
||||
$entry->{replay_gain},
|
||||
$entry->{replay_gain}, $entry->{modified_at},
|
||||
$entry->{project_id}, $entry->{studio_id}, $entry->{start}
|
||||
];
|
||||
my $query=qq{
|
||||
@@ -272,7 +278,7 @@ sub update{
|
||||
channels=?, format=?, format_version=?, format_profile=?, format_settings=?, stream_size=?,
|
||||
bitrate=?, bitrate_mode=?, sampling_rate=?, writing_library=?,
|
||||
rms_left=?, rms_right=?, rms_image=?,
|
||||
replay_gain=?
|
||||
replay_gain=?, modified_at=?
|
||||
where project_id=? and studio_id=? and start=?
|
||||
};
|
||||
return db::put($dbh, $query, $bind_values);
|
||||
@@ -318,7 +324,8 @@ sub insert{
|
||||
bitrate => $entry->{bitrate},
|
||||
bitrate_mode => $entry->{bitrate_mode},
|
||||
sampling_rate => $entry->{sampling_rate},
|
||||
writing_library => $entry->{writing_library}
|
||||
writing_library => $entry->{writing_library},
|
||||
modified_at => $entry->{modified_at}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ $comment->{content}=~s/(^|\s)((www\.)(.*?))(\s|$|\<)/$1\<a href\=\"http\:\/\/$2\
|
||||
|
||||
if (comments::check($dbh, $config, $comment)){
|
||||
my $nslookup=nslookup();
|
||||
|
||||
#if (is_blocked($nslookup)==1){
|
||||
# send_mail($comment, $nslookup, 'blocked');
|
||||
# return;
|
||||
@@ -68,21 +69,18 @@ if (comments::check($dbh, $config, $comment)){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub is_blocked{
|
||||
my $nslookup=shift;
|
||||
|
||||
my $user_agent=$ENV{HTTP_USER_AGENT};
|
||||
|
||||
my $block=0;
|
||||
$block=1 if (
|
||||
($user_agent eq 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:35.0) Gecko/20100101 Firefox/35.0')
|
||||
&& ($nslookup=~/alicedsl/)
|
||||
);
|
||||
$block = 1
|
||||
if ( ( $user_agent eq 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:35.0) Gecko/20100101 Firefox/35.0' )
|
||||
&& ( $nslookup =~ /alicedsl/ ) );
|
||||
return $block;
|
||||
}
|
||||
|
||||
|
||||
sub send_mail{
|
||||
my $comment = shift;
|
||||
my $nslookup = shift;
|
||||
@@ -227,13 +225,15 @@ sub check_params{
|
||||
my $today=time::datetime_to_array(time::time_to_datetime());
|
||||
my $date =time::datetime_to_array($comment->{event_start});
|
||||
my $delta_days=time::days_between($today,$date);
|
||||
log::error($config, 'add_comment.cgi: no comments allowed, yet') if ($delta_days > $config->{permissions}->{no_new_comments_before} );
|
||||
log::error($config, 'add_comment.cgi: no comments allowed anymore') if ($delta_days < -1*$config->{permissions}->{no_new_comments_after} );
|
||||
log::error( $config, 'add_comment.cgi: no comments allowed, yet' )
|
||||
if ( $delta_days > $config->{permissions}->{no_new_comments_before} );
|
||||
log::error( $config, 'add_comment.cgi: no comments allowed anymore' )
|
||||
if ( $delta_days < -1 * $config->{permissions}->{no_new_comments_after} );
|
||||
|
||||
return {
|
||||
template =>$template,
|
||||
comment =>$comment
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
sub escape_text{
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
|
||||
use warnings "all";
|
||||
use strict;
|
||||
|
||||
#use Data::Dumper;
|
||||
|
||||
#use DBI;
|
||||
use CGI qw(header param Vars);
|
||||
|
||||
#use Time::Local qw(timelocal);
|
||||
#use Benchmark;
|
||||
#use Devel::Profiler;
|
||||
@@ -28,6 +30,7 @@ if ($0=~/aggregate.*?\.cgi$/){
|
||||
my $cgi = new CGI();
|
||||
my %params = $cgi->Vars();
|
||||
my $params = \%params;
|
||||
|
||||
#print STDERR Dumper($params);
|
||||
|
||||
my $config = config::get('config/config.cgi');
|
||||
@@ -39,7 +42,8 @@ if ($0=~/aggregate.*?\.cgi$/){
|
||||
my $output_header = '';
|
||||
if ( exists $ENV{REQUEST_URI} && $ENV{REQUEST_URI} ne '' ) {
|
||||
$output_header .= "Content-type:text/html; charset=UTF-8;\n\n";
|
||||
};
|
||||
}
|
||||
|
||||
# $output_header.='<!DOCTYPE html>'."\n";
|
||||
|
||||
my $request = {
|
||||
@@ -69,6 +73,7 @@ if ($0=~/aggregate.*?\.cgi$/){
|
||||
|
||||
#replace HTML escaped calcms_title span by unescaped one
|
||||
$content =~ s/\<\;span id\="\;calcms_title"\;\>\;[^\&]*\<\;\/span\>\;/\<span id=\"calcms_title\" \>\<\/span\>/g;
|
||||
|
||||
# print $content;
|
||||
|
||||
my $list = aggregator::get_list( $config, $request );
|
||||
@@ -128,6 +133,7 @@ if ($0=~/aggregate.*?\.cgi$/){
|
||||
$title = ' | ' . $title if ( $title ne '' );
|
||||
$title .= 'Programmplan';
|
||||
$title .= ' | ' . $list->{project_title} if $list->{project_title} ne '';
|
||||
|
||||
#$content=~s/(<title>)(.*?)(<\/title>)/$1$title$3/;
|
||||
|
||||
$js = '';
|
||||
@@ -145,6 +151,7 @@ if ($0=~/aggregate.*?\.cgi$/){
|
||||
|
||||
print $output_header;
|
||||
print $content;
|
||||
|
||||
# $r->print("done");
|
||||
|
||||
if ( $config->{cache}->{use_cache} eq '1' ) {
|
||||
@@ -152,6 +159,7 @@ if ($0=~/aggregate.*?\.cgi$/){
|
||||
log::write( $config, 'cache_file', $cache->{filename} ) if ($debug);
|
||||
cache::save($cache);
|
||||
}
|
||||
|
||||
# $config=undef;
|
||||
$content = undef;
|
||||
$cache = undef;
|
||||
@@ -167,4 +175,3 @@ sub load_file{
|
||||
return \$content;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -45,13 +45,14 @@ if ($config->{cache}->{use_cache} eq '1'){
|
||||
if ( defined $cache->{content} ) {
|
||||
print $cache->{content};
|
||||
return;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
my $dbh = db::connect($config);
|
||||
|
||||
my $template_parameters = {};
|
||||
$template_parameters->{projects} = getProjects( $dbh, $config );
|
||||
|
||||
#$template_parameters->{categories} = get_categories($dbh,$params->{project});
|
||||
$template_parameters->{debug} = $config->{system}->{debug};
|
||||
$template_parameters->{server_cache} = $config->{cache}->{server_cache} if ( $config->{cache}->{server_cache} );
|
||||
@@ -140,6 +141,6 @@ sub check_params{
|
||||
return {
|
||||
template => $template,
|
||||
debug => $debug
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/*
|
||||
|
||||
wordpress calendar : jero edition
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="http://www.funkwelle.org/wp-content/uploads/kalender_css/cal.css" />
|
||||
*/
|
||||
|
||||
|
||||
@@ -4,11 +4,15 @@ include in your web page:
|
||||
*/
|
||||
|
||||
/* fix drupal */
|
||||
|
||||
input{
|
||||
max-width:20em;
|
||||
}
|
||||
|
||||
a{
|
||||
text-decoration:none;
|
||||
box-shadow:none !important;
|
||||
}
|
||||
|
||||
/* hide microformats */
|
||||
.vevent .dtstart,
|
||||
.vevent .dtend,
|
||||
@@ -25,7 +29,6 @@ input{
|
||||
|
||||
|
||||
/* menu */
|
||||
|
||||
#calcms_menu{
|
||||
clear:both;
|
||||
text-align:left;
|
||||
@@ -92,6 +95,8 @@ input{
|
||||
}
|
||||
|
||||
#calcms_playlist img{
|
||||
width:25px;
|
||||
height:25px;
|
||||
border:1px solid #ccc;
|
||||
}
|
||||
|
||||
@@ -139,8 +144,10 @@ input{
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
#calcms_list .event.running{
|
||||
color:#000;
|
||||
#calcms_list .event.running,
|
||||
#calcms_list .event.running a{
|
||||
color:#fff;
|
||||
background:#aaa;
|
||||
}
|
||||
|
||||
#calcms_list .comments.submitted{
|
||||
@@ -153,6 +160,7 @@ input{
|
||||
|
||||
#calcms_list .title{
|
||||
margin-bottom:1em;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
#calcms_list .content img{
|
||||
@@ -165,14 +173,16 @@ input{
|
||||
}
|
||||
|
||||
#calcms_list .event{
|
||||
padding:1em;
|
||||
padding-top:0.5em;
|
||||
padding-bottom:0.5em;
|
||||
margin:1em;
|
||||
margin-left:0;
|
||||
background:#eee;
|
||||
padding:1rem;
|
||||
padding-right:0.5rem;
|
||||
border-bottom:1rem solid #fff;
|
||||
hyphens: none;
|
||||
cursor:pointer;
|
||||
background:#eee;
|
||||
color:#666;
|
||||
max-height:8rem;
|
||||
overflow:hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
|
||||
@@ -192,6 +202,19 @@ input{
|
||||
|
||||
#icon_bar a {
|
||||
padding:1em;
|
||||
float:left;
|
||||
}
|
||||
|
||||
/* slider */
|
||||
#coming_shows{
|
||||
white-space:nowrap;
|
||||
height:120px;
|
||||
}
|
||||
|
||||
#calcms_list #playlist_container{
|
||||
overflow:hidden;
|
||||
height:120px;
|
||||
padding:10px;
|
||||
}
|
||||
|
||||
#calcms_list #playlist_container .event{
|
||||
@@ -209,6 +232,67 @@ input{
|
||||
box-sizing:border-box;
|
||||
}
|
||||
|
||||
#playlist_container .event div.bottom{
|
||||
max-height:70px;
|
||||
font-size:12px;
|
||||
padding:6px;
|
||||
white-space:wrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
#coming_shows .eventContainer {
|
||||
display:inline-block;
|
||||
vertical-align:top;
|
||||
text-align:center;
|
||||
cursor:pointer;
|
||||
width:100px;
|
||||
height:100px;
|
||||
}
|
||||
#coming_shows .eventContainer:hover {
|
||||
background:#eeeeee;
|
||||
}
|
||||
#coming_shows a:hover {
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
#coming_shows div.event{
|
||||
position:relative;
|
||||
width:100px;
|
||||
height:100px;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center center;
|
||||
background-size: cover;
|
||||
}
|
||||
#coming_shows div.event .top,
|
||||
#coming_shows div.event .bottom{
|
||||
position:absolute;
|
||||
background:#222;
|
||||
color:#fff;
|
||||
opacity:0.8;
|
||||
width:100%;
|
||||
}
|
||||
#coming_shows div.event .top:hover,
|
||||
#coming_shows div.event .bottom:hover{
|
||||
opacity:1;
|
||||
}
|
||||
|
||||
#coming_shows div.event .top{
|
||||
top:0;
|
||||
}
|
||||
|
||||
#coming_shows div.event .bottom{
|
||||
bottom:0;
|
||||
}
|
||||
|
||||
#coming_shows div.event{
|
||||
transition: all .2s ease-in-out;
|
||||
}
|
||||
|
||||
#coming_shows div.event:hover{
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
|
||||
/* calcms comments */
|
||||
#calcms_comments{
|
||||
clear:both;
|
||||
@@ -461,6 +545,7 @@ a#calcms_search_show_details #plus{
|
||||
text-align:center;
|
||||
font-weight:normal;
|
||||
border-bottom:1px solid #ddd;
|
||||
transition: all .1s ease-in-out;
|
||||
}
|
||||
|
||||
#calcms_calendar table thead td:hover,
|
||||
@@ -474,11 +559,6 @@ a#calcms_search_show_details #plus{
|
||||
font-size:large;
|
||||
}
|
||||
|
||||
#calcms_calendar table th,
|
||||
#calcms_calendar table td{
|
||||
transition: all .1s ease-in-out;
|
||||
}
|
||||
|
||||
/* month selector */
|
||||
#calcms_calendar table thead tr:first-child a{
|
||||
padding:6px;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#! /usr/bin/perl -w
|
||||
|
||||
use warnings "all";
|
||||
|
||||
#no warnings 'redefine';
|
||||
#use diagnostics;
|
||||
use strict;
|
||||
@@ -25,6 +26,7 @@ my $r=shift;
|
||||
( my $cgi, my $params, my $error ) = params::get($r);
|
||||
|
||||
if ( $0 =~ /events.*?\.cgi$/ ) {
|
||||
|
||||
#my $cgi=new CGI();
|
||||
#my %params=$cgi->Vars();
|
||||
our $config = config::get('config/config.cgi');
|
||||
@@ -37,6 +39,7 @@ if ($0=~/events.*?\.cgi$/){
|
||||
checked => events::check_params( $config, $params ),
|
||||
},
|
||||
};
|
||||
|
||||
#events::init($request);
|
||||
log::init($request);
|
||||
|
||||
|
||||
28
website/agenda/planung/assign_series.cgi
Normal file → Executable file
28
website/agenda/planung/assign_series.cgi
Normal file → Executable file
@@ -34,14 +34,20 @@ my ($user,$expires) = auth::get_user($cgi, $config);
|
||||
return if ( ( !defined $user ) || ( $user eq '' ) );
|
||||
|
||||
#print STDERR $params->{project_id}."\n";
|
||||
my $user_presets=uac::get_user_presets($config, {
|
||||
my $user_presets = uac::get_user_presets(
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
user => $user
|
||||
});
|
||||
}
|
||||
);
|
||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||
$params->{studio_id} = $params->{default_studio_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{project_id} = $user_presets->{project_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{studio_id} = $params->{default_studio_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
$params->{project_id} = $user_presets->{project_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
|
||||
#print STDERR $params->{project_id}."\n";
|
||||
my $request = {
|
||||
url => $ENV{QUERY_STRING} || '',
|
||||
@@ -140,7 +146,6 @@ sub show_events{
|
||||
template::process( 'print', $params->{template}, $params );
|
||||
}
|
||||
|
||||
|
||||
sub assign_series {
|
||||
my $config = shift;
|
||||
my $request = shift;
|
||||
@@ -166,25 +171,32 @@ sub assign_series{
|
||||
|
||||
#check if series is assigned to project/studio
|
||||
my $series = series::get(
|
||||
$config,{
|
||||
$config,
|
||||
{
|
||||
project_id => $entry->{project_id},
|
||||
studio_id => $entry->{studio_id},
|
||||
series_id => $entry->{series_id},
|
||||
}
|
||||
);
|
||||
|
||||
#print Dumper($series);
|
||||
if ( @$series == 0 ) {
|
||||
|
||||
# assign series to project/studio
|
||||
project::assign_series(
|
||||
$config,{
|
||||
$config,
|
||||
{
|
||||
project_id => $entry->{project_id},
|
||||
studio_id => $entry->{studio_id},
|
||||
series_id => $entry->{series_id},
|
||||
}
|
||||
);
|
||||
|
||||
#print "assign\n";
|
||||
} else {
|
||||
print STDERR "event $entry->{event_id} already assigned to project $entry->{project_id}, studio $entry->{studio_id}, series $entry->{series_id}\n";
|
||||
print STDERR
|
||||
"event $entry->{event_id} already assigned to project $entry->{project_id}, studio $entry->{studio_id}, series $entry->{series_id}\n";
|
||||
|
||||
#print "is schon\n";
|
||||
}
|
||||
|
||||
|
||||
50
website/agenda/planung/assignments.cgi
Normal file → Executable file
50
website/agenda/planung/assignments.cgi
Normal file → Executable file
@@ -34,14 +34,20 @@ my ($user,$expires) = auth::get_user($cgi, $config);
|
||||
return if ( ( !defined $user ) || ( $user eq '' ) );
|
||||
|
||||
#print STDERR $params->{project_id}."\n";
|
||||
my $user_presets=uac::get_user_presets($config, {
|
||||
my $user_presets = uac::get_user_presets(
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
user => $user
|
||||
});
|
||||
}
|
||||
);
|
||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||
$params->{studio_id} = $params->{default_studio_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{project_id} = $user_presets->{project_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{studio_id} = $params->{default_studio_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
$params->{project_id} = $user_presets->{project_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
|
||||
#print STDERR $params->{project_id}."\n";
|
||||
my $request = {
|
||||
url => $ENV{QUERY_STRING} || '',
|
||||
@@ -92,11 +98,13 @@ sub show_events{
|
||||
|
||||
my $projects = project::get( $config, { project_id => $params->{project_id} } );
|
||||
my $project = $projects->[0];
|
||||
|
||||
#print STDERR Dumper($project);
|
||||
return unless ( @$projects == 1 );
|
||||
|
||||
my $studios = studios::get( $config, { project_id => $params->{project_id}, studio_id => $params->{studio_id} } );
|
||||
my $studio = $studios->[0];
|
||||
|
||||
#print STDERR Dumper($studio);
|
||||
return unless ( @$studios == 1 );
|
||||
|
||||
@@ -157,6 +165,7 @@ sub show_events{
|
||||
};
|
||||
print '<pre>' . Dumper($query) . Dumper($bind_values) . '</pre>';
|
||||
$results = db::get( $dbh, $query, $bind_values );
|
||||
|
||||
# detect title and episode
|
||||
for my $result (@$results) {
|
||||
$result->{rerun} .= '';
|
||||
@@ -167,10 +176,12 @@ sub show_events{
|
||||
$result->{title} =~ s/\s+$//;
|
||||
}
|
||||
my $a = time::datetime_to_array( $result->{start} );
|
||||
|
||||
#print STDERR "($a->[0],$a->[1],$a->[2])\n";
|
||||
$result->{weekday} = time::weekday( $a->[0], $a->[1], $a->[2] );
|
||||
$result->{weekday} = $time::names->{de}->{weekdays_abbr}->[ $result->{weekday} - 1 ];
|
||||
}
|
||||
|
||||
#fill template
|
||||
$params->{unassigned_events} = $results;
|
||||
$params->{sum_events} = @$results;
|
||||
@@ -180,7 +191,6 @@ sub show_events{
|
||||
template::process( 'print', $params->{template}, $params );
|
||||
}
|
||||
|
||||
|
||||
sub assign_events {
|
||||
my $config = shift;
|
||||
my $request = shift;
|
||||
@@ -210,7 +220,8 @@ sub assign_events{
|
||||
#get and parse event
|
||||
my $request2 = {
|
||||
params => {
|
||||
checked=>events::check_params($config,
|
||||
checked => events::check_params(
|
||||
$config,
|
||||
{
|
||||
event_id => $entry->{event_id},
|
||||
template => 'no',
|
||||
@@ -227,35 +238,43 @@ sub assign_events{
|
||||
my $events = events::get( $config, $request2 );
|
||||
my $event = $events->[0];
|
||||
unless ( defined $event ) {
|
||||
print STDERR "event not found for project $entry->{project_id}, studio $entry->{studio_id}, series $entry->{series_id}, event $entry->{event_id}\n";
|
||||
print STDERR
|
||||
"event not found for project $entry->{project_id}, studio $entry->{studio_id}, series $entry->{series_id}, event $entry->{event_id}\n";
|
||||
next;
|
||||
}
|
||||
print STDERR "'" . $event->{event_id} . "' '" . $event->{series_name} . "' '" . $event->{title} . "' '" . $event->{episode} . "'\n";
|
||||
|
||||
#next;
|
||||
|
||||
#check if series is assigned to project/studio
|
||||
my $series = series::get(
|
||||
$config,{
|
||||
$config,
|
||||
{
|
||||
project_id => $entry->{project_id},
|
||||
studio_id => $entry->{studio_id},
|
||||
series_id => $entry->{series_id},
|
||||
}
|
||||
);
|
||||
if ( @$series == 0 ) {
|
||||
|
||||
# assign series to project/studio
|
||||
project::assign_series(
|
||||
$config,{
|
||||
$config,
|
||||
{
|
||||
project_id => $entry->{project_id},
|
||||
studio_id => $entry->{studio_id},
|
||||
series_id => $entry->{series_id},
|
||||
}
|
||||
);
|
||||
} else {
|
||||
print STDERR "event $entry->{event_id} already asigned to project $entry->{project_id}, studio $entry->{studio_id}, series $entry->{series_id}\n";
|
||||
print STDERR
|
||||
"event $entry->{event_id} already asigned to project $entry->{project_id}, studio $entry->{studio_id}, series $entry->{series_id}\n";
|
||||
}
|
||||
|
||||
#get series
|
||||
$series = series::get(
|
||||
$config,{
|
||||
$config,
|
||||
{
|
||||
project_id => $entry->{project_id},
|
||||
studio_id => $entry->{studio_id},
|
||||
series_id => $entry->{series_id},
|
||||
@@ -267,6 +286,7 @@ sub assign_events{
|
||||
#set event's series name to value from series
|
||||
my $series_name = $serie->{series_name} || '';
|
||||
if ( $series_name ne '' ) {
|
||||
|
||||
# prepend series_name from event to title on adding to single_events series
|
||||
my $title = $event->{title};
|
||||
if ( $serie->{has_single_events} eq '1' ) {
|
||||
@@ -275,7 +295,8 @@ sub assign_events{
|
||||
|
||||
# save event content
|
||||
series_events::save_content(
|
||||
$config, {
|
||||
$config,
|
||||
{
|
||||
studio_id => $entry->{studio_id},
|
||||
id => $entry->{event_id}, #TODO: id=> event_id
|
||||
series_name => $series_name,
|
||||
@@ -305,7 +326,8 @@ sub assign_events{
|
||||
|
||||
#assign event
|
||||
my $result = series::assign_event(
|
||||
$config, {
|
||||
$config,
|
||||
{
|
||||
project_id => $entry->{project_id},
|
||||
studio_id => $entry->{studio_id},
|
||||
series_id => $entry->{series_id},
|
||||
@@ -321,6 +343,7 @@ sub assign_events{
|
||||
|
||||
$config->{access}->{write} = 0;
|
||||
uac::print_info("event successfully assigned to series");
|
||||
|
||||
#$params->{getBack}=1;
|
||||
}
|
||||
|
||||
@@ -366,6 +389,7 @@ sub check_params{
|
||||
$checked->{template} = template::check( $params->{template}, 'assignments' );
|
||||
|
||||
if ( ( defined $checked->{action} ) && ( $checked->{action} eq 'save_schedule' ) ) {
|
||||
|
||||
#set defaults
|
||||
$checked->{create_events} = 0;
|
||||
$checked->{publish_events} = 0;
|
||||
|
||||
196
website/agenda/planung/audio_recordings.cgi
Normal file → Executable file
196
website/agenda/planung/audio_recordings.cgi
Normal file → Executable file
@@ -7,28 +7,12 @@ use strict;
|
||||
|
||||
use Data::Dumper;
|
||||
|
||||
#use CGI;
|
||||
use CGI::Simple ();
|
||||
|
||||
use ModPerl::Util ();
|
||||
#use Apache2::Request;
|
||||
#use Apache2::Upload;
|
||||
#use Apache2::Reload;
|
||||
#use Apache2::RequestRec ();
|
||||
#use Apache2::RequestIO ();
|
||||
#use Apache2::RequestUtil ();
|
||||
#use Apache2::ServerRec ();
|
||||
#use Apache2::ServerUtil ();
|
||||
#use Apache2::Connection ();
|
||||
#use Apache2::Log ();
|
||||
#use APR::Table ();
|
||||
#use ModPerl::Registry ();
|
||||
|
||||
use Date::Calc;
|
||||
use Time::Local;
|
||||
use File::Temp;
|
||||
#use File::Copy;
|
||||
#use Digest::MD5::File;
|
||||
|
||||
use config;
|
||||
use log;
|
||||
@@ -39,10 +23,11 @@ use studios;
|
||||
use series;
|
||||
use template;
|
||||
use audio_recordings;
|
||||
use events;
|
||||
use time;
|
||||
|
||||
#$|=1;
|
||||
binmode STDOUT, ":utf8";
|
||||
#print "HTTP/1.1 200 OK\n";
|
||||
|
||||
my $useCgi = 0;
|
||||
|
||||
@@ -58,26 +43,6 @@ my $error = '';
|
||||
my $cgi = undef;
|
||||
my $fh = undef;
|
||||
|
||||
#### MOD_PERL2
|
||||
# my $req = Apache2::Request->new(
|
||||
# Apache2::RequestUtil->request,
|
||||
# POST_MAX => $uploadLimit,
|
||||
# DISABLE_UPLOADS => 0
|
||||
# );
|
||||
# my $upload = $req->upload('upload');
|
||||
# my $filename = $upload->filename;
|
||||
# my $fh = $upload->fh;
|
||||
# my $file_size = $upload->size;
|
||||
|
||||
#### CGI
|
||||
# $CGI::POST_MAX = $uploadLimit;
|
||||
# $CGI::TMPDIRECTORY = $tempDir;
|
||||
# $cgi = new CGI();
|
||||
# my $handle = $cgi->upload('upload');
|
||||
# $fh = $handle->handle if (defined $handle);
|
||||
# $error = $cgi->cgi_error() || '';
|
||||
# %params = $cgi->Vars();
|
||||
|
||||
#### simple CGI
|
||||
$CGI::Simple::POST_MAX = $uploadLimit;
|
||||
$CGI::Simple::DISABLE_UPLOADS = 0;
|
||||
@@ -95,16 +60,20 @@ binmode $fh if defined $fh;
|
||||
my ( $user, $expires ) = auth::get_user( $cgi, $config );
|
||||
exit if ( !defined $user ) || ( $user eq '' );
|
||||
|
||||
my $user_presets = uac::get_user_presets( $config, {
|
||||
my $user_presets = uac::get_user_presets(
|
||||
$config,
|
||||
{
|
||||
user => $user,
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id}
|
||||
});
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||
$params->{studio_id} = $params->{default_studio_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{project_id} = $user_presets->{project_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{studio_id} = $params->{default_studio_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
$params->{project_id} = $user_presets->{project_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
|
||||
my $request = {
|
||||
url => $ENV{QUERY_STRING} || '',
|
||||
@@ -150,9 +119,6 @@ showAudioRecordings($config, $request);
|
||||
print STDERR "$0 ERROR: " . $params->{error} . "\n" if $params->{error} ne '';
|
||||
$params->{loc} = localization::get( $config, { user => $params->{presets}->{user}, file => 'event,comment' } );
|
||||
template::process( 'print', $params->{template}, $params );
|
||||
#print Dumper($params->{project_id});
|
||||
#delete $params->{presets};
|
||||
#print STDERR Dumper($params);
|
||||
|
||||
exit;
|
||||
|
||||
@@ -177,12 +143,13 @@ sub uploadRecording{
|
||||
|
||||
if ( defined $fh ) {
|
||||
print STDERR "upload\n";
|
||||
|
||||
#print STDERR Dumper($fh)."<br>";
|
||||
my $fileInfo = uploadFile( $config, $fh, $params->{event_id}, $user, $params->{upload} );
|
||||
$params->{error} .= $fileInfo->{error} if defined $fileInfo->{error};
|
||||
$params->{path} = $fileInfo->{path};
|
||||
$params->{size} = $fileInfo->{size};
|
||||
$params->{duration} = $fileInfo->{duration};
|
||||
#$params->{duration} = $fileInfo->{duration};
|
||||
$params = updateDatabase( $config, $params, $user ) if $params->{error} eq '';
|
||||
} else {
|
||||
$params->{error} .= 'Could not get file handle';
|
||||
@@ -190,8 +157,8 @@ sub uploadRecording{
|
||||
|
||||
if ( $params->{error} ne '' ) {
|
||||
if ( $params->{error} =~ /limit/ ) {
|
||||
$params->{error} .= "audio file size is limited to ".int( $uploadLimit/1000000 )." MB!"
|
||||
. "Please make it smaller and try again!";
|
||||
$params->{error} .=
|
||||
"audio file size is limited to " . int( $uploadLimit / 1000000 ) . " MB!" . "Please make it smaller and try again!";
|
||||
} else {
|
||||
$params->{error} .= "Error:'$error'";
|
||||
}
|
||||
@@ -206,6 +173,7 @@ sub deleteFile{
|
||||
if ( -e $file ) {
|
||||
if ( -w $file ) {
|
||||
unlink $file;
|
||||
|
||||
# check if file has been deleted
|
||||
if ( -e $file ) {
|
||||
uac::print_error("could not delete audio file '$file', $!\n");
|
||||
@@ -231,9 +199,13 @@ sub deleteRecording{
|
||||
return;
|
||||
}
|
||||
|
||||
for my $attr ('project_id', 'studio_id',
|
||||
for my $attr (
|
||||
'project_id', 'studio_id',
|
||||
|
||||
#'series_id',
|
||||
'event_id', 'path'){
|
||||
'event_id', 'path'
|
||||
)
|
||||
{
|
||||
unless ( defined $params->{$attr} ) {
|
||||
uac::print_error( "missing " . $attr . " to delete production" );
|
||||
return;
|
||||
@@ -243,12 +215,15 @@ sub deleteRecording{
|
||||
my $dbh = db::connect($config);
|
||||
$config->{access}->{write} = 0;
|
||||
|
||||
my $audioRecordings = audio_recordings::get($config, {
|
||||
my $audioRecordings = audio_recordings::get(
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
event_id => $params->{event_id},
|
||||
path => $params->{path}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
unless ( ( defined $audioRecordings ) && ( scalar @$audioRecordings > 0 ) ) {
|
||||
uac::print_error("could not find audio file $params->{path} in database");
|
||||
@@ -272,12 +247,15 @@ sub deleteRecording{
|
||||
return unless $isDeleted;
|
||||
|
||||
$config->{access}->{write} = 1;
|
||||
$audioRecordings = audio_recordings::delete($config, $dbh, {
|
||||
$audioRecordings = audio_recordings::delete(
|
||||
$config, $dbh,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
event_id => $params->{event_id},
|
||||
path => $params->{path},
|
||||
});
|
||||
}
|
||||
);
|
||||
$config->{access}->{write} = 0;
|
||||
|
||||
}
|
||||
@@ -296,25 +274,42 @@ sub showAudioRecordings{
|
||||
}
|
||||
}
|
||||
|
||||
my $event=series::get_event($config, {
|
||||
my $event = series::get_event(
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
series_id => $params->{series_id},
|
||||
event_id => $params->{event_id}
|
||||
});
|
||||
}
|
||||
);
|
||||
unless ( defined $event ) {
|
||||
uac::print_error("event not found");
|
||||
return;
|
||||
}
|
||||
|
||||
#print '<pre>'.Dumper($event).'</pre>';
|
||||
|
||||
my $audioRecordings = audio_recordings::get($config, {
|
||||
my $audioRecordings = audio_recordings::get(
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
event_id => $params->{event_id},
|
||||
});
|
||||
}
|
||||
);
|
||||
for my $recording (@$audioRecordings) {
|
||||
$recording->{size} =~ s/(\d)(\d\d\d)$/$1\.$2/g;
|
||||
$recording->{size} =~ s/(\d)(\d\d\d\.\d\d\d)$/$1\.$2/g;
|
||||
|
||||
$recording->{processed} = $recording->{processed} ? 'yes' : 'no';
|
||||
$recording->{mastered} = $recording->{mastered} ? 'yes' : 'no';
|
||||
|
||||
$recording->{eventDuration} = getDuration( $recording->{eventDuration} );
|
||||
$recording->{audioDuration} = getDuration( $recording->{audioDuration} );
|
||||
|
||||
$recording->{rmsLeft} ||= '-';
|
||||
$recording->{rmsRight} ||= '-';
|
||||
}
|
||||
|
||||
my $now = time();
|
||||
@@ -333,6 +328,21 @@ sub showAudioRecordings{
|
||||
|
||||
}
|
||||
|
||||
sub getDuration{
|
||||
my $duration=shift;
|
||||
my $hour = int($duration / 3600);
|
||||
$duration -= $hour * 3600;
|
||||
|
||||
my $minutes = int($duration / 60);
|
||||
$duration -= $minutes * 60;
|
||||
|
||||
my $seconds = int($duration);
|
||||
$duration -= $seconds;
|
||||
|
||||
my $milli= int(100 * $duration);
|
||||
return sprintf("%02d:%02d:%02d.%02d",$hour, $minutes, $seconds, $milli);
|
||||
}
|
||||
|
||||
sub uploadFile {
|
||||
my $config = $_[0];
|
||||
my $fh = $_[1];
|
||||
@@ -354,9 +364,9 @@ sub uploadFile{
|
||||
$time =~ s/\s/\_/g;
|
||||
$time =~ s/[^a-zA-Z0-9\.\-\_]//g;
|
||||
|
||||
$filename =~ s/[^a-zA-Z0-9\.\-\_]//g;
|
||||
$filename =~ s/\.(mp3)$//g;
|
||||
$filename = join( '-', ( $time, 'id' . $eventId, $userName, $filename ) ) . '.mp3';
|
||||
$filename =~ s/[^a-zA-Z0-9\.\-\_]//g;
|
||||
|
||||
my $tempFile = $targetDir . '/' . $filename;
|
||||
print STDERR "tempFile=$tempFile\n";
|
||||
@@ -373,18 +383,6 @@ sub uploadFile{
|
||||
}
|
||||
close DAT;
|
||||
|
||||
# get filename from content
|
||||
#my $md5Filename = Digest::MD5::File::file_md5_hex($tempFile);
|
||||
#$md5Filename = ~s/[\/\+]+/_/g;
|
||||
#print STDERR "md5Filename=$md5Filename\n";
|
||||
|
||||
## rename file to name from content
|
||||
#my $targetFilename = $eventId.'-'.$md5Filename.'-'.$userName.'-'.$time.'.mp3';
|
||||
#my $targetFile = $targetDir.'/'.$targetFilename;
|
||||
#print STDERR "targetFile=$targetFile\n";
|
||||
#File::Copy::move( $tempFile, $targetFile);
|
||||
#return { error => 'could not create $targetFile' } unless -e $targetFile;
|
||||
|
||||
return {
|
||||
dir => $targetDir,
|
||||
path => $filename,
|
||||
@@ -398,6 +396,8 @@ sub updateDatabase{
|
||||
my $params = shift;
|
||||
my $user = shift;
|
||||
|
||||
my $eventDuration = getEventDuration($config, $params->{event_id});
|
||||
|
||||
my $entry = {
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
@@ -405,16 +405,18 @@ sub updateDatabase{
|
||||
path => $params->{path},
|
||||
md5 => $params->{md5} || '',
|
||||
size => $params->{size},
|
||||
created_by => $user
|
||||
created_by => $user,
|
||||
eventDuration => $eventDuration,
|
||||
};
|
||||
print STDERR "updateDatabase:".Dumper($entry);
|
||||
#print STDERR "updateDatabase:" . Dumper($entry);
|
||||
|
||||
#connect
|
||||
$config->{access}->{write} = 1;
|
||||
my $dbh = db::connect($config);
|
||||
|
||||
my $entries = audio_recordings::get(
|
||||
$config, {
|
||||
$config,
|
||||
{
|
||||
project_id => $entry->{project_id},
|
||||
studio_id => $entry->{studio_id},
|
||||
event_id => $entry->{event_id},
|
||||
@@ -444,6 +446,7 @@ sub getFilename{
|
||||
my $upload = shift;
|
||||
|
||||
if ( defined $upload ) {
|
||||
|
||||
# try apache2 module
|
||||
my $filename = $upload->filename();
|
||||
return {
|
||||
@@ -462,6 +465,7 @@ sub getFilename{
|
||||
|
||||
#print STDERR "file:".Dumper($file);
|
||||
my $fileInfo = $cgi->uploadInfo($file);
|
||||
|
||||
#print STDERR "fileInfo:".Dumper($fileInfo);
|
||||
|
||||
if ( defined $fileInfo ) {
|
||||
@@ -478,9 +482,7 @@ sub getFilename{
|
||||
}
|
||||
|
||||
#error
|
||||
return {
|
||||
error => 'Could not detect file name!'
|
||||
};
|
||||
return { error => 'Could not detect file name!' };
|
||||
}
|
||||
|
||||
# get extension and optionally error
|
||||
@@ -491,18 +493,46 @@ sub checkFilename{
|
||||
if ( $filename =~ /\.([a-zA-Z]{3,5})$/ ) {
|
||||
my $extension = lc $1;
|
||||
unless ( grep( /$extension/, @validExtensions ) ) {
|
||||
return {
|
||||
error => 'Following file formats are supported: '.join(",", @validExtensions).'!'
|
||||
};
|
||||
return { error => 'Following file formats are supported: ' . join( ",", @validExtensions ) . '!' };
|
||||
}
|
||||
return {
|
||||
extension => $extension,
|
||||
error => ''
|
||||
};
|
||||
}
|
||||
return {
|
||||
error => 'Not matching file extension found! Supported are: '.join(",", @validExtensions).'!'
|
||||
return { error => 'Not matching file extension found! Supported are: ' . join( ",", @validExtensions ) . '!' };
|
||||
}
|
||||
|
||||
# return event duration in seconds
|
||||
sub getEventDuration{
|
||||
my $config = shift;
|
||||
my $eventId = shift;
|
||||
|
||||
if ($eventId<1){
|
||||
print STDERR "invalid eventId $eventId\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
my $request = {
|
||||
params => {
|
||||
checked => events::check_params(
|
||||
$config,
|
||||
{
|
||||
event_id => $eventId,
|
||||
template => 'no',
|
||||
limit => 1,
|
||||
}
|
||||
)
|
||||
},
|
||||
config => $config
|
||||
};
|
||||
my $events = events::get( $config, $request );
|
||||
if (scalar @$events == 0){
|
||||
print STDERR "getEventDuration: no event found with event_id=$eventId\n";
|
||||
};
|
||||
my $event = $events->[0];
|
||||
my $duration = time::get_duration_seconds( $event->{start}, $event->{end}, $config->{date}->{time_zone} );
|
||||
return $duration;
|
||||
}
|
||||
|
||||
|
||||
@@ -527,7 +557,6 @@ sub check_params{
|
||||
$checked->{studio_id} = -1;
|
||||
}
|
||||
|
||||
|
||||
#word
|
||||
for my $param ( 'debug', 'name', 'description' ) {
|
||||
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /^\s*(.+?)\s*$/ ) ) {
|
||||
@@ -546,4 +575,3 @@ sub check_params{
|
||||
return $checked;
|
||||
}
|
||||
|
||||
|
||||
|
||||
305
website/agenda/planung/calendar.cgi
Normal file → Executable file
305
website/agenda/planung/calendar.cgi
Normal file → Executable file
@@ -39,19 +39,26 @@ my $debug = $config->{system}->{debug};
|
||||
my ( $user, $expires ) = auth::get_user( $cgi, $config );
|
||||
return if ( ( !defined $user ) || ( $user eq '' ) );
|
||||
|
||||
my $user_presets=uac::get_user_presets($config, {
|
||||
my $user_presets = uac::get_user_presets(
|
||||
$config,
|
||||
{
|
||||
user => $user,
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id}
|
||||
});
|
||||
}
|
||||
);
|
||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||
$params->{project_id}=$user_presets->{project_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{project_id} = $user_presets->{project_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
$params->{expires} = $expires;
|
||||
|
||||
#print STDERR Dumper($params);
|
||||
|
||||
my $scriptName = 'calendar.cgi';
|
||||
|
||||
#add "all" studio to select box
|
||||
unshift @{$user_presets->{studios}},{
|
||||
unshift @{ $user_presets->{studios} },
|
||||
{
|
||||
id => -1,
|
||||
name => '-all-'
|
||||
};
|
||||
@@ -77,20 +84,18 @@ log::init($request);
|
||||
|
||||
$params = $request->{params}->{checked};
|
||||
|
||||
|
||||
#print STDERR Dumper($request);
|
||||
if (
|
||||
(
|
||||
(defined $params->{action})
|
||||
&& (
|
||||
($params->{action} eq 'show')
|
||||
|| ($params->{action} eq 'edit_event')
|
||||
)
|
||||
( defined $params->{action} ) && ( ( $params->{action} eq 'show' )
|
||||
|| ( $params->{action} eq 'edit_event' ) )
|
||||
)
|
||||
|| ( $params->{part} == 1 )
|
||||
){
|
||||
)
|
||||
{
|
||||
print "Content-type:text/html; charset=UTF-8;\n\n";
|
||||
} else {
|
||||
|
||||
#process header
|
||||
my $headerParams = uac::set_template_permissions( $request->{permissions}, $params );
|
||||
$headerParams->{loc} = localization::get( $config, { user => $user, file => 'menu' } );
|
||||
@@ -110,7 +115,7 @@ if(
|
||||
<script src="js/jquery.tablesorter.widgets.min.js"></script>
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if ( defined $user_presets->{error} ) {
|
||||
print "<br><br>";
|
||||
@@ -148,7 +153,9 @@ $end_of_day +=24 if($end_of_day<=$start_of_day);
|
||||
our $hour_height = 60;
|
||||
our $yzoom = 1.5;
|
||||
|
||||
showCalendar ($config, $request, {
|
||||
showCalendar(
|
||||
$config, $request,
|
||||
{
|
||||
hour_height => $hour_height,
|
||||
yzoom => $yzoom,
|
||||
start_of_day => $start_of_day,
|
||||
@@ -191,6 +198,7 @@ sub showCalendar{
|
||||
my $events = [];
|
||||
|
||||
if ( ( $params->{part} == 1 ) || ( $params->{list} == 1 ) ) {
|
||||
|
||||
#set date range
|
||||
my $from = $calendar->{from_date};
|
||||
my $till = $calendar->{till_date};
|
||||
@@ -246,13 +254,16 @@ sub showCalendar{
|
||||
}
|
||||
$events = break_dates( $events, $start_of_day );
|
||||
}
|
||||
|
||||
# recalc after break (for list only?)
|
||||
for my $event (@$events) {
|
||||
|
||||
#if ($event->{splitCount}>0){
|
||||
delete $event->{day};
|
||||
delete $event->{start_date};
|
||||
delete $event->{end_date};
|
||||
$event = events::calc_dates( $config, $event );
|
||||
|
||||
#}
|
||||
}
|
||||
|
||||
@@ -290,6 +301,7 @@ sub showCalendar{
|
||||
my $id = 0;
|
||||
for my $date (@$series_dates) {
|
||||
$date->{schedule} = 1;
|
||||
|
||||
#$date->{event_id}=-1;
|
||||
$date->{event_id} = $id;
|
||||
$date->{origStart} = $date->{start};
|
||||
@@ -310,11 +322,13 @@ sub showCalendar{
|
||||
|
||||
#get timeslot_dates
|
||||
my $studio_dates = studio_timeslot_dates::get( $config, $options );
|
||||
|
||||
#print STDERR Dumper($options);
|
||||
$id = 0;
|
||||
for my $date (@$studio_dates) {
|
||||
$date->{grid} = 1;
|
||||
$date->{series_id} = -1;
|
||||
|
||||
#$date->{event_id}=-1;
|
||||
$date->{event_id} = $id;
|
||||
$date->{origStart} = $date->{start};
|
||||
@@ -359,44 +373,37 @@ sub showCalendar{
|
||||
for my $date (@$playout_dates) {
|
||||
my $format = undef;
|
||||
if ( defined $date->{'format'} ) {
|
||||
$format=($date->{'format'}||'')." ".($date->{'format_version'}||'')." ".($date->{'format_profile'}||'');
|
||||
$format =
|
||||
( $date->{'format'} || '' ) . " " . ( $date->{'format_version'} || '' ) . " " . ( $date->{'format_profile'} || '' );
|
||||
$format =~ s/MPEG Audio Version 1 Layer 3/MP3/g;
|
||||
$format .= ' ' . ( $date->{'format_settings'} || '' ) if defined $date->{'format_settings'};
|
||||
$format .= '<br>';
|
||||
}
|
||||
|
||||
my $bitrate=$date->{bitrate}||'';
|
||||
if ($bitrate ne ''){
|
||||
if ($bitrate >= 200){
|
||||
$bitrate = '<span class="warn">'.$bitrate.'</span';
|
||||
}elsif ($bitrate < 190){
|
||||
$bitrate = '<span class="error">'.$bitrate.'</span>';
|
||||
}
|
||||
$bitrate.=' Kbits'." ".($date->{bitrate_mode}||'')."<br>";
|
||||
}
|
||||
|
||||
#print STDERR Dumper($date);
|
||||
$date->{play} = 1;
|
||||
$date->{series_id} = -1;
|
||||
$date->{event_id} = $id;
|
||||
$date->{title} = '';
|
||||
$date->{title} .= '<b>errors</b>: ' . $date->{errors} . '<br>' if defined $date->{errors};
|
||||
$date->{title}.= ($date->{duration}||'0')." s<br>" if defined $date->{duration};
|
||||
$date->{title}.= $bitrate if $bitrate ne '';
|
||||
$date->{title}.= formatLoudness("<b>L</b>", $date->{rms_left}).' ' if defined $date->{rms_left};
|
||||
$date->{title}.= formatLoudness("<b>R</b>", $date->{rms_right}).'<br>' if defined $date->{rms_right};
|
||||
$date->{title} .= formatDuration( $date->{duration} ) . "s<br>" if defined $date->{duration};
|
||||
$date->{title} .= formatLoudness( "L:", $date->{rms_left} ) . ' dB, ' if defined $date->{rms_left};
|
||||
$date->{title} .= formatLoudness( "R:", $date->{rms_right} ) . ' dB<br>' if defined $date->{rms_right};
|
||||
$date->{title} .= formatBitrate( $date->{bitrate} ) . ' ' . $date->{bitrate_mode} . '<br>' if defined $date->{bitrate};
|
||||
$date->{title} .= '<b>replay gain</b> ' . sprintf( "%.1f", $date->{replay_gain} ) . '<br>' if defined $date->{replay_gain};
|
||||
$date->{title}.= ($date->{channels}||'').' channels<br>' if defined $date->{channels};
|
||||
$date->{title} .= ( ( $date->{sampling_rate} || '0' ) / 1000 ) . ' kHz<br>' if defined $date->{sampling_rate};
|
||||
$date->{title} .= ( $date->{channels} || '' ) . ' channels<br>' if defined $date->{channels};
|
||||
$date->{title} .= int( ( $date->{'stream_size'} || '0' ) / ( 1024 * 1024 ) ) . 'MB<br>' if defined $date->{'stream_size'};
|
||||
$date->{title} .= $format if defined $format;
|
||||
$date->{title} .= '<b>library</b>: ' . ( $date->{writing_library} || '' ) . '<br>' if defined $date->{'writing_library'};
|
||||
$date->{title} .= '<b>path</b>: ' . ( $date->{file} || '' ) . '<br>' if defined $date->{file};
|
||||
|
||||
#$date->{title}.= '<b>rms_image</b>: ' .($date->{rms_image}||'').'<br>' if defined $date->{rms_image};
|
||||
|
||||
$date->{rms_image} = uri_unescape( $date->{rms_image} ) if defined $date->{rms_image};
|
||||
|
||||
$date->{origStart} = $date->{start};
|
||||
|
||||
# set end date seconds to 00 to handle error at break_dates/join_dates
|
||||
$date->{end} =~ s/(\d\d\:\d\d)\:\d\d/$1\:00/;
|
||||
delete $date->{day};
|
||||
@@ -422,6 +429,7 @@ sub showCalendar{
|
||||
|
||||
#output
|
||||
printToolbar( $config, $params, $calendar ) if $params->{part} == 0;
|
||||
|
||||
#if($params->{part}==1){
|
||||
print qq{
|
||||
<script>
|
||||
@@ -470,6 +478,7 @@ sub showCalendar{
|
||||
$cal_options->{min_hour} = $min_hour;
|
||||
$cal_options->{max_hour} = $max_hour;
|
||||
}
|
||||
|
||||
#print STDERR $start_of_day." ".$cal_options->{min_hour}."\n";
|
||||
|
||||
# calculate positions and find schedule errors (depending on position)
|
||||
@@ -498,6 +507,7 @@ sub showCalendar{
|
||||
</center>
|
||||
};
|
||||
}
|
||||
|
||||
# time has to be set when events come in
|
||||
printJavascript( $config, $permissions, $params, $cal_options );
|
||||
if ( $params->{part} == 0 ) {
|
||||
@@ -505,7 +515,7 @@ sub showCalendar{
|
||||
</body>
|
||||
</html>
|
||||
};
|
||||
};
|
||||
}
|
||||
if ( $params->{part} == 1 ) {
|
||||
}
|
||||
}
|
||||
@@ -517,6 +527,7 @@ sub formatLoudness{
|
||||
return '' unless defined $value;
|
||||
return '' if $value == 0;
|
||||
return '' if $value eq '';
|
||||
|
||||
#print STDERR "'$value'\n";
|
||||
$value = sprintf( "%.1f", $value );
|
||||
my $class = 'ok';
|
||||
@@ -524,7 +535,30 @@ sub formatLoudness{
|
||||
$class = 'error' if $value > -16.0;
|
||||
$class = 'warn' if $value < -24.0;
|
||||
$class = 'error' if $value < -27.0;
|
||||
return qq{<span class="$class">}.$label.$value.qq{</span>};
|
||||
return qq{$label<span class="$class">} . $value . qq{</span>};
|
||||
}
|
||||
|
||||
sub formatDuration {
|
||||
my $duration = shift;
|
||||
return '' unless defined $duration;
|
||||
return '' if $duration eq '';
|
||||
my $result = int( ( $duration + 3600 ) * 10 + 0.5) % 600;
|
||||
my $class = "ok";
|
||||
$class = "warn" if $result > 1;
|
||||
$class = "error" if $result > 10;
|
||||
return sprintf( qq{<span class="%s">%.01f</span>}, $class, $duration );
|
||||
}
|
||||
|
||||
sub formatBitrate {
|
||||
my $bitrate = shift;
|
||||
return '' if $bitrate eq '';
|
||||
if ( $bitrate >= 200 ) {
|
||||
return qq{<span class="warn">$bitrate</span>};
|
||||
} elsif ( $bitrate < 190 ) {
|
||||
return qq{<span class="error">$bitrate</span>};
|
||||
} else {
|
||||
return qq{<span class="ok">$bitrate</span>};
|
||||
}
|
||||
}
|
||||
|
||||
sub debugDate {
|
||||
@@ -536,6 +570,7 @@ sub debugDate{
|
||||
my $dt = ( $date->{start} || '' ) . " " . ( $date->{end} | '' );
|
||||
my $da = ( $date->{start_date} || '' ) . " " . ( $date->{end_date} || '' );
|
||||
my $type = "schedule:" . ( $date->{schedule} || "" ) . " grid:" . ( $date->{grid} || "" );
|
||||
|
||||
#print STDERR "$dt $da count:$date->{splitCount} $type $date->{program}-$date->{series_name}-$date->{title}\n";
|
||||
}
|
||||
|
||||
@@ -551,6 +586,7 @@ sub break_dates{
|
||||
next unless defined $date;
|
||||
|
||||
$date->{splitCount} = 0 unless defined $date->{splitCount};
|
||||
|
||||
#debugDate($date);
|
||||
|
||||
next if $date->{splitCount} > 6;
|
||||
@@ -565,12 +601,14 @@ sub break_dates{
|
||||
$entry->{start} = $nextDayStart;
|
||||
$entry->{splitCount}++;
|
||||
push @$dates, $entry;
|
||||
|
||||
# print STDERR "add $entry->{start} $entry->{end} count:$entry->{splitCount} $entry->{program}-$entry->{series_name}-$entry->{title}\n";
|
||||
|
||||
#modify existing entry
|
||||
my $start_date = time::datetime_to_date( $date->{start} );
|
||||
$date->{end} = $nextDayStart;
|
||||
$date->{splitCount}++;
|
||||
|
||||
# print STDERR "set $date->{start} $date->{end} count:$date->{splitCount} $date->{program}-$date->{series_name}-$date->{title}\n";
|
||||
}
|
||||
|
||||
@@ -601,6 +639,7 @@ sub breaks_day{
|
||||
|
||||
# start before 6:00 of next day
|
||||
my $nextDayStart = time::add_days_to_datetime( $dayStart, 1 );
|
||||
|
||||
#$nextDayStart=~s/:00$//;
|
||||
return $nextDayStart if ( $start lt $nextDayStart ) && ( $end gt $nextDayStart );
|
||||
|
||||
@@ -622,12 +661,11 @@ sub join_dates{
|
||||
$prev_date = $date;
|
||||
next;
|
||||
}
|
||||
if (
|
||||
($date->{event_id} == $prev_date->{event_id})
|
||||
if ( ( $date->{event_id} == $prev_date->{event_id} )
|
||||
&& ( $date->{series_id} == $prev_date->{series_id} )
|
||||
&& ( $date->{start} eq $prev_date->{end} )
|
||||
&& ($date->{start}=~/00\:00\:\d\d/)
|
||||
){
|
||||
&& ( $date->{start} =~ /00\:00\:\d\d/ ) )
|
||||
{
|
||||
$prev_date->{end} = $date->{end};
|
||||
$date = undef;
|
||||
next;
|
||||
@@ -699,6 +737,7 @@ sub showEventList{
|
||||
next if defined $event->{grid};
|
||||
next if defined $event->{work};
|
||||
next if defined $event->{play};
|
||||
|
||||
#schedules with matching date are marked to be hidden in find_errors
|
||||
next if defined $event->{hide};
|
||||
$event->{project_id} = $params->{project_id};
|
||||
@@ -745,15 +784,19 @@ sub showEventList{
|
||||
$live = 'x' if $live eq '1';
|
||||
|
||||
my $rerun = $event->{rerun} || '-';
|
||||
|
||||
#$rerun='-' if $rerun eq '0';
|
||||
#$rerun='x' if $rerun eq '1';
|
||||
$rerun= " [".markup::base26($event->{recurrence_count}+1)."]" if (defined $event->{recurrence_count}) && ($event->{recurrence_count} ne '') && ($event->{recurrence_count}>0);
|
||||
$rerun = " [" . markup::base26( $event->{recurrence_count} + 1 ) . "]"
|
||||
if ( defined $event->{recurrence_count} ) && ( $event->{recurrence_count} ne '' ) && ( $event->{recurrence_count} > 0 );
|
||||
|
||||
my $title = $event->{title};
|
||||
$title .= ': ' . $event->{user_title} if $event->{user_title} ne '';
|
||||
|
||||
print qq!<tr id="$id" class="$class" date="$event->{start}" >!
|
||||
.qq!<td class="day_of_year">!.time::dayOfYear($event->{start}).q!</td>!
|
||||
. qq!<td class="day_of_year">!
|
||||
. time::dayOfYear( $event->{start} )
|
||||
. q!</td>!
|
||||
. qq!<td class="weekday">$event->{weekday_short_name},</td>!
|
||||
. qq!<td class="start_date">$event->{start_date_name}</td>!
|
||||
. qq!<td class="start_time">$event->{start_time_name} - $event->{end_time}</td>!
|
||||
@@ -763,8 +806,7 @@ sub showEventList{
|
||||
. qq!<td class="rerun">$rerun</td>!
|
||||
. qq!<td class="live">$live</td>!
|
||||
. qq!<td class="archived">$archived</td>!
|
||||
.qq!</tr>!
|
||||
."\n";
|
||||
. qq!</tr>! . "\n";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@@ -779,13 +821,16 @@ sub showEventList{
|
||||
|
||||
#add handler for events not assigned to series
|
||||
if ( ( $params->{studio_id} ne '' ) && ( $params->{studio_id} ne '-1' ) ) {
|
||||
my $series = series::get($config,{
|
||||
my $series = series::get(
|
||||
$config,
|
||||
{
|
||||
project_id => $project_id,
|
||||
studio_id => $studio_id
|
||||
}
|
||||
);
|
||||
print q{<div id="event_no_series" style="display:none">};
|
||||
print addEventsToSeries($series, $params) if ((defined $permissions->{assign_series_events}) && ($permissions->{assign_series_events}eq'1'));
|
||||
print addEventsToSeries( $series, $params )
|
||||
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' ) );
|
||||
print q{</div>};
|
||||
}
|
||||
@@ -825,7 +870,8 @@ sub calcCalendarTable{
|
||||
|
||||
#insert time column
|
||||
for my $hour ( $min_hour .. $max_hour ) {
|
||||
push @{$events_by_day->{0}},{
|
||||
push @{ $events_by_day->{0} },
|
||||
{
|
||||
start => sprintf( '%02d:00', $hour % 24 ),
|
||||
start_time => sprintf( '%02d:00', $hour ),
|
||||
end_time => sprintf( '%02d:00', $hour + 1 ),
|
||||
@@ -847,7 +893,8 @@ sub calcCalendarTable{
|
||||
$time = $2;
|
||||
}
|
||||
|
||||
push @{$events_by_day->{0}},{
|
||||
push @{ $events_by_day->{0} },
|
||||
{
|
||||
start => $time,
|
||||
start_time => $time,
|
||||
end_time => $time,
|
||||
@@ -943,16 +990,18 @@ sub printTableHeader{
|
||||
$out .= qq{<div id="position"></div></td>};
|
||||
next;
|
||||
} else {
|
||||
|
||||
#print weekday
|
||||
$dt->set_locale($language);
|
||||
$content = $dt->day_name() . '<br>';
|
||||
$content.=$dt->strftime('%d. %b %Y').'<br>';;
|
||||
$content.=time::dayOfYear($event->{start}).'<br>';;
|
||||
$content .= $dt->strftime('%d. %b %Y') . '<br>';
|
||||
$content .= time::dayOfYear( $event->{start} ) . '<br>';
|
||||
|
||||
#$class="date";
|
||||
if ( ( $day ge $date ) && ( $next_day_found == 0 ) ) {
|
||||
$class = "date today";
|
||||
$next_day_found = 1;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#insert date name
|
||||
@@ -1011,6 +1060,7 @@ sub printTableBody{
|
||||
my $ypos = 1;
|
||||
my $dt = undef;
|
||||
my $old_week = undef;
|
||||
|
||||
#print Dumper($days);
|
||||
for my $day (@$days) {
|
||||
my $events = $events_by_day->{$day};
|
||||
@@ -1024,14 +1074,14 @@ sub printTableBody{
|
||||
$old_week = $week;
|
||||
}
|
||||
|
||||
|
||||
$out .= qq{<td>}; # width="$width">};
|
||||
|
||||
for my $event (@$events) {
|
||||
my $content = '';
|
||||
if ( ( defined $event->{series_name} ) && ( $event->{series_name} ne '' ) ) {
|
||||
$event->{series_name}=$params->{loc}->{single_event} if $event->{series_name} eq '' || $event->{series_name} eq '_single_';
|
||||
$content='<b>'.$event->{series_name}.'</b><br>'
|
||||
$event->{series_name} = $params->{loc}->{single_event}
|
||||
if $event->{series_name} eq '' || $event->{series_name} eq '_single_';
|
||||
$content = '<b>' . $event->{series_name} . '</b><br>';
|
||||
}
|
||||
|
||||
if ( ( defined $event->{title} ) && ( defined $event->{title} ne '' ) ) {
|
||||
@@ -1052,7 +1102,7 @@ sub printTableBody{
|
||||
|
||||
if ( $event->{class} eq 'event' ) {
|
||||
$event->{content} .= '<br><span class="weak">';
|
||||
$event->{content}.= int($event->{duration}+0.5).' sec<br>' if defined $event->{duration};
|
||||
$event->{content} .= formatDuration( $event->{duration} ) . 's ' if defined $event->{duration};
|
||||
$event->{content} .= formatLoudness( 'L', $event->{rms_left} ) . ' ' if defined $event->{rms_left};
|
||||
$event->{content} .= formatLoudness( 'R', $event->{rms_right} ) if defined $event->{rms_right};
|
||||
$event->{content} .= '</span>';
|
||||
@@ -1061,7 +1111,7 @@ sub printTableBody{
|
||||
$out .= print_event( $params, $event, $ypos, $yoffset, $yzoom );
|
||||
|
||||
$ypos++;
|
||||
};
|
||||
}
|
||||
$out .= '</td>';
|
||||
}
|
||||
$out .= q{
|
||||
@@ -1083,12 +1133,16 @@ sub printSeries{
|
||||
my $project_id = $params->{project_id};
|
||||
my $studio_id = $params->{studio_id};
|
||||
|
||||
my $series=series::get($config,{
|
||||
my $series = series::get(
|
||||
$config,
|
||||
{
|
||||
project_id => $project_id,
|
||||
studio_id => $studio_id
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
my $out = '';
|
||||
|
||||
#add schedule entry for series
|
||||
if ( ( defined $permissions->{update_schedule} ) && ( $permissions->{update_schedule} eq '1' ) && ( @$series > 0 ) ) {
|
||||
$out .= q{<div id="series" style="display:none">};
|
||||
@@ -1098,7 +1152,8 @@ sub printSeries{
|
||||
|
||||
if ( ( $params->{studio_id} ne '' ) && ( $params->{studio_id} ne '-1' ) ) {
|
||||
$out .= q{<div id="event_no_series" style="display:none">};
|
||||
$out.= addEventsToSeries($series, $params) if ((defined $permissions->{assign_series_events}) && ($permissions->{assign_series_events}eq'1') );
|
||||
$out .= addEventsToSeries( $series, $params )
|
||||
if ( ( defined $permissions->{assign_series_events} ) && ( $permissions->{assign_series_events} eq '1' ) );
|
||||
$out .= createSeries($params) if ( ( defined $permissions->{create_series} ) && ( $permissions->{create_series} eq '1' ) );
|
||||
$out .= q{</div>};
|
||||
}
|
||||
@@ -1118,6 +1173,7 @@ sub printJavascript{
|
||||
my $cal_options = shift;
|
||||
|
||||
my $startOfDay = $cal_options->{min_hour} % 24;
|
||||
|
||||
#print STDERR "js: ".$cal_options->{min_hour}." ".$startOfDay."\n";
|
||||
my $out = q{
|
||||
<script>
|
||||
@@ -1133,7 +1189,6 @@ sub printJavascript{
|
||||
print $out;
|
||||
}
|
||||
|
||||
|
||||
#TODO: Javascript
|
||||
|
||||
sub addCalendarButton {
|
||||
@@ -1177,6 +1232,7 @@ sub addSeries{
|
||||
|
||||
$out .= '<option value="' . $id . '" duration="' . $duration . '">' . $name . $title . '</option>' . "\n";
|
||||
}
|
||||
|
||||
#print Dumper($series);
|
||||
|
||||
$out .= q{
|
||||
@@ -1231,6 +1287,7 @@ sub addEventsToSeries{
|
||||
$title = ' - ' . $title if $title ne '';
|
||||
$out .= '<option value="' . $id . '" duration="' . $duration . '">' . $name . $title . '</option>' . "\n";
|
||||
}
|
||||
|
||||
#print Dumper($series);
|
||||
|
||||
$out .= q{
|
||||
@@ -1239,7 +1296,9 @@ sub addEventsToSeries{
|
||||
</tr>
|
||||
<tr><td></td>
|
||||
<td>
|
||||
<button type="submit" name="action" value="assign_event">}.$params->{loc}->{button_assign_event_series}.q{</button>
|
||||
<button type="submit" name="action" value="assign_event">}
|
||||
. $params->{loc}->{button_assign_event_series}
|
||||
. q{</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -1316,7 +1375,7 @@ sub print_event{
|
||||
my $height = $yend - $ystart + 2;
|
||||
|
||||
if ( $ypos > 0 ) {
|
||||
$height=q{height:}.($height).'px;'
|
||||
$height = q{height:} . ($height) . 'px;';
|
||||
} else {
|
||||
$height = '';
|
||||
}
|
||||
@@ -1326,11 +1385,10 @@ sub print_event{
|
||||
$date = $event->{date} if defined $event->{date};
|
||||
my $content = $event->{content} || '';
|
||||
|
||||
|
||||
if ( $class =~ /schedule/ ) {
|
||||
my $frequency = getFrequency($event);
|
||||
$content .= "<br>($frequency)" if defined $frequency;
|
||||
};
|
||||
}
|
||||
|
||||
my $attr = '';
|
||||
if ( $class =~ /play/ ) {
|
||||
@@ -1342,12 +1400,14 @@ sub print_event{
|
||||
$content = '<div class="text">' . $content . '</div><div class="icons"></div>';
|
||||
}
|
||||
|
||||
return q{<div }
|
||||
.qq{class="$class" id="$id" style="}.$height.q{top:}.$ystart.q{px;"}
|
||||
return
|
||||
q{<div }
|
||||
. qq{class="$class" id="$id" style="}
|
||||
. $height . q{top:}
|
||||
. $ystart . q{px;"}
|
||||
. qq{ date="$date"}
|
||||
. qq{ $attr}
|
||||
.qq{>$content</div>}
|
||||
."\n";
|
||||
. qq{>$content</div>} . "\n";
|
||||
}
|
||||
|
||||
sub getFrequency {
|
||||
@@ -1404,6 +1464,7 @@ sub find_errors{
|
||||
for my $i ( 0 .. @$events - 1 ) {
|
||||
my $event = $events->[$i];
|
||||
next unless defined $event->{check_errors};
|
||||
|
||||
#look for conflicts with next 5 events of day
|
||||
my $min_index = $i + 1;
|
||||
next if $min_index >= @$events;
|
||||
@@ -1412,15 +1473,15 @@ sub find_errors{
|
||||
for my $j ( $min_index .. $max_index ) {
|
||||
my $event2 = $events->[$j];
|
||||
next unless defined $event2->{check_errors};
|
||||
|
||||
#mark events if same start,stop,series_id, one is schedule one is event
|
||||
if ( ( defined $event->{series_id} )
|
||||
&& ( defined $event2->{series_id} )
|
||||
&& ($event->{series_id}==$event2->{series_id})
|
||||
){
|
||||
if(
|
||||
($event->{ystart} eq $event2->{ystart})
|
||||
&& ($event->{yend} eq $event2->{yend})
|
||||
){
|
||||
&& ( $event->{series_id} == $event2->{series_id} ) )
|
||||
{
|
||||
if ( ( $event->{ystart} eq $event2->{ystart} )
|
||||
&& ( $event->{yend} eq $event2->{yend} ) )
|
||||
{
|
||||
if ( ( defined $event->{schedule} ) && ( !( defined $event2->{schedule} ) ) ) {
|
||||
$event->{hide} = 1;
|
||||
$event2->{scheduled} = 1;
|
||||
@@ -1431,11 +1492,10 @@ sub find_errors{
|
||||
$event2->{hide} = 1;
|
||||
next;
|
||||
}
|
||||
}elsif(
|
||||
($event->{ystart} >= $event2->{ystart})
|
||||
} elsif ( ( $event->{ystart} >= $event2->{ystart} )
|
||||
&& ( $event->{scheduled} == 1 )
|
||||
&& ($event2->{scheduled}==1)
|
||||
){
|
||||
&& ( $event2->{scheduled} == 1 ) )
|
||||
{
|
||||
#subsequent schedules
|
||||
$event->{error}++;
|
||||
$event2->{error} = 1 unless defined $event2->{error};
|
||||
@@ -1443,6 +1503,7 @@ sub find_errors{
|
||||
next;
|
||||
}
|
||||
} elsif ( $event->{ystart} >= $event2->{ystart} ) {
|
||||
|
||||
#errors on multiple schedules or events
|
||||
$event->{error}++;
|
||||
$event2->{error} = 1 unless defined $event2->{error};
|
||||
@@ -1453,12 +1514,11 @@ sub find_errors{
|
||||
|
||||
#remove error tags from correctly scheduled entries (subsequent entries with same series id)
|
||||
for my $event (@$events) {
|
||||
delete $event->{error} if (
|
||||
delete $event->{error}
|
||||
if (
|
||||
( defined $event->{error} )
|
||||
&& (
|
||||
( (defined $event->{scheduled}) && ($event->{scheduled}==1) )
|
||||
|| ( (defined $event->{hide}) && ($event->{hide} ==1) )
|
||||
)
|
||||
&& ( ( ( defined $event->{scheduled} ) && ( $event->{scheduled} == 1 ) )
|
||||
|| ( ( defined $event->{hide} ) && ( $event->{hide} == 1 ) ) )
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1492,12 +1552,10 @@ sub printToolbar{
|
||||
|
||||
# my $options=[];
|
||||
for my $range (
|
||||
$params->{loc}->{label_month},
|
||||
$params->{loc}->{label_4_weeks},
|
||||
$params->{loc}->{label_2_weeks},
|
||||
$params->{loc}->{label_1_week},
|
||||
$params->{loc}->{label_day}
|
||||
){
|
||||
$params->{loc}->{label_month}, $params->{loc}->{label_4_weeks}, $params->{loc}->{label_2_weeks},
|
||||
$params->{loc}->{label_1_week}, $params->{loc}->{label_day}
|
||||
)
|
||||
{
|
||||
my $value = $ranges->{$range} || '';
|
||||
$toolbar .= qq{<option name="$range" value="$value">} . $range . '</option>';
|
||||
}
|
||||
@@ -1519,7 +1577,6 @@ sub printToolbar{
|
||||
</select>
|
||||
};
|
||||
|
||||
|
||||
#filter
|
||||
my $filter = $params->{filter} || '';
|
||||
$toolbar .= qq{
|
||||
@@ -1581,23 +1638,11 @@ sub getCalendar{
|
||||
my $previous = '';
|
||||
my $next = '';
|
||||
if ( $range eq 'month' ) {
|
||||
$previous=time::get_datetime(
|
||||
$from_date,
|
||||
$config->{date}->{time_zone}
|
||||
)->subtract(months=>1)->set_day(1)->date();
|
||||
$next=time::get_datetime(
|
||||
$from_date,
|
||||
$config->{date}->{time_zone}
|
||||
)->add(months=>1)->set_day(1)->date();
|
||||
$previous = time::get_datetime( $from_date, $config->{date}->{time_zone} )->subtract( months => 1 )->set_day(1)->date();
|
||||
$next = time::get_datetime( $from_date, $config->{date}->{time_zone} )->add( months => 1 )->set_day(1)->date();
|
||||
} else {
|
||||
$previous=time::get_datetime(
|
||||
$from_date,
|
||||
$config->{date}->{time_zone}
|
||||
)->subtract(days=>$range)->date();
|
||||
$next=time::get_datetime(
|
||||
$from_date,
|
||||
$config->{date}->{time_zone}
|
||||
)->add(days=>$range)->date();
|
||||
$previous = time::get_datetime( $from_date, $config->{date}->{time_zone} )->subtract( days => $range )->date();
|
||||
$next = time::get_datetime( $from_date, $config->{date}->{time_zone} )->add( days => $range )->date();
|
||||
}
|
||||
my ( $year, $month, $day ) = split( /\-/, $from_date );
|
||||
$month = $time::names->{$language}->{months_abbr}->[ $month - 1 ] || '';
|
||||
@@ -1622,27 +1667,22 @@ sub getFromDate{
|
||||
}
|
||||
my $date = $params->{date};
|
||||
if ( $date eq '' ) {
|
||||
$date=DateTime->now(
|
||||
time_zone => $config->{date}->{time_zone}
|
||||
)->date();
|
||||
$date = DateTime->now( time_zone => $config->{date}->{time_zone} )->date();
|
||||
}
|
||||
|
||||
if ( $params->{range} eq '28' ) {
|
||||
|
||||
#get start of 4 week period
|
||||
$date = time::get_datetime( $date, $config->{date}->{time_zone} )->truncate( to => 'week' )->ymd();
|
||||
}
|
||||
if ( $params->{range} eq 'month' ) {
|
||||
|
||||
#get first day of month
|
||||
return time::get_datetime(
|
||||
$date,
|
||||
$config->{date}->{time_zone}
|
||||
)->set_day(1)->date();
|
||||
return time::get_datetime( $date, $config->{date}->{time_zone} )->set_day(1)->date();
|
||||
}
|
||||
|
||||
#get date
|
||||
return time::get_datetime(
|
||||
$date,
|
||||
$config->{date}->{time_zone}
|
||||
)->date();
|
||||
return time::get_datetime( $date, $config->{date}->{time_zone} )->date();
|
||||
}
|
||||
|
||||
sub getTillDate {
|
||||
@@ -1653,27 +1693,20 @@ sub getTillDate{
|
||||
}
|
||||
my $date = $params->{date} || '';
|
||||
if ( $date eq '' ) {
|
||||
$date=DateTime->now(
|
||||
time_zone => $config->{date}->{time_zone}
|
||||
)->date();
|
||||
$date = DateTime->now( time_zone => $config->{date}->{time_zone} )->date();
|
||||
}
|
||||
if ( $params->{range} eq '28' ) {
|
||||
$date = time::get_datetime( $date, $config->{date}->{time_zone} )->truncate( to => 'week' )->ymd();
|
||||
}
|
||||
if ( $params->{range} eq 'month' ) {
|
||||
|
||||
#get last day of month
|
||||
return time::get_datetime(
|
||||
$date,
|
||||
$config->{date}->{time_zone}
|
||||
)->set_day(1)->add(months=>1)->subtract(days=>1)->date();
|
||||
}
|
||||
#add range to date
|
||||
return time::get_datetime(
|
||||
$date,
|
||||
$config->{date}->{time_zone}
|
||||
)->add(days=>$params->{range})->date();
|
||||
return time::get_datetime( $date, $config->{date}->{time_zone} )->set_day(1)->add( months => 1 )->subtract( days => 1 )->date();
|
||||
}
|
||||
|
||||
#add range to date
|
||||
return time::get_datetime( $date, $config->{date}->{time_zone} )->add( days => $params->{range} )->date();
|
||||
}
|
||||
|
||||
sub getSeriesEvents {
|
||||
my $config = shift;
|
||||
@@ -1700,16 +1733,21 @@ sub getSeriesEvents{
|
||||
permissions => $request->{permissions}
|
||||
};
|
||||
$request2->{params}->{checked}->{published} = 'all';
|
||||
delete $request2->{params}->{checked}->{exclude_locations} if (($params->{studio_id}==-1)&&(defined $request2->{params}->{checked}->{exclude_locations}));
|
||||
delete $request2->{params}->{checked}->{exclude_locations}
|
||||
if ( ( $params->{studio_id} == -1 ) && ( defined $request2->{params}->{checked}->{exclude_locations} ) );
|
||||
|
||||
my $events = events::get( $config, $request2 );
|
||||
|
||||
#print STDERR Dumper($request2->{params}->{checked});
|
||||
#print STDERR Dumper($events);
|
||||
series::add_series_ids_to_events( $request->{config}, $events );
|
||||
|
||||
my $studios=studios::get($request->{config},{
|
||||
my $studios = studios::get(
|
||||
$request->{config},
|
||||
{
|
||||
project_id => $options->{project_id}
|
||||
});
|
||||
}
|
||||
);
|
||||
my $studio_id_by_location = {};
|
||||
for my $studio (@$studios) {
|
||||
$studio_id_by_location->{ $studio->{location} } = $studio->{id};
|
||||
@@ -1723,7 +1761,6 @@ sub getSeriesEvents{
|
||||
return $events;
|
||||
}
|
||||
|
||||
|
||||
sub check_params {
|
||||
my $params = shift;
|
||||
my $config = shift;
|
||||
@@ -1741,7 +1778,8 @@ sub check_params{
|
||||
#numeric values
|
||||
$checked->{part} = 0;
|
||||
$checked->{list} = 0;
|
||||
for my $param ('id','project_id','studio_id','default_studio_id','user_id','series_id','event_id','part','list','day_start'){
|
||||
for my $param ( 'id', 'project_id', 'studio_id', 'default_studio_id', 'user_id', 'series_id', 'event_id', 'part', 'list', 'day_start' )
|
||||
{
|
||||
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /^\d+$/ ) ) {
|
||||
$checked->{$param} = $params->{$param};
|
||||
}
|
||||
@@ -1751,17 +1789,19 @@ sub check_params{
|
||||
$checked->{day_start} %= 24;
|
||||
|
||||
if ( defined $checked->{studio_id} ) {
|
||||
|
||||
# a studio is selected, use the studio from parameter
|
||||
$checked->{default_studio_id} = $checked->{studio_id};
|
||||
} elsif ( ( defined $params->{studio_id} ) && ( $params->{studio_id} eq '-1' ) ) {
|
||||
|
||||
# all studios selected, use -1
|
||||
$checked->{studio_id} = -1;
|
||||
} else {
|
||||
|
||||
# no studio given, use default studio
|
||||
$checked->{studio_id} = $checked->{default_studio_id};
|
||||
}
|
||||
|
||||
|
||||
$checked->{open_end} = 1;
|
||||
for my $param ('open_end') {
|
||||
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /^\d+$/ ) ) {
|
||||
@@ -1772,6 +1812,7 @@ sub check_params{
|
||||
#scalars
|
||||
$checked->{search} = '';
|
||||
$checked->{filter} = '';
|
||||
|
||||
#$checked->{range}='month';
|
||||
for my $param ( 'search', 'filter', 'range' ) {
|
||||
if ( defined $params->{$param} ) {
|
||||
@@ -1791,6 +1832,7 @@ sub check_params{
|
||||
|
||||
for my $param ( 'series_name', 'title', 'excerpt', 'content', 'program', 'category', 'image', 'user_content' ) {
|
||||
if ( defined $params->{$param} ) {
|
||||
|
||||
#$checked->{$param}=uri_unescape();
|
||||
$checked->{$param} = $params->{$param};
|
||||
$checked->{$param} =~ s/^\s+//g;
|
||||
@@ -1808,4 +1850,3 @@ sub check_params{
|
||||
return $checked;
|
||||
}
|
||||
|
||||
|
||||
|
||||
25
website/agenda/planung/comment.cgi
Normal file → Executable file
25
website/agenda/planung/comment.cgi
Normal file → Executable file
@@ -15,12 +15,14 @@ use template;
|
||||
use db;
|
||||
use auth;
|
||||
use uac;
|
||||
|
||||
#use roles;
|
||||
use time;
|
||||
use markup;
|
||||
use project;
|
||||
use studios;
|
||||
use comments;
|
||||
|
||||
#use events;
|
||||
#use series;
|
||||
#use series_dates;
|
||||
@@ -38,14 +40,19 @@ my $debug = $config->{system}->{debug};
|
||||
my ( $user, $expires ) = auth::get_user( $cgi, $config );
|
||||
return if ( ( !defined $user ) || ( $user eq '' ) );
|
||||
|
||||
my $user_presets=uac::get_user_presets($config, {
|
||||
my $user_presets = uac::get_user_presets(
|
||||
$config,
|
||||
{
|
||||
user => $user,
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id}
|
||||
});
|
||||
}
|
||||
);
|
||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||
$params->{studio_id}=$params->{default_studio_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{project_id}=$user_presets->{project_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{studio_id} = $params->{default_studio_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
$params->{project_id} = $user_presets->{project_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
|
||||
my $request = {
|
||||
url => $ENV{QUERY_STRING} || '',
|
||||
@@ -60,6 +67,7 @@ $request = uac::prepare_request($request, $user_presets);
|
||||
log::init($request);
|
||||
|
||||
$params = $request->{params}->{checked};
|
||||
|
||||
#print Dumper($params);
|
||||
#show header
|
||||
if ( ( params::isJson() ) || ( defined $params->{action} ) ) {
|
||||
@@ -91,7 +99,6 @@ if (defined $params->{action}){
|
||||
$config->{access}->{write} = 0;
|
||||
showComments( $config, $request );
|
||||
|
||||
|
||||
sub showComments {
|
||||
my $config = shift;
|
||||
my $request = shift;
|
||||
@@ -158,6 +165,7 @@ sub showComments{
|
||||
$template_parameters->{controllers} = $config->{controllers};
|
||||
$template_parameters->{allow} = $permissions;
|
||||
$template_parameters->{loc} = localization::get( $config, { user => $params->{presets}->{user}, file => 'comment' } );
|
||||
|
||||
#fill and output template
|
||||
template::process( 'print', $params->{template}, $template_parameters );
|
||||
}
|
||||
@@ -191,7 +199,7 @@ sub setLock{
|
||||
my $comment = $params->{comment};
|
||||
$comment->{id} = $comment->{comment_id};
|
||||
if ( $comment->{id} eq '' ) {
|
||||
return
|
||||
return;
|
||||
}
|
||||
|
||||
#todo change set_news_status to lock_status in comment module
|
||||
@@ -289,6 +297,7 @@ sub check_params{
|
||||
if ( $event_id =~ /^(\d+)$/ ) {
|
||||
$comment->{event_id} = $1;
|
||||
} else {
|
||||
|
||||
# error('invalid event_id');
|
||||
}
|
||||
$comment->{event_id} = '' unless defined $comment->{event_id};
|
||||
@@ -313,12 +322,10 @@ sub check_params{
|
||||
$search =~ s/\-\-//gi;
|
||||
$search =~ s/\;//gi;
|
||||
$checked->{search} = $search if $search ne '';
|
||||
};
|
||||
}
|
||||
$checked->{search} = '' unless defined $checked->{search};
|
||||
$checked->{comment} = $comment;
|
||||
|
||||
return $checked;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
38
website/agenda/planung/create_events.cgi
Normal file → Executable file
38
website/agenda/planung/create_events.cgi
Normal file → Executable file
@@ -6,15 +6,18 @@ use Data::Dumper;
|
||||
|
||||
use params;
|
||||
use config;
|
||||
|
||||
#use log;
|
||||
#use template;
|
||||
use auth;
|
||||
use uac;
|
||||
|
||||
#use roles;
|
||||
#use project;
|
||||
#use studios;
|
||||
#use events;
|
||||
use series;
|
||||
|
||||
#use series_schedule;
|
||||
#use series_events;
|
||||
#use series_dates;
|
||||
@@ -34,14 +37,20 @@ my ($user,$expires) = auth::get_user($cgi, $config);
|
||||
return if ( ( !defined $user ) || ( $user eq '' ) );
|
||||
|
||||
#print STDERR $params->{project_id}."\n";
|
||||
my $user_presets=uac::get_user_presets($config, {
|
||||
my $user_presets = uac::get_user_presets(
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
user => $user
|
||||
});
|
||||
}
|
||||
);
|
||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||
$params->{studio_id} = $params->{default_studio_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{project_id} = $user_presets->{project_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{studio_id} = $params->{default_studio_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
$params->{project_id} = $user_presets->{project_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
|
||||
#print STDERR $params->{project_id}."\n";
|
||||
my $request = {
|
||||
url => $ENV{QUERY_STRING} || '',
|
||||
@@ -75,8 +84,10 @@ unless ($permissions->{create_event_from_schedule}==1){
|
||||
}
|
||||
|
||||
if ( defined $params->{action} ) {
|
||||
|
||||
# assign_series ($config, $request) if ($params->{action} eq 'assign_series');
|
||||
}
|
||||
|
||||
#print Dumper($params);
|
||||
show_events( $config, $request );
|
||||
|
||||
@@ -123,10 +134,8 @@ sub show_events{
|
||||
next;
|
||||
}
|
||||
}
|
||||
print "found schedule without event for $date"
|
||||
." - "
|
||||
. $schedule->{series_name}." - ".$schedule->{title}
|
||||
. "\n";
|
||||
print "found schedule without event for $date" . " - " . $schedule->{series_name} . " - " . $schedule->{title} . "\n";
|
||||
|
||||
#createEvent($config, $request, $schedule);
|
||||
}
|
||||
}
|
||||
@@ -228,16 +237,21 @@ sub getSeriesEvents{
|
||||
permissions => $request->{permissions}
|
||||
};
|
||||
$request2->{params}->{checked}->{published} = 'all';
|
||||
delete $request2->{params}->{checked}->{exclude_locations} if (($params->{studio_id}==-1)&&(defined $request2->{params}->{checked}->{exclude_locations}));
|
||||
delete $request2->{params}->{checked}->{exclude_locations}
|
||||
if ( ( $params->{studio_id} == -1 ) && ( defined $request2->{params}->{checked}->{exclude_locations} ) );
|
||||
|
||||
my $events = events::get( $config, $request2 );
|
||||
|
||||
#print STDERR Dumper($request2->{params}->{checked});
|
||||
#print STDERR Dumper($events);
|
||||
series::add_series_ids_to_events( $request->{config}, $events );
|
||||
|
||||
my $studios=studios::get($request->{config},{
|
||||
my $studios = studios::get(
|
||||
$request->{config},
|
||||
{
|
||||
project_id => $options->{project_id}
|
||||
});
|
||||
}
|
||||
);
|
||||
my $studio_id_by_location = {};
|
||||
for my $studio (@$studios) {
|
||||
$studio_id_by_location->{ $studio->{location} } = $studio->{id};
|
||||
@@ -250,6 +264,7 @@ sub getSeriesEvents{
|
||||
|
||||
return $events;
|
||||
}
|
||||
|
||||
sub check_params {
|
||||
my $params = shift;
|
||||
|
||||
@@ -292,7 +307,6 @@ sub check_params{
|
||||
return $checked;
|
||||
}
|
||||
|
||||
|
||||
__DATA__
|
||||
|
||||
https://piradio.de/agenda/planung/create_events.cgi?project_id=1&studio_id=1&from_date=2016-09-01&till_date=2016-10-01
|
||||
|
||||
@@ -14,7 +14,6 @@ body #content{
|
||||
max-width:980px;
|
||||
color:#000;
|
||||
background:#fff;
|
||||
line-height:100%;
|
||||
text-align:left;
|
||||
}
|
||||
|
||||
@@ -31,10 +30,9 @@ body,
|
||||
font-family:sans-serif;
|
||||
}
|
||||
|
||||
#content input,
|
||||
#content textarea{
|
||||
border:1px solid #ccc;
|
||||
padding:6px;
|
||||
border:1px solid #ccc;
|
||||
}
|
||||
|
||||
@media handheld{
|
||||
@@ -98,6 +96,10 @@ body,
|
||||
background:#888;
|
||||
}
|
||||
|
||||
#calcms_admin_menu div {
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
#calcms_admin_menu select,
|
||||
#calcms_admin_menu option{
|
||||
font-size:0.8rem;
|
||||
@@ -321,6 +323,8 @@ tr.tablesorter-filter-row input{
|
||||
}
|
||||
|
||||
/*colors*/
|
||||
#content input[type="submit"],
|
||||
#content input[type="file"],
|
||||
#content button,
|
||||
#content .ui-state-active,
|
||||
#content a.ui-button:active,
|
||||
@@ -328,13 +332,16 @@ tr.tablesorter-filter-row input{
|
||||
background-color:#2196f3;
|
||||
}
|
||||
|
||||
#content input[type="submit"]:hover,
|
||||
#content input[type="file"]:hover,
|
||||
#content button:hover,
|
||||
#content .ui-button.ui-state-active:hover{
|
||||
background-color:#39a1f4;
|
||||
}
|
||||
|
||||
/*colors end */
|
||||
|
||||
#content input[type="submit"],
|
||||
#content input[type="file"],
|
||||
#content button{
|
||||
border:none;
|
||||
color:#fff;
|
||||
@@ -347,6 +354,8 @@ tr.tablesorter-filter-row input{
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
#content input[type="submit"],
|
||||
#content input[type="file"],
|
||||
#content button{
|
||||
box-shadow:0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12);
|
||||
position:relative;
|
||||
@@ -356,11 +365,15 @@ tr.tablesorter-filter-row input{
|
||||
border:0
|
||||
}
|
||||
|
||||
#content input[type="submit"]:hover,
|
||||
#content input[type="file"]:hover,
|
||||
#content button:focus{
|
||||
outline:0;
|
||||
transition:all 0.5s cubic-bezier(.64,.09,.08,1)
|
||||
}
|
||||
|
||||
#content input[type="submit"]:hover,
|
||||
#content input[type="file"]:hover,
|
||||
#content button:hover{
|
||||
box-shadow:0 5px 11px 0 rgba(0,0,0,.18),0 4px 15px 0 rgba(0,0,0,.15);
|
||||
}
|
||||
@@ -377,7 +390,7 @@ tr.tablesorter-filter-row input{
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#content input:focus{
|
||||
#content input[type="text"]:focus{
|
||||
border-bottom:2px solid #03a9f4;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
img{
|
||||
margin-right :1em;
|
||||
margin-bottom :1em;
|
||||
vertical-align:middle
|
||||
}
|
||||
|
||||
@@ -11,3 +12,10 @@ h2 {
|
||||
line-height:1.5em;
|
||||
}
|
||||
|
||||
.thin{
|
||||
font-weight:100;
|
||||
}
|
||||
|
||||
th{
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
@@ -19,10 +19,8 @@ button:hover{
|
||||
#content{
|
||||
top:0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#content #calendar_weekdays,
|
||||
#content #calendar_weekdays table,
|
||||
#content #calendar{
|
||||
@@ -66,7 +64,6 @@ button:hover{
|
||||
#calendar table td{
|
||||
word-wrap:break-word;
|
||||
hyphens:auto;
|
||||
/*word-break:break-all;*/
|
||||
}
|
||||
|
||||
#calendar div.text{
|
||||
@@ -98,9 +95,6 @@ button:hover{
|
||||
padding-left:0;
|
||||
padding-top:0;
|
||||
padding-bottom:0;
|
||||
/*
|
||||
// padding-right:16px;
|
||||
*/
|
||||
}
|
||||
|
||||
#calendar div.event div.icons{
|
||||
@@ -108,21 +102,8 @@ button:hover{
|
||||
top:-5px;
|
||||
right:-7px;
|
||||
width:16px;
|
||||
image-rendering: optimizeSpeed; /* FUCK SMOOTHING, GIVE ME SPEED */
|
||||
image-rendering: -moz-crisp-edges; /* Firefox */
|
||||
image-rendering: -o-crisp-edges; /* Opera */
|
||||
image-rendering: -webkit-optimize-contrast; /* Chrome (and eventually Safari) */
|
||||
image-rendering: optimize-contrast; /* CSS3 Proposed */
|
||||
-ms-interpolation-mode: nearest-neighbor; /* IE8+ */
|
||||
}
|
||||
|
||||
/*
|
||||
#calendar div.event,
|
||||
#calendar div.schedule{
|
||||
border-bottom:1px solid black;
|
||||
}
|
||||
*/
|
||||
|
||||
#calendar div.time.now {
|
||||
padding:0;
|
||||
margin:0;
|
||||
@@ -185,7 +166,6 @@ button:hover{
|
||||
border:0;
|
||||
border-bottom:1px solid #666;
|
||||
border-top:1px solid #666;
|
||||
/*border:1px solid black;*/
|
||||
}
|
||||
|
||||
#calendar div.time,
|
||||
@@ -230,14 +210,8 @@ button:hover{
|
||||
z-index:1;
|
||||
margin-left:0px;
|
||||
background:white;
|
||||
/*
|
||||
// margin-right:15px;
|
||||
*/
|
||||
}
|
||||
|
||||
#event_list tr{
|
||||
/*border-bottom:1px solid #999;*/
|
||||
}
|
||||
#event_list tr th:hover{
|
||||
cursor:pointer;
|
||||
}
|
||||
@@ -342,12 +316,6 @@ input.tablesorter-filter{
|
||||
|
||||
/* calendar colors */
|
||||
|
||||
/*
|
||||
#content .grid{
|
||||
border:1px dashed #ccc;
|
||||
}
|
||||
*/
|
||||
|
||||
#content div.event.no_series{
|
||||
color:#000;
|
||||
}
|
||||
@@ -421,6 +389,11 @@ div#toolbar input.search{
|
||||
padding-bottom:6px;
|
||||
}
|
||||
|
||||
#content #toolbar div#selectDate:hover{
|
||||
padding-top:0;
|
||||
padding-bottom:0;
|
||||
}
|
||||
|
||||
#content #toolbar div#current_date{
|
||||
cursor:pointer;
|
||||
font-size:1.5em;
|
||||
@@ -444,11 +417,9 @@ div#toolbar input.search{
|
||||
padding:6px;
|
||||
}
|
||||
|
||||
|
||||
#calendar td div.play {
|
||||
transition: min-height 0.1s;
|
||||
transition: min-width 0.1s;
|
||||
transition-delay: 0.7s;
|
||||
#calendar div {
|
||||
transition: all 0.1s;
|
||||
transition-delay: 0s;
|
||||
}
|
||||
|
||||
#calendar td div.play:hover {
|
||||
@@ -516,16 +487,19 @@ div.rms_detail div.text{
|
||||
|
||||
div.event .ok,
|
||||
div.play .ok{
|
||||
display:inline;
|
||||
background:#4caf50;
|
||||
}
|
||||
|
||||
div.event .warn,
|
||||
div.play .warn{
|
||||
display:inline;
|
||||
background:#ffeb3b;
|
||||
}
|
||||
|
||||
div.event .error,
|
||||
div.play .error{
|
||||
display:inline;
|
||||
background:#f44336;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ use warnings "all";
|
||||
use strict;
|
||||
use Data::Dumper;
|
||||
use HTML::Template;
|
||||
|
||||
#use URI::Escape;
|
||||
#use Encode;
|
||||
|
||||
@@ -15,7 +16,6 @@ use config;
|
||||
use auth;
|
||||
use localization;
|
||||
use studios;
|
||||
|
||||
binmode STDOUT, ":utf8";
|
||||
my $r = shift;
|
||||
( my $cgi, my $params, my $error ) = params::get($r);
|
||||
@@ -31,6 +31,7 @@ my $request={
|
||||
params => {
|
||||
original => $params,
|
||||
checked => $params
|
||||
|
||||
# checked => check_params($params),
|
||||
},
|
||||
};
|
||||
@@ -77,7 +78,8 @@ if ($cgi->param('log')eq'app'){
|
||||
$log =~ s/\\n/<br>/gi;
|
||||
} else {
|
||||
$log =~ s/</\</gi;
|
||||
$log=~s/\\n/<\/pre><pre> /gi;
|
||||
$log =~
|
||||
s/\\n/<\/pre><pre> /gi;
|
||||
}
|
||||
|
||||
#output content
|
||||
|
||||
218
website/agenda/planung/event.cgi
Normal file → Executable file
218
website/agenda/planung/event.cgi
Normal file → Executable file
@@ -15,6 +15,7 @@ use template;
|
||||
use db;
|
||||
use auth;
|
||||
use uac;
|
||||
|
||||
#use roles;
|
||||
use time;
|
||||
use markup;
|
||||
@@ -38,14 +39,19 @@ my $debug = $config->{system}->{debug};
|
||||
my ( $user, $expires ) = auth::get_user( $cgi, $config );
|
||||
return if ( ( !defined $user ) || ( $user eq '' ) );
|
||||
|
||||
my $user_presets=uac::get_user_presets($config, {
|
||||
my $user_presets = uac::get_user_presets(
|
||||
$config,
|
||||
{
|
||||
user => $user,
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id}
|
||||
});
|
||||
}
|
||||
);
|
||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||
$params->{studio_id}=$params->{default_studio_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{project_id}=$user_presets->{project_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{studio_id} = $params->{default_studio_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
$params->{project_id} = $user_presets->{project_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
|
||||
my $request = {
|
||||
url => $ENV{QUERY_STRING} || '',
|
||||
@@ -54,6 +60,7 @@ my $request={
|
||||
checked => check_params($params),
|
||||
},
|
||||
};
|
||||
|
||||
#print STDERR Dumper($request)."\n";
|
||||
|
||||
#set user at params->presets->user
|
||||
@@ -77,31 +84,29 @@ print q{
|
||||
} unless (params::isJson);
|
||||
|
||||
if ( defined $params->{action} ) {
|
||||
if (
|
||||
($params->{action} eq 'show_new_event')
|
||||
|| ($params->{action} eq 'show_new_event_from_schedule')
|
||||
){
|
||||
if ( ( $params->{action} eq 'show_new_event' )
|
||||
|| ( $params->{action} eq 'show_new_event_from_schedule' ) )
|
||||
{
|
||||
show_new_event( $config, $request );
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
if (
|
||||
($params->{action} eq 'create_event')
|
||||
|| ($params->{action} eq 'create_event_from_schedule')
|
||||
){
|
||||
if ( ( $params->{action} eq 'create_event' )
|
||||
|| ( $params->{action} eq 'create_event_from_schedule' ) )
|
||||
{
|
||||
$params->{event_id} = create_event( $config, $request );
|
||||
unless ( defined $params->{event_id} ) {
|
||||
uac::print_error("failed");
|
||||
return;
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
if ( $params->{action} eq 'get_json' ) {
|
||||
getJson( $config, $request );
|
||||
return;
|
||||
}
|
||||
if ($params->{action} eq 'delete') {delete_event($config, $request)};
|
||||
if ($params->{action} eq 'save') {save_event( $config, $request)};
|
||||
if ($params->{action} eq 'download') {download( $config, $request)};
|
||||
if ( $params->{action} eq 'delete' ) { delete_event( $config, $request ) }
|
||||
if ( $params->{action} eq 'save' ) { save_event( $config, $request ) }
|
||||
if ( $params->{action} eq 'download' ) { download( $config, $request ) }
|
||||
}
|
||||
$config->{access}->{write} = 0;
|
||||
show_event( $config, $request );
|
||||
@@ -122,7 +127,8 @@ sub show_event{
|
||||
}
|
||||
|
||||
my $result = series_events::check_permission(
|
||||
$request, {
|
||||
$request,
|
||||
{
|
||||
permission => 'update_event_of_series,update_event_of_others',
|
||||
check_for => [ 'studio', 'user', 'series', 'events' ],
|
||||
project_id => $params->{project_id},
|
||||
@@ -137,6 +143,7 @@ sub show_event{
|
||||
}
|
||||
$permissions->{update_event} = 1;
|
||||
print STDERR "check series permission ok\n";
|
||||
|
||||
#TODO: move to JS
|
||||
my @durations = ();
|
||||
for my $duration ( @{ time::get_durations() } ) {
|
||||
@@ -147,12 +154,15 @@ sub show_event{
|
||||
push @durations, $entry;
|
||||
}
|
||||
|
||||
my $event=series::get_event($config, {
|
||||
my $event = series::get_event(
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
series_id => $params->{series_id},
|
||||
event_id => $params->{event_id}
|
||||
});
|
||||
}
|
||||
);
|
||||
unless ( defined $event ) {
|
||||
uac::print_error("event not found");
|
||||
}
|
||||
@@ -161,28 +171,40 @@ sub show_event{
|
||||
if ( ( defined $permissions->{update_event_after_week} ) && ( $permissions->{update_event_after_week} eq '1' ) ) {
|
||||
$editLock = 0;
|
||||
} else {
|
||||
$editLock=0 if (series::is_event_older_than_days(
|
||||
$config, {
|
||||
$editLock = 0
|
||||
if (
|
||||
series::is_event_older_than_days(
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
series_id => $params->{series_id},
|
||||
event_id => $params->{event_id},
|
||||
max_age => 14
|
||||
}
|
||||
)==0);
|
||||
) == 0
|
||||
);
|
||||
}
|
||||
|
||||
# for rerun, deprecated
|
||||
if ( defined $params->{source_event_id} ) {
|
||||
my $event2=series::get_event($config, {
|
||||
my $event2 = series::get_event(
|
||||
$config,
|
||||
{
|
||||
allow_any => 1,
|
||||
|
||||
#project_id => $params->{project_id},
|
||||
#studio_id => $params->{studio_id},
|
||||
#series_id => $params->{series_id},
|
||||
event_id => $params->{source_event_id}
|
||||
});
|
||||
}
|
||||
);
|
||||
if ( defined $event2 ) {
|
||||
for my $attr ('title', 'user_title', 'excerpt', 'user_excerpt', 'content', 'topic', 'image', 'live no_event_sync', 'podcast_url', 'archive_url'){
|
||||
for my $attr (
|
||||
'title', 'user_title', 'excerpt', 'user_excerpt', 'content', 'topic',
|
||||
'image', 'live no_event_sync', 'podcast_url', 'archive_url'
|
||||
)
|
||||
{
|
||||
$event->{$attr} = $event2->{$attr};
|
||||
}
|
||||
$event->{recurrence} = eventOps::getRecurrenceBaseId($event2);
|
||||
@@ -229,7 +251,8 @@ sub show_event{
|
||||
|
||||
# get event series
|
||||
my $series = series::get(
|
||||
$config,{
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
series_id => $params->{series_id}
|
||||
@@ -242,13 +265,15 @@ sub show_event{
|
||||
#$event->{rerun}=1 if ((defined $event->{rerun})&&($event->{rerun}ne'0')&&($event->{rerun}ne''));
|
||||
|
||||
my $users = series::get_users(
|
||||
$config,{
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
series_id => $params->{series_id}
|
||||
}
|
||||
);
|
||||
$params->{series_users} = $users;
|
||||
|
||||
#print STDERR Dumper($users);
|
||||
$params->{series_users_email_list} = join( ',', ( map { $_->{email} } (@$users) ) );
|
||||
$params->{series_user_names} = join( ' und ', ( map { ( split( /\s+/, $_->{full_name} ) )[0] } (@$users) ) );
|
||||
@@ -296,7 +321,8 @@ sub getJson{
|
||||
}
|
||||
|
||||
my $result = series_events::check_permission(
|
||||
$request, {
|
||||
$request,
|
||||
{
|
||||
permission => 'update_event_of_series,update_event_of_others',
|
||||
check_for => [ 'studio', 'user', 'series', 'events' ],
|
||||
project_id => $params->{project_id},
|
||||
@@ -311,12 +337,15 @@ sub getJson{
|
||||
}
|
||||
$permissions->{update_event} = 1;
|
||||
|
||||
my $event=series::get_event($config, {
|
||||
my $event = series::get_event(
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
series_id => $params->{series_id},
|
||||
event_id => $params->{event_id}
|
||||
});
|
||||
}
|
||||
);
|
||||
unless ( defined $event ) {
|
||||
uac::print_error("event not found");
|
||||
}
|
||||
@@ -328,7 +357,8 @@ sub getJson{
|
||||
|
||||
# get event series
|
||||
my $series = series::get(
|
||||
$config,{
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
series_id => $params->{series_id}
|
||||
@@ -351,6 +381,7 @@ sub getJson{
|
||||
if ( $params->{get_rerun} == 1 ) {
|
||||
$event->{rerun} = 1;
|
||||
$event->{recurrence} = eventOps::getRecurrenceBaseId($event);
|
||||
|
||||
#$event=events::calc_dates($config, $event);
|
||||
}
|
||||
|
||||
@@ -358,7 +389,6 @@ sub getJson{
|
||||
template::process( 'print', 'json-p', $event );
|
||||
}
|
||||
|
||||
|
||||
#show new event from schedule
|
||||
sub show_new_event {
|
||||
my $config = shift;
|
||||
@@ -405,8 +435,8 @@ sub show_new_event{
|
||||
eventOps::setAttributesForCurrentTime( $serie, $event );
|
||||
}
|
||||
|
||||
|
||||
if ( defined $params->{source_event_id} ) {
|
||||
|
||||
#overwrite by existing event (rerun)
|
||||
eventOps::setAttributesFromOtherEvent( $config, $params, $event );
|
||||
}
|
||||
@@ -421,7 +451,8 @@ sub show_new_event{
|
||||
|
||||
#get next episode
|
||||
$event->{episode} = series::get_next_episode(
|
||||
$config, {
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
series_id => $params->{series_id},
|
||||
@@ -433,7 +464,6 @@ sub show_new_event{
|
||||
$event->{published} = 1;
|
||||
$event->{new_event} = 1;
|
||||
|
||||
|
||||
#copy event to template params
|
||||
for my $key ( keys %$event ) {
|
||||
$params->{$key} = $event->{$key};
|
||||
@@ -466,11 +496,10 @@ sub show_new_event{
|
||||
|
||||
$params->{loc} = localization::get( $config, { user => $params->{presets}->{user}, file => 'event,comment' } );
|
||||
template::process( 'print', template::check('edit_event'), $params );
|
||||
|
||||
#print '<pre>'.Dumper($params).'</pre>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub delete_event {
|
||||
my $config = shift;
|
||||
my $request = shift;
|
||||
@@ -488,7 +517,8 @@ sub delete_event{
|
||||
}
|
||||
|
||||
my $result = series_events::check_permission(
|
||||
$request, {
|
||||
$request,
|
||||
{
|
||||
permission => 'delete_event',
|
||||
check_for => [ 'studio', 'user', 'series', 'events', 'event_age' ],
|
||||
project_id => $params->{project_id},
|
||||
@@ -512,12 +542,16 @@ sub delete_event{
|
||||
return undef;
|
||||
}
|
||||
|
||||
user_stats::increase($config, 'delete_events', {
|
||||
user_stats::increase(
|
||||
$config,
|
||||
'delete_events',
|
||||
{
|
||||
project_id => $event->{project_id},
|
||||
studio_id => $event->{studio_id},
|
||||
series_id => $event->{series_id},
|
||||
user => $event->{user}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
uac::print_info("event deleted");
|
||||
}
|
||||
@@ -538,8 +572,7 @@ sub save_event{
|
||||
}
|
||||
|
||||
#print Dumper($params);
|
||||
my $start = $params->{start_date},
|
||||
my $end = time::add_minutes_to_datetime($params->{start_date}, $params->{duration});
|
||||
my $start = $params->{start_date}, my $end = time::add_minutes_to_datetime( $params->{start_date}, $params->{duration} );
|
||||
|
||||
#check permissions
|
||||
my $options = {
|
||||
@@ -553,20 +586,17 @@ sub save_event{
|
||||
end => $end,
|
||||
};
|
||||
|
||||
my $result=series_events::check_permission(
|
||||
$request, $options
|
||||
);
|
||||
my $result = series_events::check_permission( $request, $options );
|
||||
unless ( $result eq '1' ) {
|
||||
uac::print_error($result);
|
||||
return;
|
||||
}
|
||||
|
||||
#changed columns depending on permissions
|
||||
my $entry={
|
||||
id => $params->{event_id}
|
||||
};
|
||||
my $entry = { id => $params->{event_id} };
|
||||
|
||||
my $found = 0;
|
||||
|
||||
#content fields
|
||||
for my $key ( 'content', 'topic', 'title', 'excerpt', 'episode', 'image', 'podcast_url', 'archive_url' ) {
|
||||
next unless defined $permissions->{ 'update_event_field_' . $key };
|
||||
@@ -584,6 +614,7 @@ sub save_event{
|
||||
$found++;
|
||||
}
|
||||
}
|
||||
|
||||
#status field
|
||||
for my $key ( 'live', 'published', 'playout', 'archived', 'rerun', 'disable_event_sync' ) {
|
||||
next unless defined $permissions->{ 'update_event_status_' . $key };
|
||||
@@ -596,12 +627,15 @@ sub save_event{
|
||||
$entry->{modified_by} = $params->{presets}->{user};
|
||||
|
||||
#get event from database (for history)
|
||||
my $event=series::get_event($config, {
|
||||
my $event = series::get_event(
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
series_id => $params->{series_id},
|
||||
event_id => $params->{event_id}
|
||||
});
|
||||
}
|
||||
);
|
||||
unless ( defined $event ) {
|
||||
uac::print_error("event not found");
|
||||
return;
|
||||
@@ -623,6 +657,7 @@ sub save_event{
|
||||
id => $params->{event_id},
|
||||
start_date => $params->{start_date},
|
||||
duration => $params->{duration},
|
||||
|
||||
# end => $params->{end_date} ,
|
||||
};
|
||||
$entry = series_events::save_event_time( $config, $entry );
|
||||
@@ -643,12 +678,17 @@ sub save_event{
|
||||
#update history
|
||||
event_history::insert( $config, $event );
|
||||
|
||||
user_stats::increase($config, 'update_events', {
|
||||
user_stats::increase(
|
||||
$config,
|
||||
'update_events',
|
||||
{
|
||||
project_id => $event->{project_id},
|
||||
studio_id => $event->{studio_id},
|
||||
series_id => $event->{series_id},
|
||||
user => $event->{user}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
#print "error" unless (defined $result);
|
||||
$config->{access}->{write} = 0;
|
||||
uac::print_info("event saved");
|
||||
@@ -666,11 +706,11 @@ sub create_event{
|
||||
push @$checklist, 'schedule' if $params->{action} eq 'create_event_from_schedule';
|
||||
}
|
||||
|
||||
my $start = $params->{start_date},
|
||||
my $end = time::add_minutes_to_datetime($params->{start_date}, $params->{duration});
|
||||
my $start = $params->{start_date}, my $end = time::add_minutes_to_datetime( $params->{start_date}, $params->{duration} );
|
||||
|
||||
my $result = series_events::check_permission(
|
||||
$request, {
|
||||
$request,
|
||||
{
|
||||
permission => 'create_event,create_event_of_series',
|
||||
check_for => $checklist,
|
||||
project_id => $params->{project_id},
|
||||
@@ -681,6 +721,7 @@ sub create_event{
|
||||
end => $end
|
||||
}
|
||||
);
|
||||
|
||||
#print Dumper(" start_date => $params->{start_date}");
|
||||
unless ( $result eq '1' ) {
|
||||
uac::print_error($result);
|
||||
@@ -689,7 +730,8 @@ sub create_event{
|
||||
|
||||
#get series name from series
|
||||
my $series = series::get(
|
||||
$config,{
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
series_id => $params->{series_id},
|
||||
@@ -702,10 +744,13 @@ sub create_event{
|
||||
my $serie = $series->[0];
|
||||
|
||||
#get studio location from studios
|
||||
my $studios=studios::get($config, {
|
||||
my $studios = studios::get(
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id}
|
||||
});
|
||||
}
|
||||
);
|
||||
unless ( defined $studios ) {
|
||||
uac::print_error("studio not found");
|
||||
return undef;
|
||||
@@ -720,7 +765,8 @@ sub create_event{
|
||||
|
||||
#insert event content and save history
|
||||
my $event_id = series_events::insert_event(
|
||||
$config,{
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio => $studio,
|
||||
serie => $serie,
|
||||
@@ -732,7 +778,8 @@ sub create_event{
|
||||
|
||||
#assign event to series
|
||||
$result = series::assign_event(
|
||||
$config, {
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
series_id => $params->{series_id},
|
||||
@@ -747,12 +794,16 @@ sub create_event{
|
||||
series::update_recurring_events( $config, $event );
|
||||
|
||||
# update user stats
|
||||
user_stats::increase($config, 'create_events', {
|
||||
user_stats::increase(
|
||||
$config,
|
||||
'create_events',
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
series_id => $params->{series_id},
|
||||
user => $params->{presets}->{user}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
#forward to edit event
|
||||
#print STDERR Dumper($event_id);
|
||||
@@ -770,7 +821,8 @@ sub download{
|
||||
my $permissions = $request->{permissions};
|
||||
|
||||
my $result = series_events::check_permission(
|
||||
$request, {
|
||||
$request,
|
||||
{
|
||||
permission => 'update_event_of_series,update_event_of_others',
|
||||
check_for => [ 'studio', 'user', 'series', 'events' ],
|
||||
project_id => $params->{project_id},
|
||||
@@ -787,7 +839,8 @@ sub download{
|
||||
|
||||
my $request2 = {
|
||||
params => {
|
||||
checked=>events::check_params($config,
|
||||
checked => events::check_params(
|
||||
$config,
|
||||
{
|
||||
event_id => $params->{event_id},
|
||||
template => 'no',
|
||||
@@ -815,6 +868,7 @@ sub download{
|
||||
print STDERR "archive_url: " . $archive_url . "\n";
|
||||
print STDERR "event.cgi::download look for : $archive_dir/$datetime*.mp3\n";
|
||||
my @files = glob( $archive_dir . '/' . $datetime . '*.mp3' );
|
||||
|
||||
#print STDERR Dumper(\@files);
|
||||
if ( @files > 0 ) {
|
||||
my $file = $files[0];
|
||||
@@ -827,17 +881,20 @@ sub download{
|
||||
|
||||
my $cmd = "ln -s '" . $file . "' '" . $archive_dir . '/' . $key . ".mp3'";
|
||||
my $url = $archive_url . '/' . $key . '.mp3';
|
||||
|
||||
#print $cmd."\n";
|
||||
print `$cmd`;
|
||||
|
||||
$request->{params}->{checked}->{download} =
|
||||
"Hallo,\n\n".
|
||||
"anbei der Mitschnitt fuer\n"
|
||||
.$event->{start_date_name}.", ".$event->{start_time_name}." - ".$event->{series_name}.' - '.$event->{title}.":\n"
|
||||
"Hallo,\n\n"
|
||||
. "anbei der Mitschnitt fuer\n"
|
||||
. $event->{start_date_name} . ", "
|
||||
. $event->{start_time_name} . " - "
|
||||
. $event->{series_name} . ' - '
|
||||
. $event->{title} . ":\n"
|
||||
. $url . "\n"
|
||||
. "\nDer Link wird nach 7 Tagen geloescht. (bitte nicht weitergeben)\n"
|
||||
."Gruss, Peter\n"
|
||||
;
|
||||
. "Gruss, Peter\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -855,7 +912,8 @@ sub check_params{
|
||||
$checked->{debug} = $debug;
|
||||
|
||||
#numeric values
|
||||
for my $param ('id', 'project_id', 'studio_id', 'default_studio_id', 'user_id', 'series_id', 'event_id', 'source_event_id', 'episode'){
|
||||
for my $param ( 'id', 'project_id', 'studio_id', 'default_studio_id', 'user_id', 'series_id', 'event_id', 'source_event_id', 'episode' )
|
||||
{
|
||||
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /^\d+$/ ) ) {
|
||||
$checked->{$param} = $params->{$param};
|
||||
}
|
||||
@@ -867,7 +925,6 @@ sub check_params{
|
||||
$checked->{studio_id} = -1;
|
||||
}
|
||||
|
||||
|
||||
#scalars
|
||||
for my $param ( 'studio', 'search', 'from', 'till', 'hide_series' ) {
|
||||
if ( defined $params->{$param} ) {
|
||||
@@ -893,10 +950,12 @@ sub check_params{
|
||||
|
||||
#strings
|
||||
for my $param (
|
||||
'series_name', 'title', 'excerpt', 'content', 'topic', 'program', 'category', 'image', 'user_content',
|
||||
'user_title', 'user_excerpt', 'podcast_url', 'archive_url'
|
||||
){
|
||||
'series_name', 'title', 'excerpt', 'content', 'topic', 'program', 'category', 'image',
|
||||
'user_content', 'user_title', 'user_excerpt', 'podcast_url', 'archive_url'
|
||||
)
|
||||
{
|
||||
if ( defined $params->{$param} ) {
|
||||
|
||||
#$checked->{$param}=uri_unescape();
|
||||
$checked->{$param} = $params->{$param};
|
||||
$checked->{$param} =~ s/^\s+//g;
|
||||
@@ -914,16 +973,17 @@ sub check_params{
|
||||
#actions and roles
|
||||
$checked->{action} = '';
|
||||
if ( defined $params->{action} ) {
|
||||
if ($params->{action}=~/^(save|delete|download|show_new_event|show_new_event_from_schedule|create_event|create_event_from_schedule|get_json)$/){
|
||||
if ( $params->{action} =~
|
||||
/^(save|delete|download|show_new_event|show_new_event_from_schedule|create_event|create_event_from_schedule|get_json)$/ )
|
||||
{
|
||||
$checked->{action} = $params->{action};
|
||||
}
|
||||
}
|
||||
|
||||
#print STDERR Dumper($checked);
|
||||
return $checked;
|
||||
}
|
||||
|
||||
|
||||
|
||||
__DATA__
|
||||
|
||||
#requires studio_id,series_id,location
|
||||
|
||||
13
website/agenda/planung/event_history.cgi
Normal file → Executable file
13
website/agenda/planung/event_history.cgi
Normal file → Executable file
@@ -6,6 +6,7 @@ use URI::Escape;
|
||||
use Encode;
|
||||
use Data::Dumper;
|
||||
use MIME::Base64;
|
||||
|
||||
#use Text::Diff ();
|
||||
use Text::Diff::FormattedHTML;
|
||||
|
||||
@@ -16,12 +17,14 @@ use template;
|
||||
use db;
|
||||
use auth;
|
||||
use uac;
|
||||
|
||||
#use roles;
|
||||
use time;
|
||||
use markup;
|
||||
use studios;
|
||||
use event_history;
|
||||
use events;
|
||||
|
||||
#use series;
|
||||
#use series_dates;
|
||||
use series_events;
|
||||
@@ -38,7 +41,8 @@ return if ((!defined $user) || ($user eq ''));
|
||||
|
||||
my $user_presets = uac::get_user_presets( $config, { user => $user, studio_id => $params->{studio_id} } );
|
||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||
$params->{studio_id}=$params->{default_studio_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{studio_id} = $params->{default_studio_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
|
||||
my $request = {
|
||||
url => $ENV{QUERY_STRING} || '',
|
||||
@@ -47,6 +51,7 @@ my $request={
|
||||
checked => check_params($params),
|
||||
},
|
||||
};
|
||||
|
||||
#print STDERR Dumper($request)."\n";
|
||||
|
||||
#set user at params->presets->user
|
||||
@@ -102,6 +107,7 @@ sub show_history{
|
||||
$options->{event_id} = $params->{event_id} if defined $params->{event_id};
|
||||
|
||||
my $events = event_history::get( $config, $options );
|
||||
|
||||
#print STDERR Dumper($events);
|
||||
return unless defined $events;
|
||||
$params->{events} = $events;
|
||||
@@ -173,9 +179,11 @@ sub compare{
|
||||
#print '<pre>';
|
||||
#my $diff=diff_strings( { vertical => 1 }, $t1, $t2);
|
||||
my $diff = diff_strings( {}, $t1, $t2 );
|
||||
|
||||
#print Text::Diff::diff(\$t1, \$t2, { STYLE => "Table" });
|
||||
#print Text::Diff::diff($v1, $v2, { STYLE => "Table" });
|
||||
print $diff;
|
||||
|
||||
#print '</pre>';
|
||||
}
|
||||
|
||||
@@ -187,6 +195,7 @@ sub eventToText{
|
||||
$s .= $event->{user_excerpt} . "\n";
|
||||
$s .= $event->{topic} . "\n";
|
||||
$s .= $event->{content} . "\n";
|
||||
|
||||
#print STDERR "DUMP\n$s";
|
||||
return $s;
|
||||
|
||||
@@ -225,8 +234,8 @@ sub check_params{
|
||||
$checked->{action} = $params->{action};
|
||||
}
|
||||
}
|
||||
|
||||
#print STDERR Dumper($checked);
|
||||
return $checked;
|
||||
}
|
||||
|
||||
|
||||
|
||||
14
website/agenda/planung/help.cgi
Normal file → Executable file
14
website/agenda/planung/help.cgi
Normal file → Executable file
@@ -27,14 +27,19 @@ my $debug = $config->{system}->{debug};
|
||||
my ( $user, $expires ) = auth::get_user( $cgi, $config );
|
||||
return if ( ( !defined $user ) || ( $user eq '' ) );
|
||||
|
||||
my $user_presets=uac::get_user_presets($config, {
|
||||
my $user_presets = uac::get_user_presets(
|
||||
$config,
|
||||
{
|
||||
user => $user,
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id}
|
||||
});
|
||||
}
|
||||
);
|
||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||
$params->{studio_id}=$params->{default_studio_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{project_id}=$user_presets->{project_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{studio_id} = $params->{default_studio_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
$params->{project_id} = $user_presets->{project_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
|
||||
my $request = {
|
||||
url => $ENV{QUERY_STRING} || '',
|
||||
@@ -609,7 +614,6 @@ There are following status fields:
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
sub check_params {
|
||||
|
||||
51
website/agenda/planung/image.cgi
Normal file → Executable file
51
website/agenda/planung/image.cgi
Normal file → Executable file
@@ -36,14 +36,19 @@ my $debug = $config->{system}->{debug};
|
||||
my ( $user, $expires ) = auth::get_user( $cgi, $config );
|
||||
return if ( ( !defined $user ) || ( $user eq '' ) );
|
||||
|
||||
my $user_presets=uac::get_user_presets($config, {
|
||||
my $user_presets = uac::get_user_presets(
|
||||
$config,
|
||||
{
|
||||
user => $user,
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id}
|
||||
});
|
||||
}
|
||||
);
|
||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||
$params->{studio_id}=$params->{default_studio_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{project_id}=$user_presets->{project_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{studio_id} = $params->{default_studio_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
$params->{project_id} = $user_presets->{project_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
|
||||
my $request = {
|
||||
url => $ENV{QUERY_STRING} || '',
|
||||
@@ -65,9 +70,11 @@ return unless defined uac::check($config, $params, $user_presets);
|
||||
#my $base_dir = $config->{locations}->{base_dir};
|
||||
my $local_media_dir = $config->{locations}->{local_media_dir};
|
||||
my $local_media_url = $config->{locations}->{local_media_url};
|
||||
|
||||
#my $local_base_url = $config->{locations}->{local_base_url};
|
||||
|
||||
log::error( $config, 'cannot locate media dir' . $local_media_dir ) unless ( -e $local_media_dir );
|
||||
|
||||
#continue on error
|
||||
uac::permissions_denied('reading from local media dir') unless ( -r $local_media_dir );
|
||||
uac::permissions_denied('writing to local media dir') unless ( -w $local_media_dir );
|
||||
@@ -99,7 +106,6 @@ sub show_image{
|
||||
return undef;
|
||||
}
|
||||
|
||||
|
||||
if ( $permissions->{read_image} ne '1' ) {
|
||||
uac::permissions_denied("read image");
|
||||
return 0;
|
||||
@@ -119,6 +125,7 @@ sub show_image{
|
||||
for my $image (@$seriesImages) {
|
||||
my $filename = $image->{filename};
|
||||
unless ( defined $filenames->{$filename} ) {
|
||||
|
||||
#print STDERR "add1 $filename\n";
|
||||
push @$results, $image;
|
||||
$filenames->{$filename} = $image;
|
||||
@@ -137,6 +144,7 @@ sub show_image{
|
||||
for my $image (@$searchImages) {
|
||||
my $filename = $image->{filename};
|
||||
unless ( defined $filenames->{$filename} ) {
|
||||
|
||||
#print STDERR "add2 $filename\n";
|
||||
push @$results, $image;
|
||||
$filenames->{$filename} = $image;
|
||||
@@ -153,6 +161,7 @@ sub show_image{
|
||||
if ( defined $filenames->{$selectedFilename} ) {
|
||||
$selectedImage = $filenames->{$selectedFilename};
|
||||
} else {
|
||||
|
||||
#now add filename and remove search
|
||||
$params->{filename} = $selectedFilename;
|
||||
delete $params->{search};
|
||||
@@ -203,9 +212,12 @@ sub show_image{
|
||||
# print STDERR
|
||||
$template_params->{loc} = localization::get( $config, { user => $params->{presets}->{user}, file => 'image' } );
|
||||
$template_params = uac::set_template_permissions( $permissions, $template_params );
|
||||
|
||||
#set global values for update and delete, per image values are evaluated later
|
||||
$template_params->{allow}->{update_image}=$template_params->{allow}->{update_image_own}||$template_params->{allow}->{seriesupdate_image_others};
|
||||
$template_params->{allow}->{delete_image}=$template_params->{allow}->{delete_image_own}||$template_params->{allow}->{delete_image_others};
|
||||
$template_params->{allow}->{update_image} =
|
||||
$template_params->{allow}->{update_image_own} || $template_params->{allow}->{seriesupdate_image_others};
|
||||
$template_params->{allow}->{delete_image} =
|
||||
$template_params->{allow}->{delete_image_own} || $template_params->{allow}->{delete_image_others};
|
||||
template::process( 'print', $params->{template}, $template_params );
|
||||
}
|
||||
|
||||
@@ -250,11 +262,15 @@ sub save_image{
|
||||
my $dbh = db::connect($config);
|
||||
|
||||
#print STDERR "going to save\n";
|
||||
my $entries=images::get($config,{
|
||||
my $entries = images::get(
|
||||
$config,
|
||||
{
|
||||
filename => $image->{filename},
|
||||
project_id => $image->{project_id},
|
||||
studio_id => $image->{studio_id}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
#print STDERR Dumper($entries);
|
||||
if ( scalar @$entries > 1 ) {
|
||||
print_js_error('more than one matching result found');
|
||||
@@ -286,6 +302,7 @@ sub delete_image{
|
||||
uac::permissions_denied('delete image');
|
||||
return 0;
|
||||
}
|
||||
|
||||
#print $cgi->header();
|
||||
#print "Content-type:text/html; charset=UTF-8;\n\n";
|
||||
|
||||
@@ -303,6 +320,7 @@ sub delete_image{
|
||||
my $action_result = '';
|
||||
my $errors = '';
|
||||
$result = images::delete_files( $config, $local_media_dir, $params->{delete_image}, $action_result, $errors );
|
||||
|
||||
#use Data::Dumper;print STDERR "delete\n".Dumper($params);
|
||||
print "deleted<br />$action_result<br />$errors\n";
|
||||
}
|
||||
@@ -322,11 +340,15 @@ sub check_permission{
|
||||
return 1;
|
||||
} elsif ( $permissions->{ $permission . '_own' } eq '1' ) {
|
||||
print STDERR "$user has update_image_own\n";
|
||||
|
||||
#check if image was created by user
|
||||
my $results=images::get($config,{
|
||||
my $results = images::get(
|
||||
$config,
|
||||
{
|
||||
filename => $filename,
|
||||
created_by => $user
|
||||
});
|
||||
}
|
||||
);
|
||||
return 1 if ( @$results == 1 );
|
||||
return 0;
|
||||
}
|
||||
@@ -361,13 +383,10 @@ sub modify_results{
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
sub check_params {
|
||||
my $params = shift;
|
||||
|
||||
my $checked={
|
||||
template => template::check($params->{template},'image.html')
|
||||
};
|
||||
my $checked = { template => template::check( $params->{template}, 'image.html' ) };
|
||||
|
||||
#numeric values
|
||||
$checked->{limit} = 100;
|
||||
@@ -423,5 +442,3 @@ sub check_params{
|
||||
return $checked;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ our $debug = $config->{system}->{debug};
|
||||
my $base_dir = $config->{locations}->{base_dir};
|
||||
my $tmp_dir = '/var/tmp';
|
||||
my $upload_limit = 2048 * 1000;
|
||||
|
||||
#binmode STDOUT, ":utf8";
|
||||
#binmode STDOUT, ":encoding(UTF-8)";
|
||||
|
||||
@@ -40,6 +41,7 @@ my $error = '';
|
||||
|
||||
#get image from multiform before anything else
|
||||
if ( defined $r ) {
|
||||
|
||||
#Apache2::Request
|
||||
# print "Content-type:text/html; charset=UTF-8; \n\n<br><br><br>Apache2::Request<br>\n";
|
||||
my $apr = Apache2::Request->new( $r, POST_MAX => $upload_limit, TEMP_DIR => $tmp_dir );
|
||||
@@ -48,14 +50,17 @@ if (defined $r){
|
||||
my $body = $apr->body();
|
||||
if ( defined $body ) {
|
||||
for my $key ( keys %$body ) {
|
||||
|
||||
# print "$key=".$apr->param($key)."<br>\n";
|
||||
$params->{ scalar($key) } = scalar( $apr->param($key) ); # unless ($key eq'image');
|
||||
}
|
||||
}
|
||||
|
||||
# print Dumper($params);
|
||||
|
||||
# print Dumper($apr);
|
||||
my $status = $apr->parse;
|
||||
|
||||
# print "Status:$status<br>";
|
||||
$status = '' if ( $status =~ /missing input data/i );
|
||||
if ( $status =~ /limit/i ) {
|
||||
@@ -68,10 +73,12 @@ if (defined $r){
|
||||
# $CGI::POST_MAX = $upload_limit;
|
||||
# $CGI::TMPDIRECTORY=$tmp_dir;
|
||||
$cgi = new CGI();
|
||||
|
||||
# my %params=$cgi->Vars();
|
||||
# $params=\%params;
|
||||
# $error=$cgi->cgi_error()||$error;
|
||||
} else {
|
||||
|
||||
#CGI fallback
|
||||
# print "Content-type:text/html; charset=UTF-8; \n\n<br><br><br>CGI<br>\n";
|
||||
$CGI::POST_MAX = $upload_limit;
|
||||
@@ -85,14 +92,19 @@ print "Content-type:text/html; charset=UTF-8;\n\n";
|
||||
my ( $user, $expires ) = auth::get_user( $cgi, $config );
|
||||
return if ( ( !defined $user ) || ( $user eq '' ) );
|
||||
|
||||
my $user_presets=uac::get_user_presets($config, {
|
||||
my $user_presets = uac::get_user_presets(
|
||||
$config,
|
||||
{
|
||||
user => $user,
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id}
|
||||
});
|
||||
}
|
||||
);
|
||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||
$params->{studio_id}=$params->{default_studio_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{project_id}=$user_presets->{project_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{studio_id} = $params->{default_studio_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
$params->{project_id} = $user_presets->{project_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
|
||||
my $request = {
|
||||
url => $ENV{QUERY_STRING} || '',
|
||||
@@ -118,8 +130,7 @@ if($permissions->{create_image} ne '1'){
|
||||
my $file_info = undef;
|
||||
if ( $error ne '' ) {
|
||||
if ( $error =~ /limit/ ) {
|
||||
$params->{error}.="Image size is limited to ".int($upload_limit/1000000)." MB!"
|
||||
. "Please make it smaller and try again!";
|
||||
$params->{error} .= "Image size is limited to " . int( $upload_limit / 1000000 ) . " MB!" . "Please make it smaller and try again!";
|
||||
} else {
|
||||
$params->{error} .= "Error:'$error'";
|
||||
}
|
||||
@@ -182,6 +193,7 @@ sub upload_file{
|
||||
my $data;
|
||||
my $content = '';
|
||||
print STDERR $file . "\n";
|
||||
|
||||
#unless (-e $file){}
|
||||
binmode $file;
|
||||
while ( read $file, $data, 1024 ) {
|
||||
@@ -246,6 +258,7 @@ sub get_filename{
|
||||
my $upload = shift;
|
||||
|
||||
if ( defined $upload ) {
|
||||
|
||||
# try apache2 module
|
||||
my $filename = $upload->filename();
|
||||
return {
|
||||
@@ -277,9 +290,7 @@ sub get_filename{
|
||||
}
|
||||
|
||||
#error
|
||||
return {
|
||||
error=>'Could not detect file name!'
|
||||
};
|
||||
return { error => 'Could not detect file name!' };
|
||||
}
|
||||
|
||||
sub check_filename {
|
||||
@@ -289,18 +300,14 @@ sub check_filename{
|
||||
if ( $filename =~ /\.([a-zA-Z]{3,5})$/ ) {
|
||||
my $extension = lc $1;
|
||||
unless ( grep( /$extension/, @valid_extensions ) ) {
|
||||
return {
|
||||
error => 'Following file formats are supported: '.join(",",@valid_extensions).'!'
|
||||
};
|
||||
return { error => 'Following file formats are supported: ' . join( ",", @valid_extensions ) . '!' };
|
||||
}
|
||||
return {
|
||||
extension => $extension,
|
||||
error => ''
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
error => 'Not matching file extension found! Supported are: '.join(",",@valid_extensions).'!'
|
||||
};
|
||||
return { error => 'Not matching file extension found! Supported are: ' . join( ",", @valid_extensions ) . '!' };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,7 +337,7 @@ sub process_image{
|
||||
if ( ( $x == 0 ) || ( $y == 0 ) ) {
|
||||
return { error => 'Could not read image!' };
|
||||
log::error( $config, 'Cannot read image $filename!' );
|
||||
};
|
||||
}
|
||||
|
||||
#set max size image
|
||||
if ( $x > 0 && $y > 0 ) {
|
||||
@@ -395,7 +402,6 @@ sub check_params{
|
||||
$checked->{studio_id} = -1;
|
||||
}
|
||||
|
||||
|
||||
#string
|
||||
for my $param ( 'debug', 'name', 'description' ) {
|
||||
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /^\s*(.+?)\s*$/ ) ) {
|
||||
@@ -412,4 +418,3 @@ sub check_params{
|
||||
return $checked;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,13 +4,123 @@ function showProgress(){
|
||||
return false;
|
||||
}
|
||||
|
||||
function hideProgress(){
|
||||
$('#progress').slideUp();
|
||||
return false;
|
||||
}
|
||||
|
||||
function playAudio(path){
|
||||
var url='../../agenda_files/recordings/'+path;
|
||||
var win = window.open(url, '_blank');
|
||||
}
|
||||
|
||||
function changeFile(fileInput){
|
||||
var file = fileInput.files[0];
|
||||
var size = file.size / (1000*1000);
|
||||
$('#uploadSize').html(size + " MB");
|
||||
if (size > 200){
|
||||
$('#uploadButton').hide();
|
||||
showError("file is too large. maximum size is 200 MB! Please use MP3, 192 kHz, CBR, 44100 Hz, 16bit");
|
||||
}else{
|
||||
$('#uploadButton').show();
|
||||
}
|
||||
}
|
||||
|
||||
function showError(error){
|
||||
$('#error').html(error);
|
||||
$('#error').show();
|
||||
}
|
||||
|
||||
function hideError(){
|
||||
$('#error').hide();
|
||||
}
|
||||
|
||||
function showFinished(){
|
||||
$('#info').html("upload finished");
|
||||
$('#info').show();
|
||||
}
|
||||
|
||||
function hideFinished(){
|
||||
$('#info').hide();
|
||||
}
|
||||
|
||||
function roundSize(size){
|
||||
var MB=1000*1000;
|
||||
return Math.round(size*10/MB)/10;
|
||||
}
|
||||
|
||||
function uploadFile(uploadButton){
|
||||
hideFinished();
|
||||
hideError();
|
||||
showProgress();
|
||||
$.ajax({
|
||||
url: 'audio_recordings.cgi',
|
||||
type: 'POST',
|
||||
data: new FormData($('#audio_recordings_upload')[0]),
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
xhr: function() {
|
||||
var start = new Date();
|
||||
var myXhr = $.ajaxSettings.xhr();
|
||||
if (myXhr.upload) {
|
||||
myXhr.upload.addEventListener(
|
||||
'progress',
|
||||
function(data) {
|
||||
if (data.lengthComputable) {
|
||||
var loaded=roundSize(data.loaded);
|
||||
var total=roundSize(data.total);
|
||||
$('#progressBar').attr("value", loaded);
|
||||
$('#progressBar').attr("max", total);
|
||||
var duration=(new Date().getTime() - start.getTime()) / 1000 ;
|
||||
var bitrate = loaded / duration;
|
||||
var remaining = Math.round(100 * bitrate * ( total - loaded) );
|
||||
var content = loaded + " of " + total + " MB<br>";
|
||||
content += '<div class="thin">';
|
||||
content += "finished in " + remaining + " seconds<br>";
|
||||
content += "took " + Math.round(duration) + " seconds<br>";
|
||||
content += '</div>'
|
||||
$('#progressLabel').html(content);
|
||||
}
|
||||
} ,
|
||||
false
|
||||
);
|
||||
}
|
||||
return myXhr;
|
||||
},
|
||||
}).error(
|
||||
function(jqXHR, textStatus, errorThrown ){
|
||||
showError("error: "+errorThrown);
|
||||
hideProgress();
|
||||
hideFinished();
|
||||
}
|
||||
).done(
|
||||
function(data){
|
||||
showFinished();
|
||||
hideProgress();
|
||||
hideError();
|
||||
//setTimeout(function() { location.reload() }, 1000);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$( document ).ready(
|
||||
function() {
|
||||
$('#file').on( 'change',
|
||||
function(){
|
||||
changeFile( this );
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
$('#uploadButton').on( 'click',
|
||||
function(){
|
||||
uploadFile( this );
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
var number = 1+Math.floor(11 * Math.random());
|
||||
$('#progress img').attr("src", "/agenda/image/upload/bird"+number+".gif");
|
||||
}
|
||||
|
||||
@@ -589,7 +589,7 @@ function deleteFromPlayout(id, projectId, studioId, start){
|
||||
url+='&project_id='+escape(projectId);
|
||||
url+='&studio_id='+escape(studioId);
|
||||
url+='&start_date='+escape(start);
|
||||
|
||||
//console.log(url);
|
||||
$('#'+id).dialog({
|
||||
width:940,
|
||||
height:440,
|
||||
|
||||
@@ -61,10 +61,10 @@ function isNewToHistory(url){
|
||||
var ignore=0;
|
||||
//provide back to series from series details
|
||||
if(contains(url,'series')){
|
||||
console.log(url);
|
||||
console.log(history[0]);
|
||||
//console.log(url);
|
||||
//console.log(history[0]);
|
||||
if( (contains(url,'series_id')==true) && (contains(history[0],'series_id')==false)) ignore=1;
|
||||
console.log(ignore);
|
||||
//console.log(ignore);
|
||||
}
|
||||
if (ignore==0) history.shift();
|
||||
}
|
||||
|
||||
10
website/agenda/planung/localization.cgi
Normal file → Executable file
10
website/agenda/planung/localization.cgi
Normal file → Executable file
@@ -13,13 +13,11 @@ use localization;
|
||||
|
||||
binmode STDOUT, ":utf8";
|
||||
|
||||
|
||||
my $r = shift;
|
||||
( my $cgi, my $params, my $error ) = params::get($r);
|
||||
|
||||
my $config = config::get('../config/config.cgi');
|
||||
my $debug = $config->{system}->{debug};
|
||||
|
||||
my ( $user, $expires ) = auth::get_user( $cgi, $config );
|
||||
return if ( $user eq '' );
|
||||
|
||||
@@ -36,23 +34,21 @@ my $header="Content-type:application/json; charset=UTF-8;\n\n";
|
||||
$loc->{usecase} = $params->{usecase};
|
||||
my $json = to_json( $loc, { pretty => 1 } );
|
||||
my @json_lines = ();
|
||||
|
||||
for my $line ( split /\n/, $json ) {
|
||||
push @json_lines, "'" . $line . "'\n";
|
||||
}
|
||||
|
||||
$json = $header . $json;
|
||||
|
||||
# .'var loc_text='.join('+',@json_lines).";\n"
|
||||
# .'var loc = JQuery.parseJSON(loc_text)';
|
||||
;
|
||||
print $json;
|
||||
|
||||
|
||||
sub check_params {
|
||||
my $params = shift;
|
||||
|
||||
my $checked={
|
||||
usecase => ''
|
||||
};
|
||||
my $checked = { usecase => '' };
|
||||
|
||||
if ( defined $params->{usecase} ) {
|
||||
if ( $params->{usecase} =~ /^([a-z\-\_\,]+)$/ ) {
|
||||
|
||||
31
website/agenda/planung/notify_events.cgi
Normal file → Executable file
31
website/agenda/planung/notify_events.cgi
Normal file → Executable file
@@ -5,6 +5,7 @@ use strict;
|
||||
use URI::Escape;
|
||||
use Encode;
|
||||
use Data::Dumper;
|
||||
|
||||
#use Text::Diff::FormattedHTML;
|
||||
use MIME::Lite;
|
||||
|
||||
@@ -15,13 +16,16 @@ use template;
|
||||
use db;
|
||||
use auth;
|
||||
use uac;
|
||||
|
||||
#use roles;
|
||||
use time;
|
||||
use markup;
|
||||
use studios;
|
||||
|
||||
#use event_history;
|
||||
#use events;
|
||||
use series;
|
||||
|
||||
#use series_dates;
|
||||
#use series_events;
|
||||
use localization;
|
||||
@@ -35,14 +39,19 @@ my $debug = $config->{system}->{debug};
|
||||
my ( $user, $expires ) = auth::get_user( $cgi, $config );
|
||||
return if ( ( !defined $user ) || ( $user eq '' ) );
|
||||
|
||||
my $user_presets=uac::get_user_presets($config, {
|
||||
my $user_presets = uac::get_user_presets(
|
||||
$config,
|
||||
{
|
||||
user => $user,
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id}
|
||||
});
|
||||
}
|
||||
);
|
||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||
$params->{studio_id}=$params->{default_studio_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{project_id}=$user_presets->{project_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{studio_id} = $params->{default_studio_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
$params->{project_id} = $user_presets->{project_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
|
||||
my $request = {
|
||||
url => $ENV{QUERY_STRING} || '',
|
||||
@@ -51,6 +60,7 @@ my $request={
|
||||
checked => check_params($params),
|
||||
},
|
||||
};
|
||||
|
||||
#print STDERR Dumper($request)."\n";
|
||||
|
||||
#set user at params->presets->user
|
||||
@@ -60,7 +70,7 @@ log::init($request);
|
||||
$params = $request->{params}->{checked};
|
||||
|
||||
#show header
|
||||
unless(params::isJson()){
|
||||
unless ( params::isJson() || ( $params->{template}=~/\.txt/ ) ) {
|
||||
my $headerParams = uac::set_template_permissions( $request->{permissions}, $params );
|
||||
$headerParams->{loc} = localization::get( $config, { user => $user, file => 'menu' } );
|
||||
template::process( 'print', template::check('default.html'), $headerParams );
|
||||
@@ -104,6 +114,7 @@ sub show_events{
|
||||
};
|
||||
|
||||
my $events = series::get_events( $config, $options );
|
||||
|
||||
# get series_users
|
||||
for my $event (@$events) {
|
||||
my $mail = getMail( $config, $request, $event );
|
||||
@@ -119,7 +130,8 @@ sub show_events{
|
||||
}
|
||||
|
||||
$params->{loc} = localization::get( $config, { user => $params->{presets}->{user}, file => 'notify_events' } );
|
||||
template::process('print', template::check('notify_events'), $params);
|
||||
template::process( 'print', $params->{template}, $params );
|
||||
|
||||
}
|
||||
|
||||
sub sendMail {
|
||||
@@ -181,7 +193,8 @@ sub getMail{
|
||||
my $event = shift;
|
||||
|
||||
my $users = series::get_users(
|
||||
$config,{
|
||||
$config,
|
||||
{
|
||||
project_id => $event->{project_id},
|
||||
studio_id => $event->{studio_id},
|
||||
series_id => $event->{series_id}
|
||||
@@ -197,7 +210,7 @@ sub getMail{
|
||||
if ( scalar(@$userMails) == 0 ) {
|
||||
$event->{noRecipient} = 1;
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
my $mail = {
|
||||
'From' => 'programm@radiopiloten.de',
|
||||
@@ -223,6 +236,7 @@ sub eventToText{
|
||||
$s .= $event->{user_excerpt} . "\n";
|
||||
$s .= $event->{topic} . "\n";
|
||||
$s .= $event->{content} . "\n";
|
||||
|
||||
#print STDERR "DUMP\n$s";
|
||||
return $s;
|
||||
|
||||
@@ -271,4 +285,3 @@ sub check_params{
|
||||
return $checked;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,10 @@ use warnings "all";
|
||||
use strict;
|
||||
use Data::Dumper;
|
||||
|
||||
use URI::Escape;
|
||||
use Encode;
|
||||
use localization;
|
||||
|
||||
use params;
|
||||
use config;
|
||||
use log;
|
||||
@@ -19,9 +23,7 @@ use series_schedule;
|
||||
use series_events;
|
||||
use series_dates;
|
||||
use markup;
|
||||
use URI::Escape;
|
||||
use Encode;
|
||||
use localization;
|
||||
use playout;
|
||||
|
||||
binmode STDOUT, ":utf8";
|
||||
|
||||
@@ -36,15 +38,21 @@ return if ((!defined $user) || ($user eq ''));
|
||||
print "Content-type:text/html; charset=UTF-8;\n\n";
|
||||
|
||||
#print STDERR $params->{project_id}."\n";
|
||||
my $user_presets=uac::get_user_presets($config, {
|
||||
my $user_presets = uac::get_user_presets(
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
user => $user
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||
$params->{studio_id} = $params->{default_studio_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{project_id} = $user_presets->{project_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{studio_id} = $params->{default_studio_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
$params->{project_id} = $user_presets->{project_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
|
||||
#print STDERR $params->{project_id}."\n";
|
||||
|
||||
my $request = {
|
||||
@@ -62,6 +70,7 @@ $params=$request->{params}->{checked};
|
||||
#process header
|
||||
my $headerParams = uac::set_template_permissions( $request->{permissions}, $params );
|
||||
$headerParams->{loc} = localization::get( $config, { user => $user, file => 'menu' } );
|
||||
|
||||
#template::process('print', template::check('default.html'), $headerParams);
|
||||
return unless uac::check( $config, $params, $user_presets ) == 1;
|
||||
|
||||
@@ -94,17 +103,18 @@ sub deleteFromPlayout{
|
||||
my $dbh = db::connect($config);
|
||||
|
||||
my $result = playout::delete(
|
||||
$config, $dbh, {
|
||||
$config, $dbh,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
start => $params->{start_date}
|
||||
});
|
||||
}
|
||||
);
|
||||
$config->{access}->{write} = 0;
|
||||
|
||||
print "result:$result\n";
|
||||
}
|
||||
|
||||
|
||||
sub check_params {
|
||||
my $params = shift;
|
||||
|
||||
@@ -139,7 +149,6 @@ sub check_params{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( defined $checked->{studio_id} ) {
|
||||
$checked->{default_studio_id} = $checked->{studio_id};
|
||||
} else {
|
||||
|
||||
@@ -40,6 +40,9 @@ msgstr "Studio"
|
||||
msgid "project"
|
||||
msgstr "Projekt"
|
||||
|
||||
msgid "playout"
|
||||
msgstr "Playout"
|
||||
|
||||
msgid "import"
|
||||
msgstr "Import"
|
||||
|
||||
|
||||
@@ -244,3 +244,6 @@ msgstr "Vorproduktion hochladen"
|
||||
msgid "label_delete_audio_recordings"
|
||||
msgstr "Vorproduktion löschen"
|
||||
|
||||
msgid "label_read_playout"
|
||||
msgstr "Playout anzeigen"
|
||||
|
||||
|
||||
@@ -40,6 +40,9 @@ msgstr "Studio"
|
||||
msgid "project"
|
||||
msgstr "Project"
|
||||
|
||||
msgid "playout"
|
||||
msgstr "Playout"
|
||||
|
||||
msgid "import"
|
||||
msgstr "Import"
|
||||
|
||||
|
||||
@@ -247,3 +247,6 @@ msgstr "upload audio recordings"
|
||||
msgid "label_delete_audio_recordings"
|
||||
msgstr "delete audio recordings"
|
||||
|
||||
msgid "label_read_playout"
|
||||
msgstr "show playout"
|
||||
|
||||
|
||||
28
website/agenda/planung/projects.cgi
Normal file → Executable file
28
website/agenda/planung/projects.cgi
Normal file → Executable file
@@ -25,14 +25,19 @@ my ($user,$expires) = auth::get_user($cgi, $config);
|
||||
return if ( $user eq '' );
|
||||
|
||||
my $permissions = roles::get_user_permissions();
|
||||
my $user_presets=uac::get_user_presets($config, {
|
||||
my $user_presets = uac::get_user_presets(
|
||||
$config,
|
||||
{
|
||||
user => $user,
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id}
|
||||
});
|
||||
}
|
||||
);
|
||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||
$params->{studio_id}=$params->{default_studio_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{project_id}=$user_presets->{project_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{studio_id} = $params->{default_studio_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
$params->{project_id} = $user_presets->{project_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
|
||||
my $request = {
|
||||
url => $ENV{QUERY_STRING} || '',
|
||||
@@ -165,10 +170,13 @@ sub assign_studio{
|
||||
}
|
||||
}
|
||||
$config->{access}->{write} = 1;
|
||||
project::assign_studio($config, {
|
||||
project::assign_studio(
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{pid},
|
||||
studio_id => $params->{sid}
|
||||
});
|
||||
}
|
||||
);
|
||||
$config->{access}->{write} = 0;
|
||||
uac::print_info("project assigned");
|
||||
|
||||
@@ -193,10 +201,13 @@ sub unassign_studio{
|
||||
}
|
||||
}
|
||||
$config->{access}->{write} = 1;
|
||||
project::unassign_studio($config, {
|
||||
project::unassign_studio(
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{pid},
|
||||
studio_id => $params->{sid}
|
||||
});
|
||||
}
|
||||
);
|
||||
$config->{access}->{write} = 0;
|
||||
uac::print_info("project unassigned");
|
||||
|
||||
@@ -220,6 +231,7 @@ sub show_projects{
|
||||
$projects = \@projects;
|
||||
|
||||
for my $project (@$projects) {
|
||||
|
||||
# get assigned studios
|
||||
my $project_studio_assignements = project::get_studio_assignments( $config, { project_id => $project->{project_id} } );
|
||||
$project->{pid} = $project->{project_id};
|
||||
|
||||
@@ -35,13 +35,17 @@ our $actions={
|
||||
delete => 8,
|
||||
};
|
||||
|
||||
my $user_presets=uac::get_user_presets($config, {
|
||||
my $user_presets = uac::get_user_presets(
|
||||
$config,
|
||||
{
|
||||
user => $user,
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id}
|
||||
});
|
||||
}
|
||||
);
|
||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||
$params->{studio_id} = $params->{default_studio_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{studio_id} = $params->{default_studio_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
$params->{project_id} = $user_presets->{project_id};
|
||||
|
||||
my $request = {
|
||||
@@ -55,6 +59,7 @@ $request = uac::prepare_request($request, $user_presets);
|
||||
log::init($request);
|
||||
|
||||
$params = $request->{params}->{checked};
|
||||
|
||||
#process header
|
||||
my $headerParams = uac::set_template_permissions( $request->{permissions}, $params );
|
||||
$headerParams->{loc} = localization::get( $config, { user => $user, file => 'menu' } );
|
||||
@@ -64,9 +69,11 @@ return unless uac::check($config, $params, $user_presets)==1;
|
||||
if ( defined $params->{action} ) {
|
||||
save_roles( $config, $request ) if ( $params->{action} eq 'save' );
|
||||
}
|
||||
|
||||
#show current roles
|
||||
$config->{access}->{write} = 0;
|
||||
show_roles( $config, $request );
|
||||
|
||||
#print '<pre>'.Dumper($request);
|
||||
return;
|
||||
|
||||
@@ -100,6 +107,7 @@ sub save_roles{
|
||||
}
|
||||
|
||||
my $columns = uac::get_role_columns($config);
|
||||
|
||||
#print '<pre>'.Dumper($columns).'</pre>';
|
||||
|
||||
#initialize all value ids (given by params matching to database columns)
|
||||
@@ -109,9 +117,10 @@ sub save_roles{
|
||||
my $column = $1;
|
||||
my $id = $2 || '';
|
||||
next unless defined $columns->{$column};
|
||||
$values->{$id}={} if(update_allowed($permissions, $role_by_id, $id))
|
||||
$values->{$id} = {} if ( update_allowed( $permissions, $role_by_id, $id ) );
|
||||
}
|
||||
}
|
||||
|
||||
#init checkbox values with 0
|
||||
for my $id ( keys %$values ) {
|
||||
if ( update_allowed( $permissions, $role_by_id, $id ) ) {
|
||||
@@ -140,6 +149,7 @@ sub save_roles{
|
||||
} elsif ( $column eq 'role' ) {
|
||||
$values->{$id}->{$column} = $value;
|
||||
} elsif ( $column eq 'id' || $column eq 'project_id' || $column eq 'studio_id' ) {
|
||||
|
||||
#id and studio id will be set later
|
||||
} else {
|
||||
$values->{$id}->{$column} = 1 if ( $value =~ /^\d+$/ );
|
||||
@@ -176,6 +186,7 @@ sub save_roles{
|
||||
$role_from_db = $role_by_name->{ $role->{role} } if defined $role_by_name->{ $role->{role} };
|
||||
|
||||
if ( $id eq '' ) {
|
||||
|
||||
#insert role
|
||||
next if ( $role->{role} eq '' );
|
||||
if ( defined $role_from_db ) {
|
||||
@@ -188,12 +199,15 @@ sub save_roles{
|
||||
uac::insert_role( $config, $role );
|
||||
$config->{access}->{write} = 0;
|
||||
} else {
|
||||
|
||||
#update role
|
||||
if ( ( defined $role_from_db ) && ( $id ne $role_from_db->{id} ) ) {
|
||||
uac::print_error('you cannot rename role to existing role!'." '$role->{role}' ($id) != '$role_from_db->{role}' ($role_from_db->{id})" );
|
||||
uac::print_error( 'you cannot rename role to existing role!'
|
||||
. " '$role->{role}' ($id) != '$role_from_db->{role}' ($role_from_db->{id})" );
|
||||
next;
|
||||
}
|
||||
print "update $role->{role}<br>\n";
|
||||
|
||||
#print '<div style="height:3em;overflow:auto;white-space:pre">'.Dumper($role).'</div>';
|
||||
$config->{access}->{write} = 1;
|
||||
uac::update_role( $config, $role );
|
||||
@@ -266,6 +280,7 @@ sub show_roles{
|
||||
};
|
||||
|
||||
if ( defined $permissions->{update_role} ) {
|
||||
|
||||
#add new user role button
|
||||
$out .= q{
|
||||
<button id="add_user_role_button" onclick="add_user_role();return false;">add user role</button>
|
||||
@@ -292,6 +307,7 @@ sub show_roles{
|
||||
}
|
||||
|
||||
for my $role (@$roles) {
|
||||
|
||||
#print Dumper($role);
|
||||
my $id = $role->{id} || '';
|
||||
my $value = $role->{role} || '';
|
||||
@@ -318,6 +334,7 @@ sub show_roles{
|
||||
|
||||
#add permission rows
|
||||
$columns = sort_columns($columns);
|
||||
|
||||
# print '<pre>';
|
||||
# for my $key (@$columns){
|
||||
# printf (" %-40s => '',\n", "'".$key."'");
|
||||
@@ -325,7 +342,14 @@ sub show_roles{
|
||||
# print '</pre>';
|
||||
|
||||
for my $key (@$columns) {
|
||||
next if ($key eq 'level'|| $key eq 'role' || $key eq 'id' || $key eq 'project_id'|| $key eq 'studio_id' ||$key eq 'modified_at' || $key eq 'created_at');
|
||||
next
|
||||
if ( $key eq 'level'
|
||||
|| $key eq 'role'
|
||||
|| $key eq 'id'
|
||||
|| $key eq 'project_id'
|
||||
|| $key eq 'studio_id'
|
||||
|| $key eq 'modified_at'
|
||||
|| $key eq 'created_at' );
|
||||
my $title = $key;
|
||||
$title =~ s/\_/ /g;
|
||||
my $description = $localization->{ 'label_' . $key } || $key;
|
||||
@@ -354,7 +378,6 @@ sub show_roles{
|
||||
print $out. "\n";
|
||||
}
|
||||
|
||||
|
||||
# sort columns by group and action
|
||||
sub sort_columns {
|
||||
my $columns = shift;
|
||||
@@ -365,11 +388,13 @@ sub sort_columns{
|
||||
my @words = split /_/, $column;
|
||||
my $action = shift @words;
|
||||
my $group = join( ' ', @words );
|
||||
|
||||
#print "action:'$action' group:'$group' <br>\n";
|
||||
|
||||
my $index = $groups->{$group} || 0;
|
||||
$index += $actions->{$action} if ( defined $actions->{$action} );
|
||||
$column_level->{$column} = $index;
|
||||
|
||||
# print $index."<br>";
|
||||
}
|
||||
|
||||
@@ -381,6 +406,7 @@ sub sort_columns{
|
||||
sub sort_groups {
|
||||
my $columns = shift;
|
||||
my $groups = {};
|
||||
|
||||
#extract groups
|
||||
for my $column ( keys %$columns ) {
|
||||
my @words = split /_/, $column;
|
||||
@@ -388,6 +414,7 @@ sub sort_groups{
|
||||
my $group = join( ' ', @words );
|
||||
$groups->{$group} = 1;
|
||||
}
|
||||
|
||||
#weigth groups
|
||||
my $i = 0;
|
||||
for my $group ( sort keys %$groups ) {
|
||||
@@ -433,7 +460,6 @@ sub check_params{
|
||||
$checked->{studio_id} = -1;
|
||||
}
|
||||
|
||||
|
||||
#permission fields
|
||||
for my $key ( keys %$params ) {
|
||||
$checked->{$key} = $params->{$key} if ( $key =~ /^[a-z_]+_\d*$/ );
|
||||
@@ -442,4 +468,3 @@ sub check_params{
|
||||
return $checked;
|
||||
}
|
||||
|
||||
|
||||
|
||||
23
website/agenda/planung/selectEvent.cgi
Normal file → Executable file
23
website/agenda/planung/selectEvent.cgi
Normal file → Executable file
@@ -10,11 +10,13 @@ use log;
|
||||
use template;
|
||||
use auth;
|
||||
use uac;
|
||||
|
||||
#use roles;
|
||||
#use project;
|
||||
#use studios;
|
||||
#use events;
|
||||
use series;
|
||||
|
||||
#use series_schedule;
|
||||
#use series_events;
|
||||
#use series_dates;
|
||||
@@ -33,14 +35,19 @@ my $debug = $config->{system}->{debug};
|
||||
my ( $user, $expires ) = auth::get_user( $cgi, $config );
|
||||
return if ( ( !defined $user ) || ( $user eq '' ) );
|
||||
|
||||
my $user_presets=uac::get_user_presets($config, {
|
||||
my $user_presets = uac::get_user_presets(
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
user => $user
|
||||
});
|
||||
}
|
||||
);
|
||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||
$params->{studio_id} = $params->{default_studio_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{project_id} = $user_presets->{project_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{studio_id} = $params->{default_studio_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
$params->{project_id} = $user_presets->{project_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
|
||||
my $request = {
|
||||
url => $ENV{QUERY_STRING} || '',
|
||||
@@ -109,12 +116,11 @@ sub show_events{
|
||||
# filter by year
|
||||
my $years = [];
|
||||
for my $year ( 2005 .. 2025 ) {
|
||||
my $date={
|
||||
year => $year
|
||||
};
|
||||
my $date = { year => $year };
|
||||
$date->{selected} = 1 if ( defined $params->{from_date} ) && ( $params->{from_date} eq $year . '-01-01' );
|
||||
push @$years, $date;
|
||||
}
|
||||
|
||||
#print Dumper($params->{loc});
|
||||
$params->{studios} = $user_studios;
|
||||
$params->{series} = $series;
|
||||
@@ -126,7 +132,6 @@ sub show_events{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
sub check_params {
|
||||
my $params = shift;
|
||||
|
||||
@@ -166,6 +171,7 @@ sub check_params{
|
||||
if ( ( defined $params->{year} ) && ( $params->{year} =~ /^\d\d\d\d$/ ) ) {
|
||||
$checked->{year} = $params->{year};
|
||||
}
|
||||
|
||||
# set defaults for project and studio id if not given
|
||||
$checked->{s_id} = $params->{studio_id} || '-1' unless defined $params->{s_id};
|
||||
$checked->{p_id} = $params->{project_id} || '-1' unless defined $params->{p_id};
|
||||
@@ -181,4 +187,3 @@ sub check_params{
|
||||
return $checked;
|
||||
}
|
||||
|
||||
|
||||
|
||||
15
website/agenda/planung/selectSeries.cgi
Normal file → Executable file
15
website/agenda/planung/selectSeries.cgi
Normal file → Executable file
@@ -23,14 +23,19 @@ my $debug = $config->{system}->{debug};
|
||||
my ( $user, $expires ) = auth::get_user( $cgi, $config );
|
||||
return if ( ( !defined $user ) || ( $user eq '' ) );
|
||||
|
||||
my $user_presets=uac::get_user_presets($config, {
|
||||
my $user_presets = uac::get_user_presets(
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
user => $user
|
||||
});
|
||||
}
|
||||
);
|
||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||
$params->{studio_id} = $params->{default_studio_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{project_id} = $user_presets->{project_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{studio_id} = $params->{default_studio_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
$params->{project_id} = $user_presets->{project_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
|
||||
my $request = {
|
||||
url => $ENV{QUERY_STRING} || '',
|
||||
@@ -104,7 +109,6 @@ sub show_series{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
sub check_params {
|
||||
my $params = shift;
|
||||
|
||||
@@ -150,4 +154,3 @@ sub check_params{
|
||||
return $checked;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -35,14 +35,20 @@ my ($user,$expires) = auth::get_user($cgi, $config);
|
||||
return if ( ( !defined $user ) || ( $user eq '' ) );
|
||||
|
||||
#print STDERR $params->{project_id}."\n";
|
||||
my $user_presets=uac::get_user_presets($config, {
|
||||
my $user_presets = uac::get_user_presets(
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
user => $user
|
||||
});
|
||||
}
|
||||
);
|
||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||
$params->{studio_id} = $params->{default_studio_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{project_id} = $user_presets->{project_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{studio_id} = $params->{default_studio_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
$params->{project_id} = $user_presets->{project_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
|
||||
#print STDERR $params->{project_id}."\n";
|
||||
my $request = {
|
||||
url => $ENV{QUERY_STRING} || '',
|
||||
@@ -80,6 +86,7 @@ if (defined $params->{action}){
|
||||
save_series( $config, $request ) if ( $params->{action} eq 'save' );
|
||||
save_series( $config, $request ) if ( $params->{action} eq 'create' );
|
||||
delete_series( $config, $request ) if ( $params->{action} eq 'delete' );
|
||||
|
||||
# scan_events ($config, $request) if ($params->{action} eq 'scan_events');
|
||||
assign_event( $config, $request ) if ( $params->{action} eq 'assign_event' );
|
||||
unassign_event( $config, $request ) if ( $params->{action} eq 'unassign_event' );
|
||||
@@ -87,10 +94,12 @@ if (defined $params->{action}){
|
||||
my $result = reassign_event( $config, $request );
|
||||
return if $result == 1;
|
||||
}
|
||||
|
||||
# save_scan ($config, $request) if ($params->{action} eq 'save_scan');
|
||||
}
|
||||
|
||||
$config->{access}->{write} = 0;
|
||||
|
||||
#print STDERR "show_series\n";
|
||||
|
||||
if ( defined $params->{series_id} ) {
|
||||
@@ -128,20 +137,18 @@ sub save_schedule{
|
||||
|
||||
my $entry = {};
|
||||
for my $attr (
|
||||
'project_id','studio_id', 'series_id', 'start',
|
||||
'duration', 'exclude' , 'period_type',
|
||||
'end', 'frequency',
|
||||
'weekday', 'week_of_month', 'month',
|
||||
'nextDay'
|
||||
){
|
||||
'project_id', 'studio_id', 'series_id', 'start', 'duration', 'exclude', 'period_type', 'end',
|
||||
'frequency', 'weekday', 'week_of_month', 'month', 'nextDay'
|
||||
)
|
||||
{
|
||||
$entry->{$attr} = $params->{$attr} if ( defined $params->{$attr} );
|
||||
}
|
||||
|
||||
#print STDERR Dumper($entry);
|
||||
unless ( project::is_series_assigned( $config, $entry ) == 1 ) {
|
||||
uac::print_error('series is not assigned to project!');
|
||||
return undef;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
my $found = 0;
|
||||
for my $type ( 'single', 'days', 'week_of_month' ) {
|
||||
@@ -169,9 +176,11 @@ sub save_schedule{
|
||||
uac::permissions_denied('delete_schedule');
|
||||
return;
|
||||
}
|
||||
|
||||
#get single schedules
|
||||
my $schedules = series_schedule::get(
|
||||
$config,{
|
||||
$config,
|
||||
{
|
||||
project_id => $entry->{project_id},
|
||||
studio_id => $entry->{studio_id},
|
||||
series_id => $entry->{series_id},
|
||||
@@ -196,11 +205,13 @@ sub save_schedule{
|
||||
if ( defined $params->{schedule_id} ) {
|
||||
$entry->{schedule_id} = $params->{schedule_id};
|
||||
series_schedule::update( $config, $entry );
|
||||
|
||||
#timeslots are checked inside
|
||||
my $updates = series_dates::update( $config, $entry );
|
||||
uac::print_info("schedule saved. $updates dates scheduled");
|
||||
} else {
|
||||
series_schedule::insert( $config, $entry );
|
||||
|
||||
#timeslots are checked inside
|
||||
my $updates = series_dates::update( $config, $entry );
|
||||
uac::print_info("schedule added. $updates dates added");
|
||||
@@ -208,7 +219,6 @@ sub save_schedule{
|
||||
$config->{access}->{write} = 0;
|
||||
}
|
||||
|
||||
|
||||
sub delete_schedule {
|
||||
my $config = shift;
|
||||
my $request = shift;
|
||||
@@ -233,7 +243,7 @@ sub delete_schedule{
|
||||
unless ( project::is_series_assigned( $config, $entry ) == 1 ) {
|
||||
uac::print_error('series is not assigned to project!');
|
||||
return undef;
|
||||
};
|
||||
}
|
||||
|
||||
$config->{access}->{write} = 1;
|
||||
$entry->{schedule_id} = $params->{schedule_id};
|
||||
@@ -267,7 +277,7 @@ sub delete_series{
|
||||
unless ( project::is_series_assigned( $config, $entry ) == 1 ) {
|
||||
uac::print_error('series is not assigned to project!');
|
||||
return undef;
|
||||
};
|
||||
}
|
||||
|
||||
my $project_id = $params->{project_id};
|
||||
my $studio_id = $params->{studio_id};
|
||||
@@ -278,12 +288,16 @@ sub delete_series{
|
||||
if ( $entry->{series_id} ne '' ) {
|
||||
my $result = series::delete( $config, $entry );
|
||||
|
||||
user_stats::increase($config, 'delete_series', {
|
||||
user_stats::increase(
|
||||
$config,
|
||||
'delete_series',
|
||||
{
|
||||
project_id => $entry->{project_id},
|
||||
studio_id => $entry->{studio_id},
|
||||
series_id => $entry->{series_id},
|
||||
user => $params->{presets}->{user}
|
||||
});
|
||||
}
|
||||
);
|
||||
$config->{access}->{write} = 0;
|
||||
unless ( $result == 1 ) {
|
||||
uac::print_error('could not delete series');
|
||||
@@ -337,12 +351,16 @@ sub save_series{
|
||||
}
|
||||
|
||||
#print STDERR Dumper($entry);
|
||||
my $series_ids=series::get($config,{
|
||||
my $series_ids = series::get(
|
||||
$config,
|
||||
{
|
||||
project_id => $entry->{project_id},
|
||||
studio_id => $entry->{studio_id},
|
||||
series_name => $entry->{series_name},
|
||||
title => $entry->{title}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
#print STDERR "done\n";
|
||||
#my @series_ids=@$series_ids;
|
||||
|
||||
@@ -355,7 +373,7 @@ sub save_series{
|
||||
if ( project::is_series_assigned( $config, $entry ) == 1 ) {
|
||||
uac::print_error('series is already assigned to project!');
|
||||
return undef;
|
||||
};
|
||||
}
|
||||
if ( scalar(@$series_ids) > 0 ) {
|
||||
uac::permissions_denied('insert, entry already exists');
|
||||
return;
|
||||
@@ -364,12 +382,16 @@ sub save_series{
|
||||
$config->{access}->{write} = 1;
|
||||
my $series_id = series::insert( $config, $entry );
|
||||
|
||||
user_stats::increase($config, 'create_series', {
|
||||
user_stats::increase(
|
||||
$config,
|
||||
'create_series',
|
||||
{
|
||||
project_id => $entry->{project_id},
|
||||
studio_id => $entry->{studio_id},
|
||||
series_id => $entry->{series_id},
|
||||
user => $params->{presets}->{user}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
$config->{access}->{write} = 0;
|
||||
|
||||
@@ -392,7 +414,7 @@ sub save_series{
|
||||
unless ( project::is_series_assigned( $config, $entry ) == 1 ) {
|
||||
uac::print_error('series is not assigned to project!');
|
||||
return undef;
|
||||
};
|
||||
}
|
||||
if ( scalar(@$series_ids) > 1 ) {
|
||||
uac::permissions_denied('update due to entry already exists');
|
||||
return;
|
||||
@@ -401,16 +423,21 @@ sub save_series{
|
||||
uac::permissions_denied('update due to series id does not match to existing entry');
|
||||
return;
|
||||
}
|
||||
|
||||
#print STDERR Dumper($entry);
|
||||
$config->{access}->{write} = 1;
|
||||
my $result = series::update( $config, $entry );
|
||||
|
||||
user_stats::increase($config, 'update_series', {
|
||||
user_stats::increase(
|
||||
$config,
|
||||
'update_series',
|
||||
{
|
||||
project_id => $entry->{project_id},
|
||||
studio_id => $entry->{studio_id},
|
||||
series_id => $entry->{series_id},
|
||||
user => $params->{presets}->{user}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
$config->{access}->{write} = 0;
|
||||
unless ( defined $result ) {
|
||||
@@ -445,10 +472,9 @@ sub save_scan{
|
||||
return;
|
||||
}
|
||||
}
|
||||
unless(
|
||||
($params->{assign_event_series_name}=~/\S/)
|
||||
||($params->{assign_event_title}=~/\S/)
|
||||
){
|
||||
unless ( ( $params->{assign_event_series_name} =~ /\S/ )
|
||||
|| ( $params->{assign_event_title} =~ /\S/ ) )
|
||||
{
|
||||
uac::permissions_denied("save. one of series name or title must be set");
|
||||
return;
|
||||
}
|
||||
@@ -458,6 +484,7 @@ sub save_scan{
|
||||
assign_event_series_name => $params->{assign_event_series_name},
|
||||
assign_event_title => $params->{assign_event_title},
|
||||
};
|
||||
|
||||
#print STDERR '<br>'.Dumper($entry)."\n";
|
||||
$config->{access}->{write} = 1;
|
||||
series::update( $config, $entry );
|
||||
@@ -478,10 +505,14 @@ sub scan_events{
|
||||
}
|
||||
|
||||
$config->{access}->{write} = 1;
|
||||
my $series=series::get($config, {
|
||||
my $series = series::get(
|
||||
$config,
|
||||
{
|
||||
'project_id' => $params->{project_id},
|
||||
'studio_id' => $params->{studio_id}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
#print STDERR Dumper($series);
|
||||
|
||||
$params->{scan_results} = q{
|
||||
@@ -494,10 +525,13 @@ sub scan_events{
|
||||
};
|
||||
|
||||
#list of all studios by id
|
||||
my $studios=studios::get($config, {
|
||||
my $studios = studios::get(
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id}
|
||||
});
|
||||
}
|
||||
);
|
||||
my $studio_by_id = {};
|
||||
for my $studio (@$studios) {
|
||||
$studio_by_id->{ $studio->{id} } = $studio;
|
||||
@@ -506,11 +540,13 @@ sub scan_events{
|
||||
my $location = $studio->{location};
|
||||
|
||||
for my $serie (@$series) {
|
||||
|
||||
#get matching events by series_name and title
|
||||
my $series_name = $serie->{assign_event_series_name};
|
||||
my $title = $serie->{assign_event_title};
|
||||
my $events=series::search_events($config,
|
||||
$request, {
|
||||
my $events = series::search_events(
|
||||
$config, $request,
|
||||
{
|
||||
series_name => $series_name,
|
||||
location => $location,
|
||||
title => $title,
|
||||
@@ -522,14 +558,18 @@ sub scan_events{
|
||||
my $event_ids = [];
|
||||
@$event_ids = map { $_->{event_id} } @$events;
|
||||
|
||||
$params->{scan_results}.= '<tr>'
|
||||
.'<td>'.$serie->{series_name}.' - '.$serie->{title}.'</td>'
|
||||
.'<td>'.$series_name.' - '.$title.'</td>'
|
||||
.'<td>'.scalar(@$event_ids).'</td>'
|
||||
.'</tr>'."\n";
|
||||
$params->{scan_results} .=
|
||||
'<tr>' . '<td>'
|
||||
. $serie->{series_name} . ' - '
|
||||
. $serie->{title} . '</td>' . '<td>'
|
||||
. $series_name . ' - '
|
||||
. $title . '</td>' . '<td>'
|
||||
. scalar(@$event_ids) . '</td>' . '</tr>' . "\n";
|
||||
|
||||
#if($serie->{series_id}==66){
|
||||
#print STDERR $serie->{series_name}.' - '.$serie->{title}.' '.Dumper($event_ids);
|
||||
series::set_event_ids( $config, $params->{project_id}, $params->{studio_id}, $serie, $event_ids );
|
||||
|
||||
#}
|
||||
}
|
||||
$params->{scan_results} .= "</table><hr>\n";
|
||||
@@ -563,7 +603,8 @@ sub assign_event{
|
||||
# TODO: check location of studio_id
|
||||
my $request2 = {
|
||||
params => {
|
||||
checked=>events::check_params($config,
|
||||
checked => events::check_params(
|
||||
$config,
|
||||
{
|
||||
event_id => $entry->{event_id},
|
||||
template => 'no',
|
||||
@@ -583,7 +624,8 @@ sub assign_event{
|
||||
|
||||
#is series assigned to studio
|
||||
my $result = series_events::check_permission(
|
||||
$request, {
|
||||
$request,
|
||||
{
|
||||
permission => 'assign_series_events',
|
||||
check_for => [ 'studio', 'user', 'series', 'studio_timeslots' ],
|
||||
project_id => $entry->{project_id},
|
||||
@@ -601,7 +643,8 @@ sub assign_event{
|
||||
|
||||
$config->{access}->{write} = 1;
|
||||
$result = series::assign_event(
|
||||
$config, {
|
||||
$config,
|
||||
{
|
||||
project_id => $entry->{project_id},
|
||||
studio_id => $entry->{studio_id},
|
||||
series_id => $entry->{series_id},
|
||||
@@ -615,7 +658,8 @@ sub assign_event{
|
||||
}
|
||||
|
||||
my $series = series::get(
|
||||
$config,{
|
||||
$config,
|
||||
{
|
||||
project_id => $entry->{project_id},
|
||||
studio_id => $entry->{studio_id},
|
||||
series_id => $entry->{series_id},
|
||||
@@ -627,6 +671,7 @@ sub assign_event{
|
||||
#set event's series name to value from series
|
||||
my $series_name = $serie->{series_name} || '';
|
||||
if ( $series_name ne '' ) {
|
||||
|
||||
# prepend series_name from event to title on adding to single_events series
|
||||
my $title = $event->{title};
|
||||
if ( $serie->{has_single_events} eq '1' ) {
|
||||
@@ -635,7 +680,8 @@ sub assign_event{
|
||||
|
||||
# save event content
|
||||
series_events::save_content(
|
||||
$config, {
|
||||
$config,
|
||||
{
|
||||
studio_id => $entry->{studio_id},
|
||||
id => $entry->{event_id}, #TODO: id=> event_id
|
||||
series_name => $series_name,
|
||||
@@ -689,14 +735,19 @@ sub unassign_event{
|
||||
}
|
||||
|
||||
#check if event exists
|
||||
my $event=series::get_event($config,{
|
||||
my $event = series::get_event(
|
||||
$config,
|
||||
{
|
||||
project_id => $entry->{project_id},
|
||||
studio_id => $entry->{studio_id},
|
||||
series_id => $entry->{series_id},
|
||||
event_id => $entry->{event_id},
|
||||
});
|
||||
}
|
||||
);
|
||||
unless ( defined $event ) {
|
||||
uac::print_error("event $entry->{event_id} not found for project_id=$entry->{project_id}, studio_id=$entry->{studio_id}, series_id=$entry->{series_id}");
|
||||
uac::print_error(
|
||||
"event $entry->{event_id} not found for project_id=$entry->{project_id}, studio_id=$entry->{studio_id}, series_id=$entry->{series_id}"
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -704,7 +755,8 @@ sub unassign_event{
|
||||
|
||||
#is series assigned to studio
|
||||
my $result = series_events::check_permission(
|
||||
$request, {
|
||||
$request,
|
||||
{
|
||||
permission => 'assign_series_events',
|
||||
check_for => [ 'studio', 'user', 'series', 'studio_timeslots' ],
|
||||
project_id => $entry->{project_id},
|
||||
@@ -722,7 +774,8 @@ sub unassign_event{
|
||||
|
||||
$config->{access}->{write} = 1;
|
||||
$result = series::unassign_event(
|
||||
$config, {
|
||||
$config,
|
||||
{
|
||||
project_id => $entry->{project_id},
|
||||
studio_id => $entry->{studio_id},
|
||||
series_id => $entry->{series_id},
|
||||
@@ -771,7 +824,8 @@ sub reassign_event{
|
||||
$result = unassign_event( $config, $request );
|
||||
}
|
||||
if ( $result == 1 ) {
|
||||
my $url='event.cgi?project_id='.$project_id.'&studio_id='.$studio_id.'&series_id='.$new_series_id.'&event_id='.$event_id;
|
||||
my $url =
|
||||
'event.cgi?project_id=' . $project_id . '&studio_id=' . $studio_id . '&series_id=' . $new_series_id . '&event_id=' . $event_id;
|
||||
print qq{<meta http-equiv="refresh" content="0; url=$url" />} . "\n";
|
||||
delete $params->{getBack};
|
||||
return 1;
|
||||
@@ -799,11 +853,12 @@ sub add_user{
|
||||
unless ( project::is_series_assigned( $config, $params ) == 1 ) {
|
||||
uac::print_error('series is not assigned to project!');
|
||||
return undef;
|
||||
};
|
||||
}
|
||||
|
||||
$config->{access}->{write} = 1;
|
||||
series::add_user(
|
||||
$config, {
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
series_id => $params->{series_id},
|
||||
@@ -836,11 +891,12 @@ sub remove_user{
|
||||
unless ( project::is_series_assigned( $config, $params ) == 1 ) {
|
||||
uac::print_error('series is not assigned to project!');
|
||||
return undef;
|
||||
};
|
||||
}
|
||||
|
||||
$config->{access}->{write} = 1;
|
||||
series::remove_user(
|
||||
$config, {
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
series_id => $params->{series_id},
|
||||
@@ -873,6 +929,7 @@ sub list_series{
|
||||
my $newSeries = [];
|
||||
my $oldSeries = [];
|
||||
for my $serie ( sort { lc $a->{series_name} cmp lc $b->{series_name} } (@$series) ) {
|
||||
|
||||
if ( $serie->{days_over} > 30 ) {
|
||||
push @$oldSeries, $serie;
|
||||
} else {
|
||||
@@ -910,7 +967,7 @@ sub show_series{
|
||||
unless ( project::is_series_assigned( $config, $params ) == 1 ) {
|
||||
uac::print_error('series is not assigned to project!');
|
||||
return undef;
|
||||
};
|
||||
}
|
||||
|
||||
#this will be updated later (especially allow_update_events)
|
||||
for my $permission ( keys %{ $request->{permissions} } ) {
|
||||
@@ -921,10 +978,13 @@ sub show_series{
|
||||
my $studio_id = $params->{studio_id};
|
||||
|
||||
#list of all studios by id
|
||||
my $studios=studios::get($config, {
|
||||
my $studios = studios::get(
|
||||
$config,
|
||||
{
|
||||
project_id => $project_id,
|
||||
studio_id => $studio_id
|
||||
});
|
||||
}
|
||||
);
|
||||
my $studio_by_id = {};
|
||||
for my $studio (@$studios) {
|
||||
$studio_by_id->{ $studio->{id} } = $studio;
|
||||
@@ -948,6 +1008,7 @@ sub show_series{
|
||||
return;
|
||||
}
|
||||
my $serie = $series->[0];
|
||||
|
||||
#if ($serie->{has_single_events}==0){
|
||||
#delete $serie->{has_single_events};
|
||||
#$serie->{series_name}='';
|
||||
@@ -964,7 +1025,6 @@ sub show_series{
|
||||
@users = sort { $a->{full_name} cmp $b->{full_name} } @users;
|
||||
$studio_users = \@users;
|
||||
|
||||
|
||||
#show events from last month until next 3 months
|
||||
my $from = DateTime->now( time_zone => $config->{date}->{time_zone} )->subtract( months => 1 )->datetime();
|
||||
my $till = DateTime->now( time_zone => $config->{date}->{time_zone} )->add( months => 3 )->datetime();
|
||||
@@ -977,7 +1037,8 @@ sub show_series{
|
||||
|
||||
#add users
|
||||
$serie->{series_users} = series::get_users(
|
||||
$config, {
|
||||
$config,
|
||||
{
|
||||
project_id => $project_id,
|
||||
studio_id => $serie->{studio_id},
|
||||
series_id => $serie->{series_id}
|
||||
@@ -986,7 +1047,8 @@ sub show_series{
|
||||
|
||||
#add events
|
||||
$serie->{events} = series::get_events(
|
||||
$config, {
|
||||
$config,
|
||||
{
|
||||
project_id => $project_id,
|
||||
studio_id => $serie->{studio_id},
|
||||
series_id => $serie->{series_id},
|
||||
@@ -1001,7 +1063,8 @@ sub show_series{
|
||||
@{ $serie->{events} } = reverse @{ $serie->{events} };
|
||||
|
||||
my $allow_update_event = series_events::check_permission(
|
||||
$request, {
|
||||
$request,
|
||||
{
|
||||
permission => 'update_event_of_series,update_event_of_others',
|
||||
check_for => [ 'studio', 'user', 'series' ],
|
||||
project_id => $project_id,
|
||||
@@ -1025,16 +1088,19 @@ sub show_series{
|
||||
|
||||
#add schedules
|
||||
my $schedules = series_schedule::get(
|
||||
$config, {
|
||||
$config,
|
||||
{
|
||||
project_id => $project_id,
|
||||
studio_id => $studio_id,
|
||||
series_id => $serie->{series_id}
|
||||
}
|
||||
);
|
||||
|
||||
#remove seconds from dates
|
||||
for my $schedule (@$schedules) {
|
||||
$schedule->{start} =~ s/(\d\d\:\d\d)\:\d\d/$1/ if defined $schedule->{start};
|
||||
$schedule->{end} =~ s/(\d\d\:\d\d)\:\d\d/$1/ if defined $schedule->{end};
|
||||
|
||||
#detect schedule type
|
||||
if ( $schedule->{period_type} eq '' ) {
|
||||
$schedule->{period_type} = 'week_of_month';
|
||||
@@ -1042,6 +1108,7 @@ sub show_series{
|
||||
$schedule->{period_type} = 'single' unless ( $schedule->{end} =~ /\d/ );
|
||||
}
|
||||
$schedule->{ 'period_type_' . $schedule->{period_type} } = 1;
|
||||
|
||||
#print STDERR $schedule->{period_type}."\n";
|
||||
}
|
||||
|
||||
@@ -1058,12 +1125,14 @@ sub show_series{
|
||||
|
||||
#add series dates
|
||||
my $series_dates = series_dates::get(
|
||||
$config, {
|
||||
$config,
|
||||
{
|
||||
project_id => $project_id,
|
||||
studio_id => $studio_id,
|
||||
series_id => $serie->{series_id}
|
||||
}
|
||||
);
|
||||
|
||||
#remove seconds from dates
|
||||
for my $date (@$series_dates) {
|
||||
$date->{start} =~ s/(\d\d\:\d\d)\:\d\d/$1/;
|
||||
@@ -1098,15 +1167,23 @@ sub check_params{
|
||||
#actions and roles
|
||||
$checked->{action} = '';
|
||||
if ( defined $params->{action} ) {
|
||||
if ($params->{action}=~/^(add_user|remove_user|create|delete|save|details|show|save_schedule|delete_schedule|save_scan|scan_events|assign_event|unassign_event|reassign_event)$/){
|
||||
if ( $params->{action} =~
|
||||
/^(add_user|remove_user|create|delete|save|details|show|save_schedule|delete_schedule|save_scan|scan_events|assign_event|unassign_event|reassign_event)$/
|
||||
)
|
||||
{
|
||||
$checked->{action} = $params->{action};
|
||||
}
|
||||
}
|
||||
|
||||
#numeric values
|
||||
$checked->{exclude} = 0;
|
||||
for my $param ('id', 'project_id', 'studio_id', 'default_studio_id', 'user_id', 'new_series_id', 'series_id', 'schedule_id',
|
||||
'exclude', 'show_hint_to_add_schedule', 'event_id', 'weekday', 'week_of_month', 'month', 'nextDay'){
|
||||
for my $param (
|
||||
'id', 'project_id', 'studio_id', 'default_studio_id',
|
||||
'user_id', 'new_series_id', 'series_id', 'schedule_id',
|
||||
'exclude', 'show_hint_to_add_schedule', 'event_id', 'weekday',
|
||||
'week_of_month', 'month', 'nextDay'
|
||||
)
|
||||
{
|
||||
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /^\d+$/ ) ) {
|
||||
$checked->{$param} = $params->{$param};
|
||||
}
|
||||
@@ -1124,6 +1201,7 @@ sub check_params{
|
||||
}
|
||||
|
||||
if ( ( defined $checked->{action} ) && ( $checked->{action} eq 'save_schedule' ) ) {
|
||||
|
||||
#set defaults
|
||||
$checked->{create_events} = 0;
|
||||
$checked->{publish_events} = 0;
|
||||
@@ -1143,12 +1221,11 @@ sub check_params{
|
||||
}
|
||||
}
|
||||
|
||||
for my $param (
|
||||
'series_name', 'title', 'excerpt', 'content', 'topic', 'image',
|
||||
'assign_event_series_name', 'assign_event_title', 'comment',
|
||||
'podcast_url', 'archive_url'
|
||||
){
|
||||
for my $param ( 'series_name', 'title', 'excerpt', 'content', 'topic', 'image',
|
||||
'assign_event_series_name', 'assign_event_title', 'comment', 'podcast_url', 'archive_url' )
|
||||
{
|
||||
if ( defined $params->{$param} ) {
|
||||
|
||||
#$checked->{$param}=uri_unescape();
|
||||
$checked->{$param} = $params->{$param};
|
||||
$checked->{$param} =~ s/^\s+//g;
|
||||
@@ -1171,4 +1248,3 @@ sub check_params{
|
||||
return $checked;
|
||||
}
|
||||
|
||||
|
||||
|
||||
204
website/agenda/planung/show-playout.cgi
Executable file
204
website/agenda/planung/show-playout.cgi
Executable file
@@ -0,0 +1,204 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
local $| = 0;
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use Data::Dumper;
|
||||
use CGI::Simple ();
|
||||
use ModPerl::Util ();
|
||||
|
||||
use config;
|
||||
use log;
|
||||
use localization;
|
||||
use auth;
|
||||
use uac;
|
||||
use studios;
|
||||
use series;
|
||||
use template;
|
||||
use playout;
|
||||
|
||||
binmode STDOUT, ":utf8";
|
||||
|
||||
my $r = shift;
|
||||
( my $cgi, my $params, my $error ) = params::get($r);
|
||||
|
||||
my $config = config::get('../config/config.cgi');
|
||||
my $debug = $config->{system}->{debug};
|
||||
my ( $user, $expires ) = auth::get_user( $cgi, $config );
|
||||
return if ( ( !defined $user ) || ( $user eq '' ) );
|
||||
|
||||
#print STDERR $params->{project_id}."\n";
|
||||
my $user_presets = uac::get_user_presets(
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
user => $user
|
||||
}
|
||||
);
|
||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||
$params->{studio_id} = $params->{default_studio_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
$params->{project_id} = $user_presets->{project_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
|
||||
#print STDERR $params->{project_id}."\n";
|
||||
my $request = {
|
||||
url => $ENV{QUERY_STRING} || '',
|
||||
params => {
|
||||
original => $params,
|
||||
checked => check_params($params),
|
||||
},
|
||||
};
|
||||
$request = uac::prepare_request( $request, $user_presets );
|
||||
log::init($request);
|
||||
|
||||
$params = $request->{params}->{checked};
|
||||
|
||||
#process header
|
||||
unless ( params::isJson() ) {
|
||||
my $headerParams = uac::set_template_permissions( $request->{permissions}, $params );
|
||||
$headerParams->{loc} = localization::get( $config, { user => $user, file => 'menu' } );
|
||||
template::process( 'print', template::check('default.html'), $headerParams );
|
||||
}
|
||||
return unless uac::check( $config, $params, $user_presets ) == 1;
|
||||
|
||||
print q{
|
||||
<script src="js/show-playout.js" type="text/javascript"></script>
|
||||
<link rel="stylesheet" href="css/show-playout.css" type="text/css" />
|
||||
} unless (params::isJson);
|
||||
|
||||
my $permissions = $request->{permissions};
|
||||
$params->{action} = '' unless defined $params->{action};
|
||||
$params->{error} = $error || '';
|
||||
|
||||
showPlayout( $config, $request );
|
||||
|
||||
print STDERR "$0 ERROR: " . $params->{error} . "\n" if $params->{error} ne '';
|
||||
$params->{loc} = localization::get( $config, { user => $params->{presets}->{user}, file => 'event,comment' } );
|
||||
template::process( 'print', $params->{template}, $params );
|
||||
|
||||
exit;
|
||||
|
||||
sub showPlayout {
|
||||
my $config = shift;
|
||||
my $request = shift;
|
||||
|
||||
my $params = $request->{params}->{checked};
|
||||
my $permissions = $request->{permissions};
|
||||
|
||||
for my $attr ( 'project_id', 'studio_id' ) {
|
||||
unless ( defined $params->{$attr} ) {
|
||||
uac::print_error( "missing " . $attr . " to show playout" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
my $events = playout::get(
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
order => 'modified_at desc, start desc',
|
||||
limit => 500
|
||||
}
|
||||
);
|
||||
|
||||
# print '<pre>'.Dumper($events).'</pre>';
|
||||
unless ( defined $events ) {
|
||||
uac::print_error("not found");
|
||||
return;
|
||||
}
|
||||
|
||||
for my $event (@$events) {
|
||||
$event->{stream_size} =~ s/(\d)(\d\d\d)$/$1\.$2/g;
|
||||
$event->{stream_size} =~ s/(\d)(\d\d\d\.\d\d\d)$/$1\.$2/g;
|
||||
$event->{duration} =~ s/(\d\.\d)(\d+)$/$1/g;
|
||||
$event->{duration} =~ s/(\d)\.0/$1/g;
|
||||
$event->{rms_left} = formatLoudness( $event->{rms_left} );
|
||||
$event->{rms_right} = formatLoudness( $event->{rms_right} );
|
||||
$event->{bitrate} = formatBitrate($event);
|
||||
$event->{duration} = formatDuration($event);
|
||||
}
|
||||
|
||||
$params->{events} = $events;
|
||||
|
||||
#print Dumper($events);
|
||||
}
|
||||
|
||||
sub formatDuration {
|
||||
my $event = $_[0];
|
||||
my $duration = $event->{duration};
|
||||
return '' unless defined $duration;
|
||||
return '' if $duration eq '';
|
||||
my $result = int( ( $duration + 3600 ) * 10 ) % 600;
|
||||
my $class = "ok";
|
||||
$class = "warn" if $result > 1;
|
||||
$class = "error" if $result > 10;
|
||||
return sprintf( qq{<div class="%s">%.01f</div>}, $class, $duration );
|
||||
}
|
||||
|
||||
sub formatBitrate {
|
||||
my $event = $_[0];
|
||||
my $bitrate = $event->{bitrate};
|
||||
my $mode = $event->{bitrate_mode};
|
||||
if ( $bitrate ne '' ) {
|
||||
if ( $bitrate >= 200 ) {
|
||||
$bitrate = '<div class="warn">' . $bitrate . ' ' . $mode . '</div>';
|
||||
} elsif ( $bitrate < 190 ) {
|
||||
$bitrate = '<div class="error">' . $bitrate . ' ' . $mode . '</div>';
|
||||
} else {
|
||||
$bitrate .= ' ' . $mode;
|
||||
}
|
||||
}
|
||||
return $bitrate;
|
||||
}
|
||||
|
||||
sub formatLoudness {
|
||||
my $value = shift;
|
||||
return '' unless defined $value;
|
||||
return '' if $value == 0;
|
||||
return '' if $value eq '';
|
||||
|
||||
$value = sprintf( "%.1f", $value );
|
||||
my $class = 'ok';
|
||||
$class = 'warn' if $value > -18.5;
|
||||
$class = 'error' if $value > -16.0;
|
||||
$class = 'warn' if $value < -24.0;
|
||||
$class = 'error' if $value < -27.0;
|
||||
|
||||
return qq{<div class="$class">$value dB</div>};
|
||||
}
|
||||
|
||||
sub check_params {
|
||||
my $params = shift;
|
||||
|
||||
my $checked = {};
|
||||
$checked->{error} = '';
|
||||
$checked->{template} = template::check( $params->{template}, 'show_playout' );
|
||||
|
||||
#numeric values
|
||||
for my $param ( 'project_id', 'studio_id', 'default_studio_id', 'series_id', 'event_id', 'id' ) {
|
||||
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /^\d+$/ ) ) {
|
||||
$checked->{$param} = $params->{$param};
|
||||
}
|
||||
}
|
||||
|
||||
if ( defined $checked->{studio_id} ) {
|
||||
$checked->{default_studio_id} = $checked->{studio_id};
|
||||
} else {
|
||||
$checked->{studio_id} = -1;
|
||||
}
|
||||
|
||||
#word
|
||||
for my $param ('debug') {
|
||||
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /^\s*(.+?)\s*$/ ) ) {
|
||||
$checked->{$param} = $1;
|
||||
}
|
||||
}
|
||||
|
||||
return $checked;
|
||||
}
|
||||
|
||||
43
website/agenda/planung/studio_timeslots.cgi
Normal file → Executable file
43
website/agenda/planung/studio_timeslots.cgi
Normal file → Executable file
@@ -30,14 +30,19 @@ my $debug = $config->{system}->{debug};
|
||||
my ( $user, $expires ) = auth::get_user( $cgi, $config );
|
||||
return if ( ( !defined $user ) || ( $user eq '' ) );
|
||||
|
||||
my $user_presets=uac::get_user_presets($config, {
|
||||
my $user_presets = uac::get_user_presets(
|
||||
$config,
|
||||
{
|
||||
user => $user,
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id}
|
||||
});
|
||||
}
|
||||
);
|
||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||
$params->{studio_id}=$params->{default_studio_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{project_id}=$user_presets->{project_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{studio_id} = $params->{default_studio_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
$params->{project_id} = $user_presets->{project_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
|
||||
my $request = {
|
||||
url => $ENV{QUERY_STRING} || '',
|
||||
@@ -57,6 +62,7 @@ $headerParams->{loc} = localization::get($config, {user=>$user, file=>'all,menu'
|
||||
|
||||
my $action = $params->{action} || '';
|
||||
if ( $action eq 'show_dates' ) {
|
||||
|
||||
#print "Content-type:text/html\n\n";
|
||||
} else {
|
||||
template::process( 'print', template::check('default.html'), $headerParams );
|
||||
@@ -82,7 +88,7 @@ if (defined $params->{action}){
|
||||
if ( $params->{action} eq 'show_dates' ) {
|
||||
showDates( $config, $request );
|
||||
return;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
$config->{access}->{write} = 0;
|
||||
@@ -103,9 +109,7 @@ sub save_schedule{
|
||||
#print Dumper($params);
|
||||
my $params = $request->{params}->{checked};
|
||||
|
||||
for my $attr (
|
||||
'project_id', 'studio_id', 'start', 'end', 'end_date', 'schedule_studio_id'
|
||||
){
|
||||
for my $attr ( 'project_id', 'studio_id', 'start', 'end', 'end_date', 'schedule_studio_id' ) {
|
||||
unless ( defined $params->{$attr} ) {
|
||||
uac::print_error( $attr . ' not given!' );
|
||||
return;
|
||||
@@ -113,11 +117,10 @@ sub save_schedule{
|
||||
}
|
||||
|
||||
my $entry = {};
|
||||
for my $attr (
|
||||
'project_id', 'start', 'end', 'end_date', 'frequency'
|
||||
){
|
||||
for my $attr ( 'project_id', 'start', 'end', 'end_date', 'frequency' ) {
|
||||
$entry->{$attr} = $params->{$attr} if ( defined $params->{$attr} );
|
||||
}
|
||||
|
||||
#set schedule's studio to value from schedule_studio_id
|
||||
$entry->{studio_id} = $params->{schedule_studio_id} if ( defined $params->{schedule_studio_id} );
|
||||
|
||||
@@ -130,14 +133,17 @@ sub save_schedule{
|
||||
$config->{access}->{write} = 1;
|
||||
if ( defined $params->{schedule_id} ) {
|
||||
$entry->{schedule_id} = $params->{schedule_id};
|
||||
|
||||
#print Dumper($entry);
|
||||
studio_timeslot_schedule::update( $config, $entry );
|
||||
|
||||
#my $updates=0;
|
||||
#print Dumper($entry);
|
||||
my $updates = studio_timeslot_dates::update( $config, $entry );
|
||||
uac::print_info("timeslot schedule saved. $updates dates scheduled");
|
||||
} else {
|
||||
$entry->{schedule_id} = studio_timeslot_schedule::insert( $config, $entry );
|
||||
|
||||
#my $updates=0;
|
||||
my $updates = studio_timeslot_dates::update( $config, $entry );
|
||||
uac::print_info("timeslot schedule added. $updates dates added");
|
||||
@@ -145,7 +151,6 @@ sub save_schedule{
|
||||
|
||||
}
|
||||
|
||||
|
||||
sub delete_schedule {
|
||||
my $config = shift;
|
||||
my $request = shift;
|
||||
@@ -207,8 +212,10 @@ sub showTimeslotSchedule{
|
||||
|
||||
#get project schedule
|
||||
my $schedules = studio_timeslot_schedule::get(
|
||||
$config,{
|
||||
$config,
|
||||
{
|
||||
project_id => $project_id
|
||||
|
||||
# studio_id=>$studio_id
|
||||
}
|
||||
);
|
||||
@@ -220,6 +227,7 @@ sub showTimeslotSchedule{
|
||||
for my $schedule (@$schedules) {
|
||||
$schedule->{start} =~ s/(\d\d\:\d\d)\:\d\d/$1/;
|
||||
$schedule->{end} =~ s/(\d\d\:\d\d)\:\d\d/$1/;
|
||||
|
||||
#insert assigned studio
|
||||
for my $studio (@$studios) {
|
||||
my $entry = {
|
||||
@@ -255,7 +263,6 @@ sub showTimeslotSchedule{
|
||||
template::process( 'print', $params->{template}, $params );
|
||||
}
|
||||
|
||||
|
||||
sub showDates {
|
||||
my $config = shift;
|
||||
my $request = shift;
|
||||
@@ -286,10 +293,13 @@ sub showDates{
|
||||
|
||||
my $fromDate = $params->{show_date} . '-01-01';
|
||||
my $tillDate = $params->{show_date} . '-12-31';
|
||||
|
||||
#add timeslot dates
|
||||
my $timeslot_dates = studio_timeslot_dates::get(
|
||||
$config,{
|
||||
$config,
|
||||
{
|
||||
project_id => $project_id,
|
||||
|
||||
# studio_id=>$studio_id,
|
||||
from => $fromDate,
|
||||
till => $tillDate
|
||||
@@ -318,6 +328,7 @@ sub showDates{
|
||||
|
||||
#remove seconds from dates
|
||||
for my $date (@$timeslot_dates) {
|
||||
|
||||
#remove seconds from datetimes
|
||||
$date->{start} =~ s/(\d\d\:\d\d)\:\d\d/$1/;
|
||||
$date->{end} =~ s/(\d\d\:\d\d)\:\d\d/$1/;
|
||||
@@ -383,7 +394,6 @@ sub check_params{
|
||||
$checked->{studio_id} = -1;
|
||||
}
|
||||
|
||||
|
||||
$checked->{template} = template::check( $params->{template}, 'studio_timeslots' );
|
||||
|
||||
for my $param ('frequency') {
|
||||
@@ -406,4 +416,3 @@ sub check_params{
|
||||
return $checked;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -25,14 +25,19 @@ my ($user,$expires) = auth::get_user($cgi, $config);
|
||||
return if ( $user eq '' );
|
||||
|
||||
my $permissions = roles::get_user_permissions();
|
||||
my $user_presets=uac::get_user_presets($config, {
|
||||
my $user_presets = uac::get_user_presets(
|
||||
$config,
|
||||
{
|
||||
user => $user,
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id}
|
||||
});
|
||||
}
|
||||
);
|
||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||
$params->{studio_id}=$params->{default_studio_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{project_id}=$user_presets->{project_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{studio_id} = $params->{default_studio_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
$params->{project_id} = $user_presets->{project_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
|
||||
my $request = {
|
||||
url => $ENV{QUERY_STRING} || '',
|
||||
@@ -88,14 +93,20 @@ sub delete_studio{
|
||||
if ( $studio_id ne '' ) {
|
||||
$config->{access}->{write} = 1;
|
||||
|
||||
project::unassign_studio($config, {
|
||||
project::unassign_studio(
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $studio_id
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
my $studio_assignments=project::get_studio_assignments($config, {
|
||||
my $studio_assignments = project::get_studio_assignments(
|
||||
$config,
|
||||
{
|
||||
studio_id => $studio_id
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
unless ( @$studio_assignments == 0 ) {
|
||||
uac::print_info("Studio unassigned from project");
|
||||
@@ -138,27 +149,36 @@ sub save_studio{
|
||||
}
|
||||
$entry->{id} = studios::insert( $config, $entry );
|
||||
|
||||
project::assign_studio($config, {
|
||||
project::assign_studio(
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $entry->{id}
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
#insert series for single events (if not already existing)
|
||||
my $studio_id = $entry->{id};
|
||||
my $single_series=series::get($config, {
|
||||
my $single_series = series::get(
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $studio_id,
|
||||
has_single_events=>1}
|
||||
has_single_events => 1
|
||||
}
|
||||
);
|
||||
if ( @$single_series == 0 ) {
|
||||
series::insert($config, {
|
||||
series::insert(
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $studio_id,
|
||||
has_single_events => 1,
|
||||
count_episodes => 0,
|
||||
series_name => '_single_'
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
print qq{<div class="ok head">changes saved</div>};
|
||||
@@ -171,9 +191,12 @@ sub show_studios{
|
||||
my $params = $request->{params}->{checked};
|
||||
my $permissions = $request->{permissions};
|
||||
|
||||
my $studios=studios::get($config, {
|
||||
my $studios = studios::get(
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id}
|
||||
});
|
||||
}
|
||||
);
|
||||
$params->{studios} = $studios;
|
||||
$params->{loc} = localization::get( $config, { user => $params->{presets}->{user}, file => 'studios' } );
|
||||
uac::set_template_permissions( $permissions, $params );
|
||||
@@ -217,7 +240,6 @@ sub check_params{
|
||||
$checked->{studio_id} = -1;
|
||||
}
|
||||
|
||||
|
||||
return $checked;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,10 @@
|
||||
<div> <a href="series.cgi?project_id=<TMPL_VAR project_id>&studio_id=<TMPL_VAR default_studio_id>"><TMPL_VAR .loc.series></a> </div>
|
||||
</TMPL_IF>
|
||||
|
||||
<TMPL_IF .allow.read_playout>
|
||||
<div> <a href="show-playout.cgi?project_id=<TMPL_VAR project_id>&studio_id=<TMPL_VAR default_studio_id>"><TMPL_VAR .loc.playout></a> </div>
|
||||
</TMPL_IF>
|
||||
|
||||
<TMPL_IF .allow.read_user>
|
||||
<div> <a href="users.cgi?project_id=<TMPL_VAR project_id>&studio_id=<TMPL_VAR default_studio_id>"><TMPL_VAR .loc.users></a> </div>
|
||||
</TMPL_IF>
|
||||
|
||||
@@ -436,6 +436,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<TMPL_IF .allow.read_image>
|
||||
<tr>
|
||||
<td class="label">
|
||||
<TMPL_VAR .loc.label_image>
|
||||
@@ -448,11 +449,10 @@
|
||||
<img id="imagePreview" src="<TMPL_VAR image>">
|
||||
</button>
|
||||
<input id="image_<TMPL_VAR event_id>" name="image" value="<TMPL_VAR image>" class="image" style="float:right" placeholder="<TMPL_VAR .loc.label_image>">
|
||||
<TMPL_ELSE>
|
||||
<img src="<TMPL_VAR image>">
|
||||
</TMPL_IF>
|
||||
</td>
|
||||
</tr>
|
||||
</TMPL_IF>
|
||||
|
||||
<tr>
|
||||
<td class="label">
|
||||
|
||||
@@ -139,8 +139,6 @@
|
||||
<img id="imagePreview" src="<TMPL_VAR image>">
|
||||
</button>
|
||||
<input id="image_<TMPL_VAR .series_id>" name="image" value="<TMPL_VAR image>" class="image" placeholder="<TMPL_VAR .loc.template_image>">
|
||||
<TMPL_ELSE>
|
||||
<img src="<TMPL_VAR image>">
|
||||
</TMPL_IF>
|
||||
</td></tr>
|
||||
<tr> <td class="label"><TMPL_VAR .loc.template_duration></td>
|
||||
@@ -445,7 +443,9 @@
|
||||
<table class="table">
|
||||
<TMPL_LOOP events>
|
||||
<tr id="event_<TMPL_VAR event_id>">
|
||||
<TMPL_IF .allow.read_image>
|
||||
<td class="logo"><img src="<TMPL_VAR image>" width="33" height="33"></td>
|
||||
</TMPL_IF>
|
||||
<td class="weekday"><TMPL_VAR weekday_short_name></td>
|
||||
<td class="date"><TMPL_VAR start_date></td>
|
||||
<td class="time"><TMPL_VAR start_time_name></td>
|
||||
|
||||
16
website/agenda/planung/templates/notify_daily.html
Normal file
16
website/agenda/planung/templates/notify_daily.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<html>
|
||||
<body>
|
||||
|
||||
<table id="events">
|
||||
<TMPL_LOOP events>
|
||||
<tr id="header_<TMPL_VAR event_id>" class="mailHeader">
|
||||
<td><TMPL_VAR start></td>
|
||||
<td><TMPL_IF live>live</TMPL_IF> <TMPL_IF preproduction>preproduction</TMPL_IF> <TMPL_IF playout>playout</TMPL_IF></td>
|
||||
<td><TMPL_VAR full_title></td>
|
||||
<td><TMPL_VAR mail.To></td>
|
||||
</tr>
|
||||
</TMPL_LOOP>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
9
website/agenda/planung/templates/notify_daily.txt
Normal file
9
website/agenda/planung/templates/notify_daily.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
Content-type:text/plain
|
||||
|
||||
<TMPL_LOOP events>
|
||||
date: <TMPL_VAR start>
|
||||
<TMPL_IF live>live</TMPL_IF> <TMPL_IF preproduction>preproduction</TMPL_IF> <TMPL_IF playout>playout</TMPL_IF>
|
||||
<TMPL_VAR full_title>
|
||||
<TMPL_VAR mail.To>
|
||||
</TMPL_LOOP>
|
||||
|
||||
19
website/agenda/planung/templates/notify_overview.html
Normal file
19
website/agenda/planung/templates/notify_overview.html
Normal file
@@ -0,0 +1,19 @@
|
||||
<html>
|
||||
|
||||
<body>
|
||||
|
||||
<table id="events">
|
||||
<TMPL_LOOP events>
|
||||
|
||||
<tr id="header_<TMPL_VAR event_id>" class="mailHeader">
|
||||
<td><TMPL_VAR start></td>
|
||||
<td><TMPL_IF live>live</TMPL_IF> <TMPL_IF preproduction>preproduction</TMPL_IF> <TMPL_IF playout>playout</TMPL_IF></td>
|
||||
<td><TMPL_VAR full_title></td>
|
||||
<td><TMPL_VAR mail.To></td>
|
||||
</tr>
|
||||
|
||||
</TMPL_LOOP>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
9
website/agenda/planung/templates/notify_overview.txt
Normal file
9
website/agenda/planung/templates/notify_overview.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
Content-type:text/plain; charset=utf-8;
|
||||
|
||||
<TMPL_LOOP events>
|
||||
date: <TMPL_VAR start>
|
||||
title: <TMPL_VAR full_title>
|
||||
status: <TMPL_IF live>live<TMPL_ELSE><TMPL_IF preproduction>preproduction</TMPL_IF></TMPL_IF><TMPL_IF playout>playout</TMPL_IF>
|
||||
contact: <TMPL_VAR mail.To>
|
||||
</TMPL_LOOP>
|
||||
|
||||
43
website/agenda/planung/templates/show_playout.html
Normal file
43
website/agenda/planung/templates/show_playout.html
Normal file
@@ -0,0 +1,43 @@
|
||||
<link href="css/jquery-ui-timepicker.css" type="text/css" rel="stylesheet" />
|
||||
<script src="js/jquery-ui-timepicker.js" type="text/javascript"></script>
|
||||
|
||||
<script src="js/jquery.autosize.min.js" type="text/javascript"></script>
|
||||
<link href="css/theme.default.css" rel="stylesheet">
|
||||
|
||||
<script src="js/jquery.tablesorter.min.js"></script>
|
||||
<script src="js/jquery.tablesorter.widgets.min.js"></script>
|
||||
<script src="js/jquery.tablesorter.scroller.js"></script>
|
||||
|
||||
<script src="js/image.js" type="text/javascript"></script>
|
||||
|
||||
|
||||
<table id="playout-table" class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>start</th>
|
||||
<th>playout path</th>
|
||||
<th>seconds</th>
|
||||
<th>loudness</th>
|
||||
<th>format</th>
|
||||
<th>image</th>
|
||||
<th>bytes</th>
|
||||
<th>modified at</th>
|
||||
</thead>
|
||||
</tr>
|
||||
<tbody>
|
||||
<TMPL_LOOP events>
|
||||
<tr>
|
||||
<td><TMPL_VAR start></td>
|
||||
<td><TMPL_VAR file></td>
|
||||
<td><TMPL_VAR duration escape="text"></td>
|
||||
<td><TMPL_VAR rms_left escape="text"> <TMPL_VAR rms_right escape="text"></td>
|
||||
<td><TMPL_VAR bitrate escape="text"> <TMPL_VAR sampling_rate> <TMPL_VAR channels> ch.</td>
|
||||
<td><TMPL_IF rms_image><a href="/agenda_files/playout/<TMPL_VAR rms_image>"><img src="/agenda_files/playout/<TMPL_VAR rms_image>"></a></TMPL_IF></td>
|
||||
<td><TMPL_VAR stream_size></td>
|
||||
<td><TMPL_VAR modified_at></td>
|
||||
</tr>
|
||||
</TMPL_LOOP>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
|
||||
<TMPL_IF .allow.upload_audio_recordings>
|
||||
<div id="error" class="error" style="display:none"></div>
|
||||
<div id="info" class="ok" style="display:none"></div>
|
||||
|
||||
<h2>
|
||||
<TMPL_VAR event.weekday_short_name>, <TMPL_VAR event.start_date_name> <TMPL_VAR event.start_time_name><br>
|
||||
@@ -13,10 +15,13 @@
|
||||
<hr/>
|
||||
|
||||
<TMPL_UNLESS isOver>
|
||||
|
||||
<div id="progress" style="display:none;vertical-align:middle;background:#aaa;text-align:center;margin:1em;padding:1em;font-size:1em;font-weight:bold;color:#fff" >
|
||||
<div>Ich lade jetzt die Datei hoch... Pieps.</div>
|
||||
<div><img src="/agenda/image/upload/bird9.gif" /></div>
|
||||
<div>Ist das aufregend!</div>
|
||||
<progress id="progressBar"></progress>
|
||||
<div id="progressLabel"></div>
|
||||
</div>
|
||||
|
||||
<form name="audio_recordings_upload" id="audio_recordings_upload" method="post" enctype="multipart/form-data">
|
||||
@@ -24,16 +29,17 @@
|
||||
<input type="hidden" name="studio_id" value="<TMPL_VAR studio_id>" />
|
||||
<input type="hidden" name="series_id" value="<TMPL_VAR series_id>" />
|
||||
<input type="hidden" name="event_id" value="<TMPL_VAR event_id>" />
|
||||
<table class="table">
|
||||
<input type="hidden" name="action" value="upload" />
|
||||
<table>
|
||||
<tr>
|
||||
<td>Datei</td>
|
||||
|
||||
<td><input type="file" name="upload" size="20"
|
||||
accept="audio/mp3" maxlength="2000000000"
|
||||
/></td>
|
||||
<td><input type="file" id="file" name="upload" size="20" accept="audio/mp3" maxlength="2000000000" /></td>
|
||||
|
||||
<td colspan="2" style="text-align:right;padding-right:0.5em;" onclick="showProgress()">
|
||||
<input type="submit" name="action" value="upload" />
|
||||
<td colspan="2" style="text-align:right;padding-right:0.5em;" id="uploadSize"></td>
|
||||
|
||||
<td colspan="2" style="text-align:right;padding-right:0.5em;" >
|
||||
<button id="uploadButton" name="action" value="upload" >upload</button>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
@@ -51,18 +57,28 @@
|
||||
<table>
|
||||
<tr>
|
||||
<th>action</th>
|
||||
<!--<th>id</th>-->
|
||||
<th>name</th>
|
||||
<th>size in bytes</th>
|
||||
<th>event duration in seconds</th>
|
||||
<th>audio duration in seconds</th>
|
||||
<th>RMS L</th>
|
||||
<th>RMS R</th>
|
||||
<th>processed</th>
|
||||
<th>mastered</th>
|
||||
<th>uploaded by</th>
|
||||
<th>uploaded at</th>
|
||||
</tr>
|
||||
<TMPL_LOOP audio_recordings>
|
||||
<tr>
|
||||
<td><button onclick="playAudio('<TMPL_VAR path>');return false">play</button></td>
|
||||
<!--<td><TMPL_VAR id></td>-->
|
||||
<td><TMPL_VAR path></td>
|
||||
<td><TMPL_VAR size></td>
|
||||
<td><TMPL_VAR eventDuration></td>
|
||||
<td><TMPL_VAR audioDuration></td>
|
||||
<td><TMPL_VAR rmsLeft></td>
|
||||
<td><TMPL_VAR rmsRight></td>
|
||||
<td><TMPL_VAR processed></td>
|
||||
<td><TMPL_VAR mastered></td>
|
||||
<td><TMPL_VAR created_by></td>
|
||||
<td><TMPL_VAR created_at></td>
|
||||
<TMPL_IF .allow.delete_audio_recordings>
|
||||
@@ -70,7 +86,7 @@
|
||||
<form method="post">
|
||||
<input type="hidden" name="project_id" value="<TMPL_VAR project_id>" />
|
||||
<input type="hidden" name="studio_id" value="<TMPL_VAR studio_id>" />
|
||||
<input type="hidden" name="series_id" value="<TMPL_VAR series_id>" />
|
||||
<input type="hidden" name="series_id" value="<TMPL_VAR .series_id>" />
|
||||
<input type="hidden" name="event_id" value="<TMPL_VAR event_id>" />
|
||||
<input type="hidden" name="path" value="<TMPL_VAR path>" />
|
||||
<button type="submit" name="action" value="delete"><TMPL_VAR .loc.button_delete></button>
|
||||
|
||||
22
website/agenda/planung/user_settings.cgi
Normal file → Executable file
22
website/agenda/planung/user_settings.cgi
Normal file → Executable file
@@ -18,20 +18,24 @@ use localization;
|
||||
|
||||
my $r = shift;
|
||||
( my $cgi, my $params, my $error ) = params::get($r);
|
||||
|
||||
my $config = config::get('../config/config.cgi');
|
||||
my $debug = $config->{system}->{debug};
|
||||
my ( $user, $expires ) = auth::get_user( $cgi, $config );
|
||||
return if ( ( !defined $user ) || ( $user eq '' ) );
|
||||
|
||||
my $user_presets=uac::get_user_presets($config, {
|
||||
my $user_presets = uac::get_user_presets(
|
||||
$config,
|
||||
{
|
||||
user => $user,
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id}
|
||||
});
|
||||
}
|
||||
);
|
||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||
$params->{studio_id}=$params->{default_studio_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{project_id}=$user_presets->{project_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{studio_id} = $params->{default_studio_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
$params->{project_id} = $user_presets->{project_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
|
||||
my $request = {
|
||||
url => $ENV{QUERY_STRING} || '',
|
||||
@@ -59,13 +63,13 @@ if (defined $params->{action}){
|
||||
$config->{access}->{write} = 0;
|
||||
show_settings( $config, $request );
|
||||
|
||||
|
||||
sub show_settings {
|
||||
my $config = shift;
|
||||
my $request = shift;
|
||||
|
||||
my $params = $request->{params}->{checked};
|
||||
my $permissions = $request->{permissions};
|
||||
|
||||
# unless ($permissions->{read_user}==1){
|
||||
# uac::permissions_denied('read_user');
|
||||
# return;
|
||||
@@ -77,7 +81,8 @@ sub show_settings{
|
||||
my @colors = ();
|
||||
my $c = 0;
|
||||
for my $color (@$colors) {
|
||||
push @colors,{
|
||||
push @colors,
|
||||
{
|
||||
title => $color->{name},
|
||||
class => $color->{css},
|
||||
name => 'color_' . $c,
|
||||
@@ -100,12 +105,14 @@ sub show_settings{
|
||||
$params->{ 'period_' . $period } = 1;
|
||||
|
||||
$params->{loc} = localization::get( $config, { language => $language, file => 'user_settings' } );
|
||||
|
||||
#print STDERR Dumper($params->{loc});
|
||||
|
||||
for my $color ( @{ $params->{colors} } ) {
|
||||
$color->{title} = $params->{loc}->{ $color->{title} };
|
||||
}
|
||||
uac::set_template_permissions( $permissions, $params );
|
||||
|
||||
#print Dumper($permissions);
|
||||
template::process( 'print', $params->{template}, $params );
|
||||
|
||||
@@ -174,7 +181,6 @@ sub check_params{
|
||||
$checked->{studio_id} = -1;
|
||||
}
|
||||
|
||||
|
||||
for my $param ( keys %$params ) {
|
||||
if ( ( defined $params->{$param} ) && ( $param =~ /^(color\_\d+)$/ ) ) {
|
||||
$checked->{$param} = $params->{$param};
|
||||
|
||||
15
website/agenda/planung/user_stats.cgi
Normal file → Executable file
15
website/agenda/planung/user_stats.cgi
Normal file → Executable file
@@ -25,14 +25,19 @@ my $debug =$config->{system}->{debug};
|
||||
my ( $user, $expires ) = auth::get_user( $cgi, $config );
|
||||
return if ( ( !defined $user ) || ( $user eq '' ) );
|
||||
|
||||
my $user_presets=uac::get_user_presets($config, {
|
||||
my $user_presets = uac::get_user_presets(
|
||||
$config,
|
||||
{
|
||||
user => $user,
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id}
|
||||
});
|
||||
}
|
||||
);
|
||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||
$params->{studio_id}=$params->{default_studio_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{project_id}=$user_presets->{project_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{studio_id} = $params->{default_studio_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
$params->{project_id} = $user_presets->{project_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
|
||||
my $request = {
|
||||
url => $ENV{QUERY_STRING} || '',
|
||||
@@ -56,7 +61,6 @@ our $errors=[];
|
||||
|
||||
show_stats( $config, $request );
|
||||
|
||||
|
||||
sub show_stats {
|
||||
my $config = shift;
|
||||
my $request = shift;
|
||||
@@ -77,7 +81,6 @@ sub show_stats{
|
||||
template::process( 'print', $params->{template}, $params );
|
||||
}
|
||||
|
||||
|
||||
sub check_params {
|
||||
my $params = shift;
|
||||
|
||||
|
||||
@@ -21,15 +21,19 @@ my $config =config::get('../config/config.cgi');
|
||||
my $debug = $config->{system}->{debug};
|
||||
my ( $user, $expires ) = auth::get_user( $cgi, $config );
|
||||
return if ( ( !defined $user ) || ( $user eq '' ) );
|
||||
|
||||
my $user_presets=uac::get_user_presets($config, {
|
||||
my $user_presets = uac::get_user_presets(
|
||||
$config,
|
||||
{
|
||||
user => $user,
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id}
|
||||
});
|
||||
}
|
||||
);
|
||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||
$params->{studio_id} = $params->{default_studio_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{project_id} = $user_presets->{project_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{studio_id} = $params->{default_studio_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
$params->{project_id} = $user_presets->{project_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
|
||||
my $request = {
|
||||
url => $ENV{QUERY_STRING} || '',
|
||||
@@ -80,11 +84,13 @@ sub show_users{
|
||||
my $max_level = $permissions->{level};
|
||||
my $project_id = $params->{project_id};
|
||||
my $studio_id = $params->{studio_id};
|
||||
|
||||
#TODO: get from presets
|
||||
my $studios = studios::get( $config, { project_id => $project_id } );
|
||||
my $users = uac::get_users($config);
|
||||
my $roles = uac::get_roles(
|
||||
$config, {
|
||||
$config,
|
||||
{
|
||||
project_id => $project_id,
|
||||
studio_id => $studio_id
|
||||
}
|
||||
@@ -95,15 +101,18 @@ sub show_users{
|
||||
#user roles
|
||||
for my $user (@$users) {
|
||||
$user->{disabled_checked} = 'selected="selected"' if ( $user->{disabled} eq '1' );
|
||||
|
||||
#print Dumper($user);
|
||||
my $user_roles = uac::get_user_roles(
|
||||
$config, {
|
||||
$config,
|
||||
{
|
||||
user => $user->{name},
|
||||
project_id => $project_id,
|
||||
studio_id => $studio_id
|
||||
}
|
||||
);
|
||||
my @user_roles = ( map { { role => $_->{role} } } @$user_roles );
|
||||
|
||||
#print Dumper(\@user_roles);
|
||||
#@user_roles[-1]->{__last__}=1 unless(@user_roles==0);
|
||||
$user->{user_roles} = \@user_roles;
|
||||
@@ -112,12 +121,14 @@ sub show_users{
|
||||
my $has_roles = 0;
|
||||
my @assignable_roles = ();
|
||||
for my $role ( reverse sort { $a->{level} <=> $b->{level} } @$roles ) {
|
||||
|
||||
#next if ($role->{level}>$max_level);
|
||||
$role->{assigned} = 0;
|
||||
my %role = %$role;
|
||||
for my $user_role (@user_roles) {
|
||||
if ( $role->{role} eq $user_role->{role} ) {
|
||||
$role{assigned} = 1;
|
||||
|
||||
# print "if ($role->{role} eq $user_role->{role}<br>";
|
||||
$has_roles = 1;
|
||||
last;
|
||||
@@ -151,15 +162,16 @@ sub show_users{
|
||||
@users = (@users_with_roles);
|
||||
}
|
||||
|
||||
|
||||
$params->{users} = \@users;
|
||||
$params->{studios} = $studios;
|
||||
$params->{permissions} = $permissions;
|
||||
$params->{errors} = $errors;
|
||||
$params->{loc} = localization::get( $config, { user => $params->{presets}->{user}, file => 'users' } );
|
||||
uac::set_template_permissions( $permissions, $params );
|
||||
|
||||
#print Dumper($permissions);
|
||||
template::process( 'print', $params->{template}, $params );
|
||||
|
||||
# template::process('print', template::check('users'), $params);
|
||||
|
||||
}
|
||||
@@ -197,6 +209,7 @@ sub update_user{
|
||||
my $crypt = auth::crypt_password( $params->{user_password} );
|
||||
$user->{salt} = $crypt->{salt};
|
||||
$user->{pass} = $crypt->{crypt};
|
||||
|
||||
#print '<pre>'.Dumper($user).'</pre>';
|
||||
$user->{created_at} = time::time_to_datetime( time() );
|
||||
$user->{modified_at} = time::time_to_datetime( time() );
|
||||
@@ -247,11 +260,10 @@ sub change_password{
|
||||
|
||||
if ( @$errors == 0 ) {
|
||||
my $crypt = auth::crypt_password( $params->{user_password} );
|
||||
$user={
|
||||
id => $user->{id}
|
||||
};
|
||||
$user = { id => $user->{id} };
|
||||
$user->{salt} = $crypt->{salt};
|
||||
$user->{pass} = $crypt->{crypt};
|
||||
|
||||
#print '<pre>'.Dumper($user).'</pre>';
|
||||
$config->{access}->{write} = 1;
|
||||
uac::update_user( $config, $user );
|
||||
@@ -261,6 +273,7 @@ sub change_password{
|
||||
$params->{errors} = $errors; #join("<br>", (map {$_>{error}} (@$errors)) );
|
||||
$params->{loc} = localization::get( $config, { user => $params->{presets}->{user}, file => 'users' } );
|
||||
uac::set_template_permissions( $permissions, $params );
|
||||
|
||||
#print Dumper($permissions);
|
||||
template::process( 'print', template::check('change_password'), $params );
|
||||
}
|
||||
@@ -327,18 +340,22 @@ sub update_user_roles{
|
||||
my $project_id = $params->{project_id};
|
||||
my $studio_id = $params->{studio_id};
|
||||
my $user_id = $params->{user_id} || '';
|
||||
|
||||
# return undef if ($user_id eq '');
|
||||
|
||||
#get all roles
|
||||
my $roles = uac::get_roles(
|
||||
$config, {
|
||||
$config,
|
||||
{
|
||||
project_id => $project_id,
|
||||
studio_id => $studio_id
|
||||
}
|
||||
);
|
||||
|
||||
#get roles for the selected user
|
||||
my $user_roles = uac::get_user_roles(
|
||||
$config, {
|
||||
$config,
|
||||
{
|
||||
project_id => $project_id,
|
||||
studio_id => $studio_id,
|
||||
user_id => $user_id
|
||||
@@ -365,25 +382,27 @@ sub update_user_roles{
|
||||
}
|
||||
|
||||
$config->{access}->{write} = 1;
|
||||
|
||||
#remove unchecked user roles
|
||||
for my $user_role_id ( keys %$user_role_by_id ) {
|
||||
my $user_role = $user_role_by_id->{$user_role_id};
|
||||
my $role = $role_by_id->{$user_role_id};
|
||||
|
||||
# print "$user_role_id - $params->{role_ids}->{$user_role_id} ($studio_id)<br>";
|
||||
unless ( defined $params->{role_ids}->{$user_role_id} ) {
|
||||
my $message="remove role '$role->{role}' (level $role->{level}) from user $user_id (level $max_user_level) for studio_id=$studio_id, project_id=$project_id. Your level is $max_level";
|
||||
my $message =
|
||||
"remove role '$role->{role}' (level $role->{level}) from user $user_id (level $max_user_level) for studio_id=$studio_id, project_id=$project_id. Your level is $max_level";
|
||||
my $update = 0;
|
||||
$update = 1 if ( defined $permissions->{is_admin} );
|
||||
$update = 1 if (
|
||||
($role_by_id->{$user_role->{role_id}}->{level}<$max_level)
|
||||
&& ($max_user_level<$max_level)
|
||||
);
|
||||
$update = 1 if ( ( $role_by_id->{ $user_role->{role_id} }->{level} < $max_level )
|
||||
&& ( $max_user_level < $max_level ) );
|
||||
if ( $update == 0 ) {
|
||||
uac::permissions_denied($message);
|
||||
next;
|
||||
}
|
||||
my $result = uac::remove_user_role(
|
||||
$config, {
|
||||
$config,
|
||||
{
|
||||
project_id => $project_id,
|
||||
studio_id => $studio_id,
|
||||
user_id => $user_id,
|
||||
@@ -407,19 +426,19 @@ sub update_user_roles{
|
||||
my $role = $role_by_id->{$role_id};
|
||||
unless ( defined $user_role_by_id->{$role_id} ) {
|
||||
my $message = "assign role $role->{role} (level $role->{level}) to user (level $max_user_level). Your level is $max_level";
|
||||
|
||||
# print "user role id: $role->{id}<br>\n";
|
||||
my $update = 0;
|
||||
$update = 1 if ( defined $permissions->{is_admin} );
|
||||
$update = 1 if (
|
||||
($role_by_id->{$role->{id}}->{level}<$max_level)
|
||||
&& ($max_user_level<$max_level)
|
||||
);
|
||||
$update = 1 if ( ( $role_by_id->{ $role->{id} }->{level} < $max_level )
|
||||
&& ( $max_user_level < $max_level ) );
|
||||
if ( $update == 0 ) {
|
||||
uac::permissions_denied($message);
|
||||
next;
|
||||
}
|
||||
uac::assign_user_role(
|
||||
$config, {
|
||||
$config,
|
||||
{
|
||||
project_id => $project_id,
|
||||
studio_id => $studio_id,
|
||||
user_id => $user_id,
|
||||
@@ -454,7 +473,6 @@ sub check_params{
|
||||
$checked->{studio_id} = -1;
|
||||
}
|
||||
|
||||
|
||||
for my $param ( 'user_name', 'user_full_name', 'user_email', 'user_password', 'user_password2' ) {
|
||||
if ( defined $params->{$param} ) {
|
||||
$checked->{$param} = $params->{$param};
|
||||
@@ -474,6 +492,7 @@ sub check_params{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#print Dumper($params);
|
||||
#print '<pre>'.Dumper($checked).'</pre>';
|
||||
return $checked;
|
||||
@@ -483,4 +502,3 @@ sub error{
|
||||
push @$errors, { error => $_[0] };
|
||||
}
|
||||
|
||||
|
||||
|
||||
47
website/agenda/planung/work_time.cgi
Normal file → Executable file
47
website/agenda/planung/work_time.cgi
Normal file → Executable file
@@ -30,14 +30,20 @@ my ($user,$expires) = auth::get_user($cgi, $config);
|
||||
return if ( ( !defined $user ) || ( $user eq '' ) );
|
||||
|
||||
#print STDERR $params->{project_id}."\n";
|
||||
my $user_presets=uac::get_user_presets($config, {
|
||||
my $user_presets = uac::get_user_presets(
|
||||
$config,
|
||||
{
|
||||
project_id => $params->{project_id},
|
||||
studio_id => $params->{studio_id},
|
||||
user => $user
|
||||
});
|
||||
}
|
||||
);
|
||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||
$params->{studio_id} = $params->{default_studio_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{project_id} = $user_presets->{project_id} if ((!(defined $params->{action}))||($params->{action}eq'')||($params->{action}eq'login'));
|
||||
$params->{studio_id} = $params->{default_studio_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
$params->{project_id} = $user_presets->{project_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
|
||||
#print STDERR $params->{project_id}."\n";
|
||||
my $request = {
|
||||
url => $ENV{QUERY_STRING} || '',
|
||||
@@ -90,12 +96,10 @@ sub save_schedule{
|
||||
|
||||
my $entry = {};
|
||||
for my $attr (
|
||||
'project_id','studio_id', 'start',
|
||||
'duration', 'exclude' , 'period_type',
|
||||
'end', 'frequency',
|
||||
'weekday', 'week_of_month', 'month',
|
||||
'title', 'type'
|
||||
){
|
||||
'project_id', 'studio_id', 'start', 'duration', 'exclude', 'period_type', 'end', 'frequency',
|
||||
'weekday', 'week_of_month', 'month', 'title', 'type'
|
||||
)
|
||||
{
|
||||
$entry->{$attr} = $params->{$attr} if ( defined $params->{$attr} );
|
||||
}
|
||||
|
||||
@@ -121,12 +125,14 @@ sub save_schedule{
|
||||
if ( defined $params->{schedule_id} ) {
|
||||
$entry->{schedule_id} = $params->{schedule_id};
|
||||
work_schedule::update( $config, $entry );
|
||||
|
||||
#timeslots are checked inside
|
||||
my $updates = work_dates::update( $config, $entry );
|
||||
uac::print_info("schedule saved. $updates dates scheduled");
|
||||
} else {
|
||||
my $schedule_id = work_schedule::insert( $config, $entry );
|
||||
$entry->{schedule_id} = $schedule_id;
|
||||
|
||||
#timeslots are checked inside
|
||||
my $updates = work_dates::update( $config, $entry );
|
||||
uac::print_info("schedule added. $updates dates added");
|
||||
@@ -134,7 +140,6 @@ sub save_schedule{
|
||||
$config->{access}->{write} = 0;
|
||||
}
|
||||
|
||||
|
||||
sub delete_schedule {
|
||||
my $config = shift;
|
||||
my $request = shift;
|
||||
@@ -163,7 +168,6 @@ sub delete_schedule{
|
||||
uac::print_info("schedule deleted");
|
||||
}
|
||||
|
||||
|
||||
sub show_work_schedule {
|
||||
my $config = shift;
|
||||
my $request = shift;
|
||||
@@ -194,15 +198,18 @@ sub show_work_schedule{
|
||||
|
||||
#add schedules
|
||||
my $schedules = work_schedule::get(
|
||||
$config, {
|
||||
$config,
|
||||
{
|
||||
project_id => $project_id,
|
||||
studio_id => $studio_id,
|
||||
}
|
||||
);
|
||||
|
||||
#remove seconds from dates
|
||||
for my $schedule (@$schedules) {
|
||||
$schedule->{start} =~ s/(\d\d\:\d\d)\:\d\d/$1/ if defined $schedule->{start};
|
||||
$schedule->{end} =~ s/(\d\d\:\d\d)\:\d\d/$1/ if defined $schedule->{end};
|
||||
|
||||
#detect schedule type
|
||||
if ( $schedule->{period_type} eq '' ) {
|
||||
$schedule->{period_type} = 'week_of_month';
|
||||
@@ -213,6 +220,7 @@ sub show_work_schedule{
|
||||
if ( $params->{schedule_id} eq $schedule->{schedule_id} ) {
|
||||
$schedule->{selected} = 1;
|
||||
}
|
||||
|
||||
#print STDERR $schedule->{period_type}."\n";
|
||||
}
|
||||
my $serie = {};
|
||||
@@ -230,11 +238,13 @@ sub show_work_schedule{
|
||||
|
||||
#add series dates
|
||||
my $work_dates = work_dates::get(
|
||||
$config, {
|
||||
$config,
|
||||
{
|
||||
project_id => $project_id,
|
||||
studio_id => $studio_id,
|
||||
}
|
||||
);
|
||||
|
||||
#remove seconds from dates
|
||||
for my $date (@$work_dates) {
|
||||
$date->{start} =~ s/(\d\d\:\d\d)\:\d\d/$1/;
|
||||
@@ -276,8 +286,11 @@ sub check_params{
|
||||
|
||||
#numeric values
|
||||
$checked->{exclude} = 0;
|
||||
for my $param ('project_id', 'studio_id', 'default_studio_id', 'schedule_id',
|
||||
'exclude', 'show_hint_to_add_schedule', 'weekday week_of_month', 'month'){
|
||||
for my $param (
|
||||
'project_id', 'studio_id', 'default_studio_id', 'schedule_id',
|
||||
'exclude', 'show_hint_to_add_schedule', 'weekday week_of_month', 'month'
|
||||
)
|
||||
{
|
||||
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /^\d+$/ ) ) {
|
||||
$checked->{$param} = $params->{$param};
|
||||
}
|
||||
@@ -291,6 +304,7 @@ sub check_params{
|
||||
$checked->{template} = template::check( $params->{template}, 'edit_work_time' );
|
||||
|
||||
if ( ( defined $checked->{action} ) && ( $checked->{action} eq 'save_schedule' ) ) {
|
||||
|
||||
#set defaults
|
||||
$checked->{create_events} = 0;
|
||||
$checked->{publish_events} = 0;
|
||||
@@ -325,4 +339,3 @@ sub check_params{
|
||||
return $checked;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#use utf8;
|
||||
use warnings "all";
|
||||
|
||||
#use diagnostics;
|
||||
use strict;
|
||||
use Data::Dumper;
|
||||
@@ -48,7 +49,7 @@ if ($config->{cache}->{use_cache} eq '1'){
|
||||
if ( defined $cache->{content} ) {
|
||||
print $cache->{content};
|
||||
return;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#connect
|
||||
@@ -202,6 +203,6 @@ sub check_params{
|
||||
template => $template,
|
||||
debug => $debug,
|
||||
search => $search,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -3,22 +3,22 @@ Content-type:text/xml; charset=UTF-8
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<station lastupdate="<TMPL_VAR modified_at_datetime_utc>" xmlns:gml="http://www.opengis.net/gml">
|
||||
<info>
|
||||
<displayname>shortRadioName</displayname>
|
||||
<fullname>fullRadioName</fullname>
|
||||
<logo src="https://www.freie-radios.net/" />
|
||||
<displayname>Pi-Radio</displayname>
|
||||
<fullname>Pi-Radio</fullname>
|
||||
<logo src="https://piradio.de/agenda/image/logo.jpg" />
|
||||
<basecolor>#FF6600</basecolor>
|
||||
<city>Berlin</city>
|
||||
<studio>
|
||||
<street>street</street>
|
||||
<number>number</number>
|
||||
<city>city</city>
|
||||
<zip>plz</zip>
|
||||
<street>Lottumstrasse</street>
|
||||
<number>9</number>
|
||||
<city>Berlin</city>
|
||||
<zip>10119</zip>
|
||||
<studio-location>
|
||||
<gml:Point>
|
||||
<gml:pos>52.53119 13.4066</gml:pos>
|
||||
</gml:Point>
|
||||
</studio-location>
|
||||
<phone type="studio">+49 030 1234 5678</phone>
|
||||
<phone type="studio">+49 030 609 37 277</phone>
|
||||
</studio>
|
||||
</info>
|
||||
|
||||
@@ -33,10 +33,8 @@ Content-type:text/xml; charset=UTF-8
|
||||
<transmit-rds-id>88vier</transmit-rds-id>
|
||||
<transmit-times>
|
||||
<transmit-time recurrence="true" />
|
||||
<weekly day="DO" priority="0" time-from="06:00:00" time-to="24:00:00" />
|
||||
<weekly day="FR" priority="0" time-from="00:00:00" time-to="01:00:00" />
|
||||
<weekly day="FR" priority="0" time-from="06:00:00" time-to="24:00:00" />
|
||||
<weekly day="SA" priority="0" time-from="00:00:00" time-to="01:00:00" />
|
||||
<weekly day="MI" priority="0" time-from="19:00:00" time-to="06:00:00" />
|
||||
<weekly day="DO" priority="0" time-from="19:00:00" time-to="06:00:00" />
|
||||
</transmit-times>
|
||||
|
||||
<transmitter-location>
|
||||
@@ -45,9 +43,16 @@ Content-type:text/xml; charset=UTF-8
|
||||
</gml:Point>
|
||||
</transmitter-location>
|
||||
</transmitter>
|
||||
|
||||
<webstream>
|
||||
<transmit-times>
|
||||
<transmit-time time-from="00:00:00" time-to="23:59:59"/>
|
||||
</transmit-times>
|
||||
<url>http://ice.rosebud-media.de:8000/88vier</url>
|
||||
<format>audio/mpeg</format>
|
||||
<quality>160kbps</quality>
|
||||
</webstream>
|
||||
<website>
|
||||
<url>https://www.freie-radios.net/</url>
|
||||
<url>https://piradio.de</url>
|
||||
</website>
|
||||
</media-channels>
|
||||
|
||||
@@ -64,7 +69,7 @@ Content-type:text/xml; charset=UTF-8
|
||||
</categories>
|
||||
<feed>
|
||||
<title>Sendebeschreibung</title>
|
||||
<url>http://localhost<TMPL_VAR cache_base_url>/<TMPL_VAR .controllers.event>/<TMPL_VAR event_id>.html#<TMPL_VAR event_uri escape=url></url>
|
||||
<url>https://piradio.de<TMPL_VAR cache_base_url>/<TMPL_VAR .controllers.event>/<TMPL_VAR event_id>.html#<TMPL_VAR event_uri escape=url></url>
|
||||
</feed>
|
||||
<transmit-times>
|
||||
<transmit-time date-from="<TMPL_VAR start_datetime_utc>" date-to="<TMPL_VAR end_datetime_utc>" recurrence="false" rerun="<TMPL_IF rerun>true<TMPL_ELSE>false</TMPL_IF>" />
|
||||
|
||||
@@ -10,88 +10,106 @@
|
||||
<meta http-equiv="Content-Style-Type" content="text/css" />
|
||||
<title>Playlist <TMPL_VAR project_title></title>
|
||||
|
||||
<style>
|
||||
#coming_shows .eventContainer {
|
||||
display:inline-block;
|
||||
vertical-align:top;
|
||||
text-align:center;
|
||||
cursor:pointer;
|
||||
width:100px;
|
||||
height:100px;
|
||||
margin:0;
|
||||
overflow:hidden;
|
||||
padding:6px;
|
||||
<script>
|
||||
/**
|
||||
* @fileoverview dragscroll - scroll area by dragging
|
||||
* @version 0.0.8
|
||||
*
|
||||
* @license MIT, see http://github.com/asvd/dragscroll
|
||||
* @copyright 2015 asvd <heliosframework@gmail.com>
|
||||
*/
|
||||
|
||||
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(['exports'], factory);
|
||||
} else if (typeof exports !== 'undefined') {
|
||||
factory(exports);
|
||||
} else {
|
||||
factory((root.dragscroll = {}));
|
||||
}
|
||||
#coming_shows .eventContainer:hover {
|
||||
background:#eeeeee;
|
||||
}
|
||||
#coming_shows a:hover {
|
||||
text-decoration:none;
|
||||
}(this, function (exports) {
|
||||
var _window = window;
|
||||
var _document = document;
|
||||
var mousemove = 'mousemove';
|
||||
var mouseup = 'mouseup';
|
||||
var mousedown = 'mousedown';
|
||||
var EventListener = 'EventListener';
|
||||
var addEventListener = 'add'+EventListener;
|
||||
var removeEventListener = 'remove'+EventListener;
|
||||
var newScrollX, newScrollY;
|
||||
|
||||
var dragged = [];
|
||||
var reset = function(i, el) {
|
||||
for (i = 0; i < dragged.length;) {
|
||||
el = dragged[i++];
|
||||
el = el.container || el;
|
||||
el[removeEventListener](mousedown, el.md, 0);
|
||||
_window[removeEventListener](mouseup, el.mu, 0);
|
||||
_window[removeEventListener](mousemove, el.mm, 0);
|
||||
}
|
||||
|
||||
#coming_shows div.event{
|
||||
position:relative;
|
||||
width:100px;
|
||||
height:100px;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center center;
|
||||
background-size: cover;
|
||||
// cloning into array since HTMLCollection is updated dynamically
|
||||
dragged = [].slice.call(_document.getElementsByClassName('dragscroll'));
|
||||
for (i = 0; i < dragged.length;) {
|
||||
(function(el, lastClientX, lastClientY, pushed, scroller, cont){
|
||||
(cont = el.container || el)[addEventListener](
|
||||
mousedown,
|
||||
cont.md = function(e) {
|
||||
if (!el.hasAttribute('nochilddrag') ||
|
||||
_document.elementFromPoint(
|
||||
e.pageX, e.pageY
|
||||
) == cont
|
||||
) {
|
||||
pushed = 1;
|
||||
lastClientX = e.clientX;
|
||||
lastClientY = e.clientY;
|
||||
|
||||
e.preventDefault();
|
||||
}
|
||||
#coming_shows div.event .top,
|
||||
#coming_shows div.event .bottom{
|
||||
position:absolute;
|
||||
background:#222;
|
||||
color:#fff;
|
||||
opacity:0.8;
|
||||
width:100%;
|
||||
}, 0
|
||||
);
|
||||
|
||||
_window[addEventListener](
|
||||
mouseup, cont.mu = function() {pushed = 0;}, 0
|
||||
);
|
||||
|
||||
_window[addEventListener](
|
||||
mousemove,
|
||||
cont.mm = function(e) {
|
||||
if (pushed) {
|
||||
(scroller = el.scroller||el).scrollLeft -=
|
||||
newScrollX = (- lastClientX + (lastClientX=e.clientX));
|
||||
scroller.scrollTop -=
|
||||
newScrollY = (- lastClientY + (lastClientY=e.clientY));
|
||||
if (el == _document.body) {
|
||||
(scroller = _document.documentElement).scrollLeft -= newScrollX;
|
||||
scroller.scrollTop -= newScrollY;
|
||||
}
|
||||
}
|
||||
}, 0
|
||||
);
|
||||
})(dragged[i++]);
|
||||
}
|
||||
#coming_shows div.event .top:hover,
|
||||
#coming_shows div.event .bottom:hover{
|
||||
opacity:1;
|
||||
}
|
||||
|
||||
|
||||
#coming_shows div.event .top{
|
||||
top:0;
|
||||
if (_document.readyState == 'complete') {
|
||||
reset();
|
||||
} else {
|
||||
_window[addEventListener]('load', reset, 0);
|
||||
}
|
||||
|
||||
#coming_shows div.event .bottom{
|
||||
bottom:0;
|
||||
}
|
||||
|
||||
#coming_shows div.event{
|
||||
transition: all .2s ease-in-out;
|
||||
}
|
||||
|
||||
#coming_shows div.event:hover{
|
||||
transform: scale(1.1);
|
||||
}
|
||||
</style>
|
||||
exports.reset = reset;
|
||||
}));
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<script>
|
||||
//handler for sliding events bound to onmouseenter/onmouseleave at playlist_container
|
||||
var slideEvents=1;
|
||||
function enter_playlist(){
|
||||
slideEvents=0;
|
||||
}
|
||||
|
||||
function leave_playlist(){
|
||||
slideEvents=1;
|
||||
}
|
||||
</script>
|
||||
|
||||
<body>
|
||||
<div id="playlist_container" onmouseenter="enter_playlist()" onmouseleave="leave_playlist()">
|
||||
<div id="playlist_container" class="dragscroll">
|
||||
<TMPL_LOOP NAME=events>
|
||||
<div id="event_playlist_<TMPL_VAR event_id>" class="eventContainer"
|
||||
onclick="window.location.href='<TMPL_VAR cache_base_url>/<TMPL_VAR .controllers.event>/<TMPL_VAR event_id>.html#<TMPL_VAR event_uri escape=url>'"
|
||||
>
|
||||
<a href="<TMPL_VAR cache_base_url>/<TMPL_VAR .controllers.event>/<TMPL_VAR event_id>.html#<TMPL_VAR event_uri escape=url>"
|
||||
>
|
||||
<div class="event"
|
||||
style="background-image:url(<TMPL_VAR thumb>)"
|
||||
>
|
||||
<a href="<TMPL_VAR cache_base_url>/<TMPL_VAR .controllers.event>/<TMPL_VAR event_id>.html#<TMPL_VAR event_uri escape=url>" >
|
||||
<div id="event_playlist_<TMPL_VAR event_id>" class="eventContainer event">
|
||||
<div class="top" title="<TMPL_VAR full_title><TMPL_IF excerpt>. <TMPL_VAR excerpt></TMPL_IF>">
|
||||
<TMPL_VAR weekday_short_name> <TMPL_VAR start_time_name>
|
||||
</div>
|
||||
@@ -100,7 +118,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</TMPL_LOOP>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
2
website/agenda/upload_playout.cgi
Normal file → Executable file
2
website/agenda/upload_playout.cgi
Normal file → Executable file
@@ -9,6 +9,7 @@ $CGI::POST_MAX = 1000;
|
||||
$CGI::DISABLE_UPLOADS = 1;
|
||||
|
||||
use Data::Dumper;
|
||||
|
||||
#use Apache2::Request;
|
||||
use JSON;
|
||||
use params;
|
||||
@@ -44,6 +45,7 @@ if ($0=~/upload_playout.*?\.cgi$/){
|
||||
$config->{access}->{write} = 1;
|
||||
my $result = playout::sync( $config, $json );
|
||||
$config->{access}->{write} = 0;
|
||||
|
||||
#print Dumper($content)."\n";
|
||||
#print Dumper($r);
|
||||
#print Dumper($json);
|
||||
|
||||
Reference in New Issue
Block a user