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

View File

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

View File

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

View File

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