Lines 747-752
if (C4::Context->preference("OPACLocalCoverImages")){
Link Here
|
747 |
$template->param(OPACLocalCoverImages => 1); |
747 |
$template->param(OPACLocalCoverImages => 1); |
748 |
} |
748 |
} |
749 |
|
749 |
|
|
|
750 |
# HTML5 Media |
751 |
|
752 |
my @HTML5Media_sets = (); |
753 |
my $HTML5MediaParent; |
754 |
my $HTML5MediaWidth; |
755 |
my @HTML5MediaExtensions = split /\|/, C4::Context->preference("HTML5MediaExtensions"); |
756 |
|
757 |
if ( C4::Context->preference("HTML5MediaEnabled") ) { |
758 |
my @HTML5Media_fields = $record->field(856); |
759 |
foreach my $HTML5Media_field (@HTML5Media_fields) { |
760 |
my %HTML5Media; |
761 |
# protocol |
762 |
if ( $HTML5Media_field->indicator(1) eq '1' ) { |
763 |
$HTML5Media{protocol} = 'ftp'; |
764 |
} |
765 |
elsif ( $HTML5Media_field->indicator(1) eq '4' ) { |
766 |
$HTML5Media{protocol} = 'http'; |
767 |
} |
768 |
elsif ( $HTML5Media_field->indicator(1) eq '7' ) { |
769 |
if ($marcflavour eq 'MARC21' || $marcflavour eq 'NORMARC') { |
770 |
$HTML5Media{protocol} = $HTML5Media_field->subfield('2'); |
771 |
} |
772 |
elsif ($marcflavour eq 'UNIMARC') { |
773 |
$HTML5Media{protocol} = $HTML5Media_field->subfield('y'); |
774 |
} |
775 |
} |
776 |
else { |
777 |
$HTML5Media{protocol} = 'http'; |
778 |
} |
779 |
# user |
780 |
if ( $HTML5Media_field->subfield('l') ) { |
781 |
$HTML5Media{username} = $HTML5Media_field->subfield('l'); # yes, that is arbitrary if h and l are not the same. originally i flipped a coin in that case. |
782 |
} |
783 |
elsif ( $HTML5Media_field->subfield('h') ) { |
784 |
$HTML5Media{username} = $HTML5Media_field->subfield('h'); |
785 |
} |
786 |
# user/pass |
787 |
if ( $HTML5Media{username} && $HTML5Media_field->subfield('k') ) { |
788 |
$HTML5Media{loginblock} = $HTML5Media{username} . ':' . $HTML5Media_field->subfield('k') . '@'; |
789 |
} |
790 |
elsif ( $HTML5Media{username} ) { |
791 |
$HTML5Media{loginblock} = $HTML5Media{username} . '@'; |
792 |
} |
793 |
else { |
794 |
$HTML5Media{loginblock} = ''; |
795 |
} |
796 |
# port |
797 |
if ( $HTML5Media_field->subfield('p') ) { |
798 |
$HTML5Media{portblock} = ':' . $HTML5Media_field->subfield('k'); |
799 |
} |
800 |
else { |
801 |
$HTML5Media{portblock} = ''; |
802 |
} |
803 |
# src |
804 |
if ( $HTML5Media_field->subfield('u') ) { |
805 |
$HTML5Media{srcblock} = $HTML5Media_field->subfield('u'); |
806 |
} |
807 |
elsif ( $HTML5Media_field->subfield('a') && $HTML5Media_field->subfield('d') && $HTML5Media_field->subfield('f') ) { |
808 |
$HTML5Media{host} = $HTML5Media_field->subfield('a'); |
809 |
$HTML5Media{host} =~ s/(^\/|\/$)//g; |
810 |
$HTML5Media{path} = $HTML5Media_field->subfield('d'); |
811 |
$HTML5Media{path} =~ s/(^\/|\/$)//g; |
812 |
$HTML5Media{file} = $HTML5Media_field->subfield('f'); |
813 |
$HTML5Media{srcblock} = $HTML5Media{protocol} . '://' . $HTML5Media{loginblock} . $HTML5Media{host} . $HTML5Media{portblock} . '/' . $HTML5Media{path} . '/' . $HTML5Media{file}; |
814 |
} |
815 |
else { |
816 |
next; # no file to play |
817 |
} |
818 |
# extension |
819 |
$HTML5Media{extension} = ($HTML5Media{srcblock} =~ m/([^.]+)$/)[0]; |
820 |
if ( !grep /$HTML5Media{extension}/, @HTML5MediaExtensions ) { |
821 |
next; # not a specified media file |
822 |
} |
823 |
# mime |
824 |
if ( $HTML5Media_field->subfield('c') ) { |
825 |
$HTML5Media{codecs} = $HTML5Media_field->subfield('c'); |
826 |
} |
827 |
### from subfield q… |
828 |
if ( $HTML5Media_field->subfield('q') ) { |
829 |
$HTML5Media{mime} = $HTML5Media_field->subfield('q'); |
830 |
} |
831 |
### …or from file extension and codecs… |
832 |
elsif ( $HTML5Media{codecs} ) { |
833 |
if ( $HTML5Media{codecs} =~ /theora.*vorbis/ ) { |
834 |
$HTML5Media{mime} = 'video/ogg'; |
835 |
} |
836 |
elsif ( $HTML5Media{codecs} =~ /vp8.*vorbis/ ) { |
837 |
$HTML5Media{mime} = 'video/webm'; |
838 |
} |
839 |
elsif ( ($HTML5Media{codecs} =~ /^vorbis$/) && ($HTML5Media{extension} eq 'ogg') ) { |
840 |
$HTML5Media{mime} = 'audio/ogg'; |
841 |
} |
842 |
elsif ( ($HTML5Media{codecs} =~ /^vorbis$/) && ($HTML5Media{extension} eq 'webm') ) { |
843 |
$HTML5Media{mime} = 'audio/webm'; |
844 |
} |
845 |
} |
846 |
### …or just from file extension |
847 |
else { |
848 |
if ( $HTML5Media{extension} eq 'ogv' ) { |
849 |
$HTML5Media{mime} = 'video/ogg'; |
850 |
$HTML5Media{codecs} = 'theora,vorbis'; |
851 |
} |
852 |
if ( $HTML5Media{extension} eq 'oga' ) { |
853 |
$HTML5Media{mime} = 'audio/ogg'; |
854 |
$HTML5Media{codecs} = 'vorbis'; |
855 |
} |
856 |
elsif ( $HTML5Media{extension} eq 'spx' ) { |
857 |
$HTML5Media{mime} = 'audio/ogg'; |
858 |
$HTML5Media{codecs} = 'speex'; |
859 |
} |
860 |
elsif ( $HTML5Media{extension} eq 'opus' ) { |
861 |
$HTML5Media{mime} = 'audio/ogg'; |
862 |
$HTML5Media{codecs} = 'opus'; |
863 |
} |
864 |
elsif ( $HTML5Media{extension} eq 'vtt' ) { |
865 |
$HTML5Media{mime} = 'text/vtt'; |
866 |
} |
867 |
} |
868 |
# codecs |
869 |
if ( $HTML5Media{codecs} ) { |
870 |
$HTML5Media{codecblock} = '; codecs="' . $HTML5Media{codecs} . '"'; |
871 |
} |
872 |
else { |
873 |
$HTML5Media{codecblock} = ''; |
874 |
} |
875 |
# type |
876 |
if ( $HTML5Media{mime} ) { |
877 |
$HTML5Media{typeblock} = ' type=\'' . $HTML5Media{mime} . $HTML5Media{codecblock} . '\''; |
878 |
} |
879 |
else { |
880 |
$HTML5Media{typeblock} = ''; |
881 |
} |
882 |
# element |
883 |
if ( $HTML5Media{mime} =~ /audio/ ) { |
884 |
$HTML5Media{type} = 'audio'; |
885 |
} |
886 |
elsif ( $HTML5Media{mime} =~ /video/ ) { |
887 |
$HTML5Media{type} = 'video'; |
888 |
} |
889 |
elsif ( $HTML5Media{mime} =~ /text/ ) { |
890 |
$HTML5Media{type} = 'track'; |
891 |
} |
892 |
# push |
893 |
if ( $HTML5Media{srcblock} && $HTML5Media{type} ) { |
894 |
push (@HTML5Media_sets, \%HTML5Media); |
895 |
} |
896 |
} |
897 |
# parent element |
898 |
for my $i ( 0 .. $#HTML5Media_sets ) { |
899 |
if ( $HTML5Media_sets[$i]{mime} =~ /audio/ ) { |
900 |
if ( $HTML5MediaParent ne 'video' ) { |
901 |
$HTML5MediaParent = 'audio'; |
902 |
$HTML5MediaWidth = ''; |
903 |
} |
904 |
} |
905 |
elsif ( $HTML5Media_sets[$i]{mime} =~ /video/ ) { |
906 |
$HTML5MediaParent = 'video'; |
907 |
$HTML5MediaWidth = ' width="480"'; |
908 |
} |
909 |
} |
910 |
# child element |
911 |
for my $j ( 0 .. $#HTML5Media_sets ) { |
912 |
if ( ($HTML5Media_sets[$j]{type} eq 'video') || ($HTML5Media_sets[$j]{type} eq 'audio') ) { |
913 |
if ( $HTML5Media_sets[$j]{type} eq $HTML5MediaParent ) { |
914 |
$HTML5Media_sets[$j]{child} = 'source'; |
915 |
} |
916 |
} |
917 |
else { |
918 |
$HTML5Media_sets[$j]{child} = $HTML5Media_sets[$j]{type}; |
919 |
} |
920 |
} |
921 |
# template parameters |
922 |
if ( (scalar(@HTML5Media_sets) > 0) && ($HTML5MediaParent) ) { |
923 |
$template->param( |
924 |
HTML5MediaEnabled => 1, |
925 |
HTML5MediaSets => \@HTML5Media_sets, |
926 |
HTML5MediaParent => $HTML5MediaParent, |
927 |
HTML5MediaWidth => $HTML5MediaWidth); |
928 |
} |
929 |
} |
930 |
|
931 |
|
750 |
# Amazon.com Stuff |
932 |
# Amazon.com Stuff |
751 |
if ( C4::Context->preference("OPACAmazonEnabled") ) { |
933 |
if ( C4::Context->preference("OPACAmazonEnabled") ) { |
752 |
$template->param( AmazonTld => get_amazon_tld() ); |
934 |
$template->param( AmazonTld => get_amazon_tld() ); |
Lines 983-988
if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
Link Here
|
983 |
# the user wants, and what's available for display |
1165 |
# the user wants, and what's available for display |
984 |
my $opac_serial_default = C4::Context->preference('opacSerialDefaultTab'); |
1166 |
my $opac_serial_default = C4::Context->preference('opacSerialDefaultTab'); |
985 |
my $defaulttab = |
1167 |
my $defaulttab = |
|
|
1168 |
@HTML5Media_sets > 0 |
1169 |
? 'html5media' : |
986 |
$opac_serial_default eq 'subscriptions' && $subscriptionsnumber |
1170 |
$opac_serial_default eq 'subscriptions' && $subscriptionsnumber |
987 |
? 'subscriptions' : |
1171 |
? 'subscriptions' : |
988 |
$opac_serial_default eq 'serialcollection' && @serialcollections > 0 |
1172 |
$opac_serial_default eq 'serialcollection' && @serialcollections > 0 |
Lines 995-1000
my $defaulttab =
Link Here
|
995 |
? 'serialcollection' : 'subscription'; |
1179 |
? 'serialcollection' : 'subscription'; |
996 |
$template->param('defaulttab' => $defaulttab); |
1180 |
$template->param('defaulttab' => $defaulttab); |
997 |
|
1181 |
|
|
|
1182 |
|
998 |
if (C4::Context->preference('OPACLocalCoverImages') == 1) { |
1183 |
if (C4::Context->preference('OPACLocalCoverImages') == 1) { |
999 |
my @images = ListImagesForBiblio($biblionumber); |
1184 |
my @images = ListImagesForBiblio($biblionumber); |
1000 |
$template->{VARS}->{localimages} = \@images; |
1185 |
$template->{VARS}->{localimages} = \@images; |
1001 |
- |
|
|