From: <mp...@kr...> - 2009-09-28 20:53:44
|
Revision: 6254 Author: mpeters Date: 2009-09-28 16:53:27 -0400 (Mon, 28 Sep 2009) Log Message: ----------- dont look at this elements data if nothing is there Modified Paths: -------------- trunk/krang/docs/changelog.pod trunk/krang/lib/Krang/ElementClass/MediaLink.pm Modified: trunk/krang/docs/changelog.pod =================================================================== --- trunk/krang/docs/changelog.pod 2009-09-25 20:02:06 UTC (rev 6253) +++ trunk/krang/docs/changelog.pod 2009-09-28 20:53:27 UTC (rev 6254) @@ -6,6 +6,12 @@ =over +Fixed error when publishing a MediaLink element that didn't actually +have a media object selected. Now we just silently return and continue +with the publish. [Michael Peters] + +=over + Normalize Unicode characters coming in so that we always have single grapheme characters. Unicode can have "composed" characters where the same character is actually represented by combining multiple characters. Modified: trunk/krang/lib/Krang/ElementClass/MediaLink.pm =================================================================== --- trunk/krang/lib/Krang/ElementClass/MediaLink.pm 2009-09-25 20:02:06 UTC (rev 6253) +++ trunk/krang/lib/Krang/ElementClass/MediaLink.pm 2009-09-28 20:53:27 UTC (rev 6254) @@ -252,32 +252,27 @@ # See Krang::ElementClass->fill_template for more information. # sub fill_template { - my $self = shift; - my %args = @_; - + my ($self, %args) = @_; my $tmpl = $args{tmpl}; my $publisher = $args{publisher}; my $element = $args{element}; + my $data = $element->data; +# return unless $data; + my %params = (); + my $width = $data->width; + my $height = $data->height; - $params{title} = $element->data()->title() - if $tmpl->query(name => 'title'); - $params{caption} = $element->data()->caption() - if $tmpl->query(name => 'caption'); - $params{url} = $element->template_data(publisher => $publisher); - - my $width = $element->data->width; - my $height = $element->data->height; - - $params{width} = $width if $tmpl->query(name => 'width'); - $params{height} = $height if $tmpl->query(name => 'height'); + $params{title} = $data->title if $tmpl->query(name => 'title'); + $params{caption} = $data->caption if $tmpl->query(name => 'caption'); + $params{width} = $width if $tmpl->query(name => 'width'); + $params{height} = $height if $tmpl->query(name => 'height'); $params{image_dimensions} = "width='$width' height='$height'" if $tmpl->query(name => 'image_dimensions'); $tmpl->param(\%params); - } =head1 NAME |