calendar.js: show/hide excerpts

This commit is contained in:
Milan
2022-01-27 21:45:29 +01:00
parent d881d9b8e0
commit 591a2f41b0
4 changed files with 55 additions and 10 deletions

View File

@@ -211,9 +211,9 @@ sub showCalendar {
#build event filter
$options = {
project_id => $project_id,
template => 'no',
template => 'html',
limit => 600,
get => 'no_content',
#get => 'no_content',
from_date => $from,
till_date => $till,
date_range_include => 1,
@@ -257,6 +257,7 @@ sub showCalendar {
unless ( $params->{list} == 1 ) {
for my $event (@$events) {
$event->{origStart} = $event->{start};
$event->{origContent} = $event->{origContent};
}
$events = break_dates( $events, $start_of_day );
}
@@ -735,6 +736,7 @@ sub showEventList {
my $playoutIcon = qq{<img src="image/play.svg">};
my $processingIcon = qq{<img src="image/processsing.svg">};
my $preparedIcon = qq{<img src="image/prepared.svg>};
my $creoleIcon = qq{<img src="image/creole.svg>};
my $out = '';
$out = qq{
@@ -757,6 +759,7 @@ sub showEventList {
<th class="archive">$archiveIcon</th>
<th class="project_id">project</th>
<th class="studio">studio</th>
<th class="creole">creole</th>
</tr>
</thead>
<tbody>
@@ -864,6 +867,8 @@ sub showEventList {
my $playout_info = $file // $event->{upload_status} // '';
my $studio_name = $event->{studio_name} // '-';
my $format = {"markdown" => "-", "creole" => "Lang Belta" }->{$event->{content_format}} // 'Lang Belta';
$out .=
qq!<tr id="$id" class="$class" start="$event->{start}" >!
. qq!<td class="day_of_year">!
@@ -883,6 +888,7 @@ sub showEventList {
. qq!<td class="archived">$archived</td>!
. qq!<td>$event->{project_name} $other_studio</td>!
. qq!<td>$studio_name $other_studio</td>!
. qq!<td>$format</td>!
. qq!</tr>! . "\n";
}
$i++;
@@ -927,6 +933,7 @@ sub showEventList {
var label_schedule='} . $params->{loc}->{label_schedule} . q{';
var label_worktime='} . $params->{loc}->{label_worktime} . q{';
var label_playout='} . $params->{loc}->{label_playout} . q{';
var label_descriptions='} . $params->{loc}->{label_descriptions} . q{';
var label_pin='} . $params->{loc}->{label_pin} . q{';
</script>
</body>
@@ -1207,9 +1214,9 @@ sub printTableBody {
)
. ' '
if defined $event->{duration};
$event->{content} .= audio::formatLoudness( $event->{rms_left}, 'L: ' ) . ' '
$event->{content} .= audio::formatLoudness( $event->{rms_left}, 'L: ' ,'round') . ' '
if defined $event->{rms_left};
$event->{content} .= audio::formatLoudness( $event->{rms_right}, 'R: ' )
$event->{content} .= audio::formatLoudness( $event->{rms_right}, 'R: ','round' )
if defined $event->{rms_right};
#$event->{content} .= formatBitrate( $event->{bitrate} ) if defined $event->{bitrate};
$event->{content} .= '</span>';
@@ -1296,6 +1303,7 @@ sub printJavascript {
var label_events='} . $params->{loc}->{label_events} . q{';
var label_schedule='} . $params->{loc}->{label_schedule} . q{';
var label_worktime='} . $params->{loc}->{label_worktime} . q{';
var label_descriptions='} . $params->{loc}->{label_descriptions} . q{';
var label_playout='} . $params->{loc}->{label_playout} . q{';
var label_pin='} . $params->{loc}->{label_pin} . q{';
</script>
@@ -1519,8 +1527,10 @@ sub print_event {
$height = '';
}
# my $date = $event->{origStart} || $event->{start} || '';
my $content = $event->{content} || '';
my $content = '<div class="header">';
$content .= qq!<img class="icon" src="!.($event->{series_icon_url}).q!">! if $class=~/event/;
$content .= $event->{content} || '';
$content .= '</div>';
if ( $class =~ /schedule/ ) {
my $frequency = getFrequency($event);
@@ -1537,6 +1547,11 @@ sub print_event {
$content .= '<br>uploading <progress max="10" ></progress> ';
}
$content .= q{<div class="scrollable">};
$content .= q{<div class="excerpt">}.$event->{excerpt}.q{</div>} if defined $event->{excerpt};
$content .= q{<div class="excerpt">}.$event->{html_topic}.q{</div>} if defined $event->{topic};
$content .= q{</div>};
if ($showIcons) {
my $attr = { map { $_ => undef } split( /\s+/, $class) };
@@ -1547,8 +1562,8 @@ sub print_event {
my $playoutClass = qq{<img src="image/play.svg">};
my $processingClass = qq{<img src="image/processing.svg">};
my $preparedClass = qq{<img src="image/prepare.svg">};
my $icons='';
my $icons = '';
if ( exists $attr->{event} ){
my $playout = '';
if (exists $attr->{upload_status}){
@@ -1568,14 +1583,14 @@ sub print_event {
if exists $attr->{archived};
}
$content = qq{<div class="text">$content</div><div class="icons">$icons</div>};
$content = qq{<div class="text" style="$height">$content</div><div class="icons">$icons</div>};
}
my $time = '';
$time = qq{ time="$event->{time}"} if $class =~ m/time/;
my $date = '';
$date = qq{ date="$event->{date}"} if $class =~ m/date/;
$date = qq{ date="$event->{date}"} if $class =~ m/date/;
my $line = q{<div } . qq{class="$class" id="$id"};
$line .= qq{ style="} . $height . q{top:} . $ystart . q{px;"};

View File

@@ -193,6 +193,12 @@ function updateUrlParameters(url){
url=setUrlParameter(url, 'p', 0);
}
if(isChecked('#show_descriptions')){
url=setUrlParameter(url, 'd', 1);
}else{
url=setUrlParameter(url, 'd', 0);
}
var filter=$('#filter').val();
if(filter!='no markup')
url=setUrlParameter(url, 'filter', $filter);
@@ -239,6 +245,14 @@ function show_playout(){
}
}
function show_descriptions(){
if(isChecked('#show_descriptions')){
$('#calendar .excerpt').css("display",'');
}else{
$('#calendar .excerpt').css("display",'none');
}
}
//get date and time from column and row to select a timeslot
function getNearestDatetime(){
var date="test";
@@ -449,6 +463,7 @@ function initCalendarMenu(){
html += getSwitch('show_events', label_events || "label", true);
html += getSwitch('show_schedule', label_schedule || "schedule", true);
html += getSwitch('show_playout', label_playout || "playout", true);
html += getSwitch('show_descriptions', label_descriptions || "descriptions", false);
html += getSwitch('show_worktime', label_worktime || "worktime", false);
html += getSwitch('pin', label_pin || "label", false, 'right');
$('#toolbar').append(html);
@@ -457,6 +472,7 @@ function initCalendarMenu(){
if(getUrlParameter('e')=='0') unselectCheckbox('#show_events' );
if(getUrlParameter('p')=='0') unselectCheckbox('#show_playout' );
if(getUrlParameter('w')=='0') unselectCheckbox('#show_worktime');
if(getUrlParameter('d')=='0') unselectCheckbox('#show_descriptions');
setSelectedOptions();
setFilter();
@@ -641,6 +657,7 @@ function updateTable(){
show_events();
show_playout();
show_worktime();
show_descriptions();
$('#show_events').off();
$('#show_events').on("click",
@@ -663,6 +680,13 @@ function updateTable(){
updateUrls();
}
);
$('#show_descriptions').off();
$('#show_descriptions').on("click",
function(){
show_descriptions();
updateUrls();
}
);
$('#show_worktime').off();
$('#show_worktime').on("click",
function(){

View File

@@ -37,6 +37,9 @@ msgstr "Planung"
msgid "label_worktime"
msgstr "Studiodienst"
msgid "label_descriptions"
msgstr "Beschreibungen"
msgid "label_playout"
msgstr "Playout"

View File

@@ -34,6 +34,9 @@ msgstr "schedule"
msgid "label_worktime"
msgstr "worktime"
msgid "label_descriptions"
msgstr "descriptions"
msgid "label_playout"
msgstr "playout"