From 534855ddc8fb4eb28f51aaa826ce142da57b4fc6 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Wed, 19 Jul 2006 18:10:37 +0000 Subject: [PATCH] add missing filename methods --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Image.pm | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index a6d4eb4a8..f6c3742ef 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -27,6 +27,7 @@ privs to the storage associated with it. (Martin Kamerbeek / Procolix) - Added a reverse page loop option to the navigation asset (Martin Kamerbeek / Procolix) + - fix: WebGUI::Image missing methods - Added runOnLogin and runOnLogout config file properties to Authentication to allow for running an external script on successful login or logout. diff --git a/lib/WebGUI/Image.pm b/lib/WebGUI/Image.pm index 2aab7b1c8..7324d18c1 100644 --- a/lib/WebGUI/Image.pm +++ b/lib/WebGUI/Image.pm @@ -40,6 +40,24 @@ sub getBackgroundColor { #------------------------------------------------------------------- +=head2 getFilename ( ) + +Returns the filename that has been set for this Image. If no filename +has been set, then it throws a fatal error. + +=cut + +sub getFilename { + my $self = shift; + if (exists $self->{_properties}->{filename}) { + return $self->{_properties}->{filename}; + } + $self->session->errorHandler->fatal('Attempted to retrieve filename before one was set'); + return ''; +} + +#------------------------------------------------------------------- + =head2 getImageHeight ( ) Returns the height of the image in pixels. @@ -203,6 +221,19 @@ sub setBackgroundColor { #------------------------------------------------------------------- +=head2 setFilename ($filename) + +Set the default filename to be used for this image. Returns the filename. + +=cut + +sub setFilename { + my ($self,$filename) = shift; + $self->{_properties}->{filename} = $filename; +} + +#------------------------------------------------------------------- + =head2 setImageHeight ( height ) Set the height of the image.