Add method to return help if set in AdminConsole

Alter storage object so that errors array is created by default.  This prevent
getErrorCount from dying when fetching the error count and no errors have occured.
Added a method to to return the errors arrayref.
This commit is contained in:
Colin Kuskie 2006-05-10 23:28:50 +00:00
parent 548dfb6f41
commit 5f71b0e5f2
2 changed files with 17 additions and 1 deletions

View file

@ -34,6 +34,7 @@ The admin console is a menuing system to manage webgui's administrative function
addSubmenuItem
getAdminConsoleParams
getAdminFunction
getHelp
new
render
setHelp

View file

@ -47,6 +47,7 @@ This package provides a mechanism for storing and retrieving files that are not
$filename = $store->addFileFromHashref($filename,$hashref);
$filename = $store->addFileFromScalar($filename,$content);
$arrayref = $store->getErrors;
$integer = $store->getErrorCount;
$hashref = $store->getFileContentsAsHashref($filename);
$string = $store->getFileContentsAsScalar($filename);
@ -420,7 +421,7 @@ sub get {
my $id = shift;
return undef unless $id;
$id =~ m/^(.{2})(.{2})/;
my $self = {_session=>$session, _id => $id, _part1 => $1, _part2 => $2};
my $self = {_session=>$session, _id => $id, _part1 => $1, _part2 => $2, _errors => []};
bless $self, ref($class)||$class;
$self->_makePath unless (-e $self->getPath); # create the folder in case it got deleted somehow
return $self;
@ -441,6 +442,20 @@ sub getErrorCount {
}
#-------------------------------------------------------------------
=head2 getErrors ( )
Returns an arrayref with all errors for this object
=cut
sub getErrors {
my $self = shift;
return $self->{_errors};
}
#-------------------------------------------------------------------
=head2 getFileContentsAsScalar ( filename )