diff --git a/web/cgi-bin/horas/dialogcommon.pl b/web/cgi-bin/horas/dialogcommon.pl
index f3b54d4cd5e..9aa3781ef20 100644
--- a/web/cgi-bin/horas/dialogcommon.pl
+++ b/web/cgi-bin/horas/dialogcommon.pl
@@ -128,6 +128,9 @@ sub get_dayname_for_condition {
missa => sub {$missanumber},
communi => sub { {summpont => ($version =~ /1960/ || $version =~ /1955/ || $version =~ /Divino/)} },
'die' => \&get_dayname_for_condition,
+ tonus => sub {$chantTone},
+ tonus => sub {$chantTone},
+ hora => sub {$hora},
);
our %predicates = (
tridentina => sub { shift =~ /Trident/ },
@@ -142,6 +145,7 @@ sub get_dayname_for_condition {
longior => sub { shift == 1 },
brevior => sub { shift == 2 },
'summorum pontificum' => sub { ${shift()}{summpont} },
+ 'in solemnitatibus' => sub { shift =~ /solemnis|resurrectionis/i },
);
# parse and evaluate a condition
diff --git a/web/cgi-bin/horas/horas.pl b/web/cgi-bin/horas/horas.pl
index bf2b3567dca..9e1d32d7b43 100644
--- a/web/cgi-bin/horas/horas.pl
+++ b/web/cgi-bin/horas/horas.pl
@@ -37,11 +37,23 @@ sub horas {
our $recitelimit = 0;
$tlang = ($lang1 !~ /Latin/) ? $lang1 : $lang2;
our %translate;
- $translate{$lang1} = setupstring($lang1, "Psalterium/Translate.txt");
- $translate{$lang2} = setupstring($lang2, "Psalterium/Translate.txt");
- cache_prayers();
%chant = %{setupstring('Latin', "Psalterium/Chant.txt")};
$column = 1;
+
+ # Ensure no chant is displayed at the little hours during the Triduum
+ my $templang1 = $lang1; # save settings for later
+ my $templang2 = $lang2;
+ my $temponly = $only;
+ if (triduum_gloria_omitted() && $hora =~ /Prima|Tertia|Sexta|Nona|Completorium/i) {
+ $lang1 =~ s/\-gabc//;
+ $lang2 =~ s/\-gabc//;
+ $only = ($lang1 eq $lang2);
+ precedence(); setsecondcol(); #fills our hashes et variables
+ }
+
+ $translate{$lang1} = setupstring($lang1, "Psalterium/Translate.txt");
+ $translate{$lang2} = setupstring($lang2, "Psalterium/Translate.txt");
+ cache_prayers();
if ($Ck) { $version = $version1; precedence(); }
@script1 = getordinarium($lang1, $command);
@script1 = specials(\@script1, $lang1);
@@ -80,7 +92,7 @@ sub horas {
$text1 =~ s/$alleluia_regex//g;
}
$text1 =~ s/\
\s*\
/\
/g;
- if ($lang1 =~ /Latin/i) { $text1 = spell_var($text1); }
+ if ($lang1 =~ /Latin$/i) { $text1 = spell_var($text1); } # Spell check not for 'Latin-gabc' (destroys chant)
if ($text1 && $text1 !~ /^\s+$/) { setcell($text1, $lang1); }
if (!$only) {
@@ -92,7 +104,7 @@ sub horas {
$text2 =~ s/$alleluia_regex//ig;
}
$text2 =~ s/\
\s*\
/\
/g;
- if ($lang2 =~ /Latin/i) { $text2 = spell_var($text2); }
+ if ($lang2 =~ /Latin$/i) { $text2 = spell_var($text2); } # Spell check not for 'Latin-gabc' (destroys chant)
if ($text2 && $text2 !~ /^\s+$/) { setcell($text2, $lang2); }
}
}
@@ -104,6 +116,11 @@ sub horas {
}
table_end();
if ($column == 1) { $searchind++; }
+
+ # restore original values if changed
+ $lang1 = $templang1;
+ $lang2 = $templang2;
+ $only = $temponly;
}
#*** getunits(\@s, $ind)
@@ -280,12 +297,47 @@ sub teDeum : ScriptFunc {
return "\n_\n!Te Deum\n$prayers{$lang}->{'Te Deum'}";
}
+#*** Deus_in_adjutorium($lang)
+# return Ferial, Festal, or Solemn chant
+sub Deus_in_adjutorium : ScriptFunc {
+ my $lang = shift;
+ our %prayers;
+
+ our ($winner, @dayname);
+ my %latwinner = %{setupstring('Latin', $winner)};
+ my @latrank = split(';;', $latwinner{Rank});
+ my $latname = $latrank[0];
+ my $latrank = $latrank[2];
+
+ # Ferial chant for all Little hours and Ferials and Simples
+ if ($lang !~ /gabc/ || $hora !~ /matutinum|laudes|vespera/i || $rank < 2 || $latname =~ /Feria|Sabbato|Vigilia(?! Epi)/i || $latrank < 2) {
+ our $incipitTone = 'ferial';
+ return $prayers{$lang}->{'Deus in adjutorium'};
+ }
+
+ our $chantTone; # has been filled by setChantTone() @horascommon.pl
+ if ($hora !~ /vespera/i || $chantTone !~ /solemnis|resurrectionis/i) {
+ our $incipitTone = 'festal';
+ return $prayers{$lang}->{'Deus in adjutorium1'}; # Festal tone
+ } else { # Solemn Vespers only
+ our $incipitTone = 'solemn';
+ return $prayers{$lang}->{'Deus in adjutorium2'}; # Solemn tone
+ }
+}
+
#*** Alleluia($lang)
# return the text Alleluia or Laus tibi
sub Alleluia : ScriptFunc {
my $lang = shift;
- our %prayers;
+ our (%prayers, $incipitTone);
my $text = $prayers{$lang}->{'Alleluia'};
+
+ if ($lang =~ /gabc/i && $incipitTone) {
+ $text = ($incipitTone =~ /festal/i) ? $prayers{$lang}->{'Alleluia1'}
+ : ($incipitTone =~ /solemn/i) ? $prayers{$lang}->{'Alleluia2'}
+ : $text;
+ }
+
my @text = split("\n", $text);
if ($dayname[0] =~ /Quad/i && !Septuagesima_vesp()) {
@@ -391,12 +443,18 @@ sub Dominus_vobiscum2 : ScriptFunc { #* officium defunctorum
# adds Alleluia, alleluia for Pasc0
sub Benedicamus_Domino : ScriptFunc {
my $lang = shift;
- our %prayers;
- my $text = $prayers{$lang}->{'Benedicamus Domino'};
- if (Septuagesima_vesp()) { $text = $prayers{$lang}->{'Benedicamus Domino1'}; }
- if ($dayname[0] !~ /Pasc0/i || $hora !~ /(Laudes|Vespera)/i) { return $text; }
- my @text = split("\n", $text);
- return "$text[0] $prayers{$lang}->{'Alleluia Duplex'}\n$text[1] $prayers{$lang}->{'Alleluia Duplex'}\n";
+ our (%prayers, @dayname, $hora, $vespera);
+
+ our $chantTone; # filled by setChantTone() @horascommon.pl
+
+ if (Septuagesima_vesp() || ($dayname[0] =~ /Pasc0/i && $hora =~ /(Laudes|Vespera)/i) && ($lang !~ /gabc/i || $chantTone !~ /resurrectionis/i)) {
+ return $prayers{$lang}->{'Benedicamus Domino1'}; # Paschal octave (Feria IV - Sabbato)
+ } elsif ($lang !~ /gabc/i || $hora !~ /(Matutinum|Laudes|Vespera)/i) {
+ return $prayers{$lang}->{'Benedicamus Domino'}; # Little hours
+ }
+
+ my %benedicamus = %{setupstring($lang, 'Psalterium/Benedicamus.txt')};
+ return ($benedicamus{"$chantTone$vespera"}) || ($benedicamus{"$chantTone"}) || ($prayers{'Latin'}->{'Benedicamus Domino'});
}
#*** antiphona_finalis
@@ -436,7 +494,7 @@ sub psalm : ScriptFunc {
my @a = @_;
my ($num, $lang, $antline, $nogloria);
-
+
if (@a < 4) {
$num = shift @a;
if ($a[0] =~ /^1$/) {
@@ -449,7 +507,7 @@ sub psalm : ScriptFunc {
$lang = $a[3];
$antline = $a[4];
}
-
+
my $canticlef = 230 < $num && $num < 234;
if ($num =~ /^-(.*)/) {
@@ -483,15 +541,33 @@ sub psalm : ScriptFunc {
# the invitatory, lives elsewhere, and is loaded here only for its
# special third-nocturn use on the day of the Epiphany.
my $fname = ($psnum == 94) ? 'Psalterium/Invitatorium1.txt' : "$psalmfolder/Psalm$psnum.txt";
+ my $ftone = ''; # to save the chant tone to retrieve the Gloria Patri below
if ($version =~ /1960|Newcal/) { $fname =~ s/Psalm226/Psalm226r/; }
if ($version =~ /1960|Newcal/ && $num !~ /\(/ && $dayname[0] =~ /Nat/i) { $fname =~ s/Psalm88/Psalm88r/; }
if ($version =~ /1960|Newcal/ && $num !~ /\(/ && $month == 8 && $day == 6) { $fname =~ s/Psalm88/Psalm88a/; }
- $fname = checkfile($lang, $fname);
+
+ # select right Psalm file
+ if ($lang =~ /gabc/i) {
+ if($num > 230 && $num < 233) { $num .= ",$canticaTone"; }
+ $fname = ($num =~ /,/) ? "$psalmfolder/$num.gabc" : "$psalmfolder/Psalm$num.txt"; # distingiush between chant and text
+ $fname =~ s/\:/\./g;
+ $fname =~ s/,/-/g; # file name with dash not comma
+ $num =~ s/\:\:/ \& /g; # Multiple Psalms joined together
+ $num =~ s/\:/; Part: /; # n-th Part of Psalm
+ $num =~ s/,,.*?,,//;
+ $num =~ s/,/; Tone: /; # name Tone in Psalm headline
+ $ftone = ($num =~ /Tone: (.*)/) ? $1 : '';
+ if (!(-e "$datafolder/$lang/$fname")) {
+ $num =~ s/;.*//;
+ $fname = "$psalmfolder/Psalm$num.txt";
+ }
+ }
+ $fname = checkfile($lang, $fname);
# load psalm
my(@lines) = do_read($fname);
unless (@lines > 0) {
- return "$t$datafolder/$lang/$psalmfolder/Psalm$psnum.txt not found";
+ return "$fname not found";
}
# Extract limits of the division of the psalm. (potentially within a psalm verse)
@@ -507,7 +583,7 @@ sub psalm : ScriptFunc {
my $title = translate('Psalmus', $lang) . " $num";
my $source;
- if ($num > 150 && $num < 300 && @lines) {
+ if ($num > 150 && $num < 300 && @lines && $fname !~ /\.gabc/) {
shift(@lines) =~ /\(?(?
.*?) \* (?