View | Details | Raw Unified | Return to bug 8377
Collapse All | Expand All

(-)a/installer/data/mysql/sysprefs.sql (+2 lines)
Lines 375-377 INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( Link Here
375
INSERT INTO systempreferences (variable,value,explanation,type) VALUES('EnableBorrowerFiles','0','If enabled, allows librarians to upload and attach arbitrary files to a borrower record.','YesNo');
375
INSERT INTO systempreferences (variable,value,explanation,type) VALUES('EnableBorrowerFiles','0','If enabled, allows librarians to upload and attach arbitrary files to a borrower record.','YesNo');
376
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UpdateTotalIssuesOnCirc','0','Whether to update the totalissues field in the biblio on each circ.',NULL,'YesNo');
376
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UpdateTotalIssuesOnCirc','0','Whether to update the totalissues field in the biblio on each circ.',NULL,'YesNo');
377
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('IntranetSlipPrinterJS','','Use this JavaScript for printing slips. Define at least function printThenClose(). For use e.g. with Firefox PlugIn jsPrintSetup, see http://jsprintsetup.mozdev.org/','','Free');
377
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('IntranetSlipPrinterJS','','Use this JavaScript for printing slips. Define at least function printThenClose(). For use e.g. with Firefox PlugIn jsPrintSetup, see http://jsprintsetup.mozdev.org/','','Free');
378
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('HTML5MediaEnabled','0','Show a HTML5 media player in a tab on opac-detail.pl for media files catalogued in field 856.','','YesNo');
379
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('HTML5MediaExtensions','webm|ogg|ogv|oga|vtt','Media file extensions','','free');
(-)a/installer/data/mysql/updatedatabase.pl (+8 lines)
Lines 5473-5478 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
5473
    SetVersion($DBversion);
5473
    SetVersion($DBversion);
5474
}
5474
}
5475
5475
5476
$DBversion = 'XXX';
5477
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5478
   $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('HTML5MediaEnabled','0','Show a HTML5 media player in a tab on opac-detail.pl for media files catalogued in field 856.','','YesNo');");
5479
   $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('HTML5MediaExtensions','webm|ogg|ogv|oga|vtt','Media file extensions','','free');");
5480
   print "Upgrade to $DBversion done (Add HTML5MediaEnabled and HTML5MediaExtensions sysprefs)\n";
5481
   SetVersion ($DBversion);
5482
}
5483
5476
=head1 FUNCTIONS
5484
=head1 FUNCTIONS
5477
5485
5478
=head2 TableExists($table)
5486
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref (+12 lines)
Lines 336-338 Enhanced Content: Link Here
336
                  yes: Allow
336
                  yes: Allow
337
                  no: "Don't allow"
337
                  no: "Don't allow"
338
            - multiple images to be attached to each bibliographic record.
338
            - multiple images to be attached to each bibliographic record.
339
    HTML5 Media:
340
        -
341
            - pref: HTML5MediaEnabled
342
              choices:
343
                  yes: Show
344
                  no: "Don't show"
345
            - a HTML5 media player in a tab on opac-detail.pl for media files catalogued in field 856.
346
        -
347
            - Media file extensions
348
            - pref: HTML5MediaExtensions
349
              class: multi
350
            - (separated with |).
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt (+23 lines)
Lines 12-17 Link Here
12
[% IF ( OpacStarRatings != 'disable' ) %]<script type="text/javascript" src="/opac-tmpl/prog/en/lib/jquery/plugins/jquery.rating.js"></script>
12
[% IF ( OpacStarRatings != 'disable' ) %]<script type="text/javascript" src="/opac-tmpl/prog/en/lib/jquery/plugins/jquery.rating.js"></script>
13
<link rel="stylesheet" type="text/css" href="/opac-tmpl/prog/en/css/jquery.rating.css" />[% END %]
13
<link rel="stylesheet" type="text/css" href="/opac-tmpl/prog/en/css/jquery.rating.css" />[% END %]
14
14
15
15
<script type="text/JavaScript" language="JavaScript">
16
<script type="text/JavaScript" language="JavaScript">
16
//<![CDATA[
17
//<![CDATA[
17
18
Lines 678-683 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
678
[% IF ( OPACLocalCoverImages ) %][% IF ( localimages ) %]
679
[% IF ( OPACLocalCoverImages ) %][% IF ( localimages ) %]
679
    <li id="tab_images"><a href="#images">Images</a></li>
680
    <li id="tab_images"><a href="#images">Images</a></li>
680
[% END %][% END %]
681
[% END %][% END %]
682
683
684
[% IF ( HTML5MediaEnabled ) %][% IF ( HTML5MediaSets ) %]
685
    [% IF ( defaulttab == 'html5media' ) %]<li id="tab_html5media" class="ui-tabs-selected">[% ELSE %]<li id="tab_html5media">[% END %]
686
        <a href="#html5media">HTML5 Media</a>
687
    </li>
688
[% END %][% END %]
689
681
</ul>
690
</ul>
682
691
683
[% IF ( serialcollection ) %]
692
[% IF ( serialcollection ) %]
Lines 1165-1170 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
1165
[% END %]
1174
[% END %]
1166
1175
1167
1176
1177
[% IF ( HTML5MediaEnabled ) %]
1178
<div id="html5media">
1179
        <p>
1180
        <[% HTML5MediaParent %][% HTML5MediaWidth %] controls preload=none>
1181
          [% FOREACH HTML5MediaSet IN HTML5MediaSets %]
1182
            <[% HTML5MediaSet.child  %] src="[% HTML5MediaSet.srcblock %]"[% HTML5MediaSet.typeblock %] />
1183
          [% END %]
1184
            [[% HTML5MediaParent %] tag not supported by your browser.]
1185
        </[% HTML5MediaParent %]>
1186
        </p>
1187
</div>
1188
[% END %]
1189
1190
1168
[% IF ( OPACLocalCoverImages ) %]
1191
[% IF ( OPACLocalCoverImages ) %]
1169
<div id="images">
1192
<div id="images">
1170
<p>Click on an image to view it in the image viewer</p>
1193
<p>Click on an image to view it in the image viewer</p>
(-)a/opac/opac-detail.pl (-1 / +185 lines)
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
- 

Return to bug 8377