From 76c86aec74593285faae1e4ff8c28ac1d8312d71 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 5 Aug 2010 10:21:08 -0700 Subject: [PATCH] PassiveAnalytics logging. addMissing. --- lib/WebGUI/Content/Asset.pm | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/WebGUI/Content/Asset.pm b/lib/WebGUI/Content/Asset.pm index 6f9770c85..36c00d381 100644 --- a/lib/WebGUI/Content/Asset.pm +++ b/lib/WebGUI/Content/Asset.pm @@ -47,7 +47,9 @@ These subroutines are available from this package: =head2 dispatch ( $session, $assetUrl ) Attempts to return the output from an asset, based on its url. All permutations of the -URL are tried, to find an asset that matches. +URL are tried, to find an asset that matches. If it finds an Asset, then it calls the +dispatch method on it. An Asset's dispatch always returns SOMETHING, so if a matching +asset is found, this is the last stop. =head3 $session @@ -66,6 +68,8 @@ sub dispatch { my $permutations = getUrlPermutations($assetUrl); foreach my $url (@{ $permutations }) { if (my $asset = getAsset($session, $url)) { + ##Passive Analytics Logging + WebGUI::PassiveAnalytics::Logging::log($session, $asset); # display from cache if page hasn't been modified. if ($session->user->isVisitor && !$session->http->ifModifiedSince($asset->getContentLastModified, $session->setting->get('maxCacheTimeout'))) { @@ -78,18 +82,13 @@ sub dispatch { my $fragment = $assetUrl; $fragment =~ s/$url//; my $output = eval { $asset->dispatch($fragment); }; - if ($@) { - $session->errorHandler->warn("Couldn't call method ".$method." on asset for url: ".$session->url->getRequestedUrl." Root cause: ".$@); - if ($method ne "view") { - $output = tryAssetMethod($session,$asset,'view'); - } else { - # fatals return chunked - $output = 'chunked'; - } - } return $output if defined $output; } } + if ($session->var->isAdminOn) { + my $asset = WebGUI::Asset->newByUrl($session, $session->url->getRefererUrl) || WebGUI::Asset->getDefault($session); + return $asset->addMissing($assetUrl); + } return undef; }