diff --git a/lib/calcms/series_dates.pm b/lib/calcms/series_dates.pm index a7c308c..f0cb1ea 100644 --- a/lib/calcms/series_dates.pm +++ b/lib/calcms/series_dates.pm @@ -548,8 +548,9 @@ sub getDatesWithoutEvent ($$) { return unless defined $options->{till}; my $dbh = db::connect($config); + my $cond = $options->{series_id} ? 'and sd.series_id = ?' : ''; - my $query = q{ + my $query = qq{ SELECT sd.* FROM calcms_series_dates sd LEFT JOIN calcms_events e on (sd.start = e.start) @@ -557,12 +558,17 @@ sub getDatesWithoutEvent ($$) { and sd.exclude != 1 and sd.project_id = ? and sd.studio_id = ? + $cond and sd.start > ? and sd.end < ? order by sd.start }; - my $bind_values = [ $options->{project_id}, $options->{studio_id}, $options->{from}, $options->{till} ]; + my $bind_values = [ + $options->{project_id}, $options->{studio_id}, + $options->{series_id} ? $options->{series_id} : (), + $options->{from}, $options->{till} + ]; my $entries = db::get( $dbh, $query, $bind_values ); return $entries; diff --git a/website/agenda/planung/create-events.cgi b/website/agenda/planung/create-events.cgi index fb33e39..2a8ff5f 100755 --- a/website/agenda/planung/create-events.cgi +++ b/website/agenda/planung/create-events.cgi @@ -130,6 +130,7 @@ sub getDates { my $project_id = $params->{project_id}; my $studio_id = $params->{studio_id}; + my $series_id = $params->{series_id}; my $from_date = $params->{from_date}; my $till_date = $params->{till_date}; my $duration = $params->{duration}; @@ -154,13 +155,15 @@ sub getDates { { project_id => $project_id, studio_id => $studio_id, + $series_id ? (series_id => $series_id) : (), from => $from_date, - till => $till_date + till => $till_date, } ); my $series = series::get( $config, { project_id => $project_id, - studio_id => $studio_id + studio_id => $studio_id, + $series_id ? (series_id => $series_id) : () }); my %series_by_id = map { $_->{series_id} => $_ } @$series; for my $date (@$dates) { @@ -209,7 +212,7 @@ sub check_params { $checked->{exclude} = 0; $checked->{duration} = 28; entry::set_numbers( $checked, $params, [ - 'id', 'project_id', 'studio_id', 'duration']); + 'id', 'project_id', 'studio_id', 'series_id', 'duration']); $checked->{"duration".$checked->{duration}}='selected="selected"'; if ( defined $checked->{studio_id} ) { diff --git a/website/agenda/planung/css/create-events.css b/website/agenda/planung/css/create-events.css new file mode 100644 index 0000000..d377b27 --- /dev/null +++ b/website/agenda/planung/css/create-events.css @@ -0,0 +1,11 @@ +@charset "UTF-8"; + +#content td.label { + max-width: none; +} + +#content #seriesContainer { + max-width: 80ch; + overflow:clip; + text-overflow: ellipsis; +} \ No newline at end of file diff --git a/website/agenda/planung/js/create-events.js b/website/agenda/planung/js/create-events.js new file mode 100644 index 0000000..86fbd72 --- /dev/null +++ b/website/agenda/planung/js/create-events.js @@ -0,0 +1,18 @@ +function selectChangeSeries(resultSelector){ + var url='select-series.cgi?' + new URLSearchParams({ + project_id : getProjectId(), + studio_id : getStudioId(), + series_id : getUrlParameter('series_id'), + resultElemId: resultSelector, + selectSeries: 1, + }).toString(); + updateContainer('seriesContainer', url, function(){ + $('#selectSeries').removeClass('panel'); + var series_id = $('input[name=series_id]').val(); + if (series_id.length) $("option[value='"+series_id+"']").attr('selected','selected'); + }); +} + +$(document).ready(function() { + selectChangeSeries('select_series_id'); +}); diff --git a/website/agenda/planung/templates/create-events.html b/website/agenda/planung/templates/create-events.html index 3fd1e63..12deb46 100644 --- a/website/agenda/planung/templates/create-events.html +++ b/website/agenda/planung/templates/create-events.html @@ -1,17 +1,24 @@ - + + + +

create events from schedule

- schedule events for + + schedule events for + schedule events for +
+ @@ -45,8 +54,9 @@
- - + + - missing permission to read events + +missing permission to read events