Merge branch 'WebGUI8' into psgi

Conflicts:
	sbin/testEnvironment.pl
This commit is contained in:
Patrick Donelan 2010-06-04 21:01:03 -04:00
commit f16ba76b86
109 changed files with 1546 additions and 2197 deletions

View file

@ -80,7 +80,7 @@ property url => (
builder => '_default_url',
);
sub _default_url {
return $_[0]->assetId;
return $_[0]->fixUrl;
}
around url => sub {
@ -307,25 +307,16 @@ sub _build_className {
}
has keywords => (
is => 'rw',
init_arg => undef,
builder => '_build_assetKeywords',
lazy => 1,
traits => [ 'WebGUI::Definition::Meta::Settable' ],
);
sub _build_assetKeywords {
my $session = shift->session;
return WebGUI::Keyword->new($session);
}
around keywords => sub {
my $orig = shift;
my $self = shift;
if (@_) {
return $self->$orig->setKeywordsForAsset({asset => $self, keywords => $_[0], });
}
else {
return $self->$orig->getKeywordsForAsset({asset => $self});
}
};
my $session = $self->session;
my $keywords = WebGUI::Keyword->new($session);
return $keywords->getKeywordsForAsset({asset => $self, asArrayRef => 1 });
}
around BUILDARGS => sub {
my $orig = shift;
@ -374,7 +365,7 @@ around BUILDARGS => sub {
if (defined $properties) {
$properties->{session} = $session;
return $className->$orig($properties);
}
}
$session->errorHandler->error("Something went wrong trying to instanciate a '$className' with assetId '$assetId', but I don't know what!");
return undef;
};
@ -710,7 +701,9 @@ sub fixUrl {
# build a URL from the parent
unless ($url) {
$url = $self->getParent->url;
if (my $parent = $self->getParent) {
$url = $parent->url;
}
$url =~ s/(.*)\..*/$1/;
$url .= '/'.$self->menuTitle;
}
@ -845,26 +838,6 @@ sub getClassById {
}
#-------------------------------------------------------------------
=head2 getWwwCacheKey ( )
Returns a cache object specific to this asset, and whether or not the request is in SSL mode.
=cut
sub getWwwCacheKey {
my $self = shift;
my $session = $self->session;
my $method = shift;
my $cacheKey = join '_', @_, $self->getId;
if ($session->env->sslRequest) {
$cacheKey .= '_ssl';
}
return $cacheKey;
}
#-------------------------------------------------------------------
=head2 getContainer ( )
@ -883,6 +856,23 @@ sub getContainer {
}
}
#-------------------------------------------------------------------
=head2 getContentLastModified
Returns the overall modification time of the object and its content in Unix
epoch format, for the purpose of the Last-Modified HTTP header. Override this
for subclasses that contain content that is not solely lastModified property,
which gets updated every time update() is called.
=cut
sub getContentLastModified {
my $self = shift;
return $self->get("lastModified");
}
#-------------------------------------------------------------------
=head2 getDefault ( session )
@ -1711,18 +1701,34 @@ sub getUrl {
#-------------------------------------------------------------------
=head2 getContentLastModified
=head2 getViewCacheKey ( )
Returns the overall modification time of the object and its content in Unix
epoch format, for the purpose of the Last-Modified HTTP header. Override this
for subclasses that contain content that is not solely lastModified property,
which gets updated every time update() is called.
Returns the cache key for content generated by this Asset's view method.
=cut
sub getContentLastModified {
sub getViewCacheKey {
my $self = shift;
return $self->get("lastModified");
return 'view_'.$self->assetId;
}
#-------------------------------------------------------------------
=head2 getWwwCacheKey ( )
Returns a cache object specific to this asset, and whether or not the request is in SSL mode.
=cut
sub getWwwCacheKey {
my $self = shift;
my $session = $self->session;
my $method = shift;
my $cacheKey = join '_', @_, $self->getId;
if ($session->env->sslRequest) {
$cacheKey .= '_ssl';
}
return $cacheKey;
}
@ -2468,6 +2474,7 @@ sub write {
# update the asset's size, which also purges the cache.
$self->setSize();
WebGUI::Keyword->new($self->session)->setKeywordsForAsset({ asset => $self, keywords => $self->keywords });
}