From aac1df8dfbd34a1a7cc4cf6f3de7c7de0ceb5439 Mon Sep 17 00:00:00 2001 From: Roy Johnson Date: Thu, 7 Sep 2006 18:17:32 +0000 Subject: [PATCH] fix - makePrintable operation with other styleId --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Operation/Style.pm | 6 ++---- lib/WebGUI/Session/Style.pm | 19 ++++++++++++++++++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 9afc2e629..10e4b3aeb 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -46,6 +46,7 @@ and fixed a bug in sbin/fileUpload.pl wher it didn't handle images with uppercased extensions properly (Martin Kamerbeek / Procolix) - new: In the Project Management asset, tasks can now have multiple resources, which may be users or groups. Original single-resource data is migrated to the new schema by the 7.0.7 upgrade script. + - fix: makePrintable operation with other styleId 7.0.6 - fix: Error in DateTime.pm diff --git a/lib/WebGUI/Operation/Style.pm b/lib/WebGUI/Operation/Style.pm index b77a0f737..fb59f13d7 100644 --- a/lib/WebGUI/Operation/Style.pm +++ b/lib/WebGUI/Operation/Style.pm @@ -12,7 +12,6 @@ package WebGUI::Operation::Style; use strict; use WebGUI::Paginator; - =head1 NAME Package WebGUI::Operation::Style @@ -34,9 +33,8 @@ the printableStyleId is used instead of the normal styleId for the page. sub www_makePrintable { my $session = shift; - if ($session->form->process("styleId") ne "") { - $session->asset->{_properties}{printableStyleTemplateId} = $session->form->process("styleId"); - } + my $styleId = $session->form->process("styleId"); + $session->style->setPrintableStyleId($styleId) if $styleId; $session->style->makePrintable("1"); return ""; } diff --git a/lib/WebGUI/Session/Style.pm b/lib/WebGUI/Session/Style.pm index d5542151f..62d7e1e32 100644 --- a/lib/WebGUI/Session/Style.pm +++ b/lib/WebGUI/Session/Style.pm @@ -153,7 +153,7 @@ sub process { $var{'body.content'} = shift; my $templateId = shift; if ($self->{_makePrintable} && $self->session->asset) { - $templateId = $self->session->asset->get("printableStyleTemplateId"); + $templateId = $self->{_printableStyleId} || $self->session->asset->get("printableStyleTemplateId"); my $currAsset = $self->session->asset; until ($templateId) { # some assets don't have this property. But at least one ancestor should.... @@ -270,7 +270,24 @@ sub setLink { $self->session->output->print($tag) if ($self->sent); } +#------------------------------------------------------------------- +=head2 setPrintableStyleId ( params ) + +Overrides current printable style id defined in assets definition + +=head3 params + +scalar containing id of style to use + +=cut + +sub setPrintableStyleId { + my $self = shift; + my $styleId = shift; + + $self->{_printableStyleId} = $styleId; +} #-------------------------------------------------------------------