Permalink
Browse files

Bug 8377: Followup move style in a css file and do not pass template …

…to a pm

1/ It's better to set style of the video marked in a css file.

2/ Replace some
  for my $i in (0..#$array)
with
  for my $element in (@array)

3/ the routine in a pm returns a hash not the $template variable

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
  • Loading branch information...
joubu authored and jcamins committed Nov 9, 2012
1 parent 33aa6ec commit 4dbcd077f61c5ac50e209b31ac0ecdc65268639e
View
@@ -36,13 +36,12 @@ This module gets the relevant data from field 856 (MARC21/UNIMARC) to create a H
=head2 gethtml5media
-Get all relevant data from field 856. Takes $template and $record in the subroutine call, sets appropriate params.
+Get all relevant data from field 856. Takes a $record in the subroutine call, sets appropriate params.
=cut
sub gethtml5media {
my $self = shift;
- my $template = shift;
my $record = shift;
my @HTML5Media_sets = ();
my @HTML5Media_fields = $record->field(856);
@@ -189,38 +188,36 @@ sub gethtml5media {
}
}
# parent element
- for my $i ( 0 .. $#HTML5Media_sets ) {
- if ( ($HTML5Media_sets[$i]{mime}) && ($HTML5Media_sets[$i]{mime} =~ /audio/) ) {
+ for my $media ( @HTML5Media_sets ) {
+ if ( ($media->{mime}) && ($media->{mime} =~ /audio/) ) {
if ( $HTML5MediaParent ne 'video' ) {
$HTML5MediaParent = 'audio';
$HTML5MediaWidth = '';
}
}
- elsif ( ($HTML5Media_sets[$i]{mime}) && ($HTML5Media_sets[$i]{mime} =~ /video/) ) {
+ elsif ( ($media->{mime}) && ($media->{mime} =~ /video/) ) {
$HTML5MediaParent = 'video';
$HTML5MediaWidth = ' width="480"';
}
}
# child element
- for my $j ( 0 .. $#HTML5Media_sets ) {
- if ( ($HTML5Media_sets[$j]{type}) && ( ($HTML5Media_sets[$j]{type} eq 'video') || ($HTML5Media_sets[$j]{type} eq 'audio') ) ) {
- if ( $HTML5Media_sets[$j]{type} eq $HTML5MediaParent ) {
- $HTML5Media_sets[$j]{child} = 'source';
+ for my $media ( @HTML5Media_sets ) {
+ if ( ($media->{type}) && ( ($media->{type} eq 'video') || ($media->{type} eq 'audio') ) ) {
+ if ( $media->{type} eq $HTML5MediaParent ) {
+ $media->{child} = 'source';
}
}
else {
- $HTML5Media_sets[$j]{child} = $HTML5Media_sets[$j]{type};
+ $media->{child} = $media->{type};
}
}
- # template parameters
- if ( (scalar(@HTML5Media_sets) > 0) && ($HTML5MediaParent) ) {
- $template->param(
- HTML5MediaEnabled => 1,
- HTML5MediaSets => \@HTML5Media_sets,
- HTML5MediaParent => $HTML5MediaParent,
- HTML5MediaWidth => $HTML5MediaWidth);
- }
- return $template;
+
+ return (
+ HTML5MediaEnabled => ( (scalar(@HTML5Media_sets) > 0) && ($HTML5MediaParent) ),
+ HTML5MediaSets => \@HTML5Media_sets,
+ HTML5MediaParent => $HTML5MediaParent,
+ HTML5MediaWidth => $HTML5MediaWidth,
+ );
}
1;
View
@@ -381,8 +381,8 @@
}
# HTML5 Media
-if ( (C4::Context->preference("HTML5MediaEnabled") eq 'staff') || (C4::Context->preference("HTML5MediaEnabled") eq 'both') ) {
- $template = C4::HTML5Media->gethtml5media($template,$record);
+if ( (C4::Context->preference("HTML5MediaEnabled") eq 'both') or (C4::Context->preference("HTML5MediaEnabled") eq 'staff') ) {
+ $template->param( C4::HTML5Media->gethtml5media($record));
}
@@ -2400,3 +2400,7 @@ div.authorizedheading {
/* jQuery UI Accordion */
.ui-accordion-header { font-weight: bold; font-size : 110%; }
+
+video {
+ width: 480px;
+}
@@ -591,7 +591,7 @@ function verify_images() {
[% IF ( HTML5MediaEnabled ) %]
<div id="html5media">
<p>
- <[% HTML5MediaParent %][% HTML5MediaWidth %] controls preload=none>
+ <[% HTML5MediaParent %] controls preload=none>
[% FOREACH HTML5MediaSet IN HTML5MediaSets %]
<[% HTML5MediaSet.child %] src="[% HTML5MediaSet.srcblock %]"[% HTML5MediaSet.typeblock %] />
[% END %]
@@ -2846,3 +2846,7 @@ body#opac-main #opacmainuserblockmobile {
#patronregistration a {
display: block;
}
+
+video {
+ width: 480px;
+}
@@ -1062,7 +1062,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
[% IF ( HTML5MediaEnabled ) %]
<div id="html5media">
<p>
- <[% HTML5MediaParent %][% HTML5MediaWidth %] controls preload=none>
+ <[% HTML5MediaParent %] controls preload=none>
[% FOREACH HTML5MediaSet IN HTML5MediaSets %]
<[% HTML5MediaSet.child %] src="[% HTML5MediaSet.srcblock %]"[% HTML5MediaSet.typeblock %] />
[% END %]
View
@@ -778,8 +778,8 @@ BEGIN
}
# HTML5 Media
-if ( (C4::Context->preference("HTML5MediaEnabled") eq 'opac') || (C4::Context->preference("HTML5MediaEnabled") eq 'both') ) {
- $template = C4::HTML5Media->gethtml5media($template,$record);
+if ( (C4::Context->preference("HTML5MediaEnabled") eq 'both') or (C4::Context->preference("HTML5MediaEnabled") eq 'opac') ) {
+ $template->param( C4::HTML5Media->gethtml5media($record));
}
my $syndetics_elements;

0 comments on commit 4dbcd07

Please sign in to comment.