Merge commit '63865eb39f' into WebGUI8. up to 7.9.11

This commit is contained in:
Colin Kuskie 2010-08-13 11:52:08 -07:00
commit 7b218942b3
72 changed files with 3085 additions and 407 deletions

View file

@ -267,6 +267,7 @@ property skipNotification => (
autoGenerate => 0,
noFormPost => 1,
fieldType => 'yesNo',
default => 0,
);
has session => (
@ -394,6 +395,7 @@ require WebGUI::ProgressBar;
use WebGUI::Search::Index;
use WebGUI::TabForm;
use WebGUI::Utility;
use WebGUI::PassiveAnalytics::Logging;
=head1 NAME
@ -657,6 +659,80 @@ If specified, stores it, but also updates extraHeadTagsPacked with the packed ve
#-------------------------------------------------------------------
=head2 dispatch ( $fragment )
Based on the URL and query parameters in the current request, call internal methods
like www_view, www_edit, etc. If no query parameter is present, then it returns the output
from the www_view method. If the requested method does not exist in the object, it returns
the output from the www_view method.
=head3 $fragment
Any leftover part of the requested URL.
=cut
sub dispatch {
my ($self, $fragment) = @_;
return undef if $fragment;
my $session = $self->session;
my $state = $self->get('state');
##Only allow interaction with assets in certain states
return if $state ne 'published' && $state ne 'archived' && !$session->var->isAdminOn;
my $func = $session->form->param('func') || 'view';
my $viewing = $func eq 'view' ? 1 : 0;
my $sub = $self->can('www_'.$func);
if (!$sub && $func ne 'view') {
$sub = $self->can('www_view');
$viewing = 1;
}
return undef unless $sub;
my $output = eval { $self->$sub(); };
if (my $e = Exception::Class->caught('WebGUI::Error::ObjectNotFound::Template')) {
#WebGUI::Error::ObjectNotFound::Template
$session->log->error(sprintf "%s templateId: %s assetId: %s", $e->error, $e->templateId, $e->assetId);
}
elsif ($@) {
my $message = $@;
$session->log->warn("Couldn't call method www_".$func." on asset for url: ".$session->url->getRequestedUrl." Root cause: ".$message);
}
return $output if $output || $viewing;
##No output, try the view method instead
$output = eval { $self->www_view };
if (my $e = Exception::Class->caught('WebGUI::Error::ObjectNotFound::Template')) {
$session->log->error(sprintf "%s templateId: %s assetId: %s", $e->error, $e->templateId, $e->assetId);
return "chunked";
}
elsif ($@) {
warn "logged another warn: $@";
my $message = $@;
$session->log->warn("Couldn't call method www_view on asset for url: ".$session->url->getRequestedUrl." Root cause: ".$@);
return "chunked";
}
return $output;
}
#-------------------------------------------------------------------
=head2 drawExtraHeadTags ( )
Draw the Extra Head Tags. Done with a customDrawMethod because the Template
will override this.
=cut
sub drawExtraHeadTags {
my ($self, $params) = @_;
return WebGUI::Form::codearea($self->session, {
name => $params->{name},
value => $self->get($params->{name}),
defaultValue => undef,
});
}
#-------------------------------------------------------------------
=head2 fixUrl ( [value] )
Returns a URL, removing invalid characters and making it unique by

View file

@ -101,6 +101,7 @@ override addRevision => sub {
if ($newSelf->storageId && $newSelf->storageId eq $self->storageId) {
my $newStorage = $self->getStorageClass->get($self->session, $self->storageId)->copy;
$newSelf->update({storageId => $newStorage->getId});
$newSelf->applyConstraints;
}
return $newSelf;

View file

@ -1733,6 +1733,7 @@ sub www_edit {
name => "metadata_".$meta->{$field}{fieldId},
uiLevel => 5,
value => $meta->{$field}{value},
defaultValue => $meta->{$field}{defaultValue},
extras => qq/title="$meta->{$field}{description}"/,
options => $options,
fieldType => $fieldType,

View file

@ -0,0 +1,245 @@
package WebGUI::Asset::Wobject::AssetReport;
$VERSION = "1.0.0";
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
use strict;
use Tie::IxHash;
use WebGUI::International;
use WebGUI::Paginator;
use WebGUI::Utility;
use WebGUI::Form::AssetReportQuery;
use Moose;
use WebGUI::Definition::Asset;
extends 'WebGUI::Asset::Wobject';
define assetName => ['assetName', 'Asset_AssetReport.pm'];
define tableName => 'AssetReport';
property settings => (
tab => 'properties',
fieldType => 'AssetReportQuery',
default => undef,
label => '',
);
property templateId => (
tab => "display",
fieldType => "template",
namespace => "AssetReport",
default => "sJtcUCfn0CVbKdb4QM61Yw",
label => ["templateId label", 'Asset_AssetReport.pm'],
hoverHelp => ["templateId description", 'Asset_AssetReport.pm'],
);
property paginateAfter => (
tab => 'display',
fieldType => 'integer',
default => 25,
label => [ 'paginateAfter label' , 'Asset_AssetReport.pm'],
hoverHelp => [ 'paginateAfter description' , 'Asset_AssetReport.pm'],
);
#-------------------------------------------------------------------
=head2 canAdd ( session )
Class method to verify that the user has the privileges necessary to add this type of asset. Return a boolean.
Override this method to ensure that admin is the default group.
Only allow admins to add AssetReport as AssetReport currently bypasses normal
asset security measures.
=head3 session
The session variable.
=cut
sub canAdd {
my $class = shift;
my $session = shift;
$class->SUPER::canAdd($session, undef, '3');
}
#----------------------------------------------------------------------------
=head2 prepareView ( )
Prepare the view. Add stuff to HEAD.
=cut
around prepareView => sub {
my $orig = shift;
my $self = shift;
$self->$orig(@_);
my $session = $self->session;
# Prepare the template
my $template = WebGUI::Asset::Template->new( $session, $self->templateId );
if (!$template) {
WebGUI::Error::ObjectNotFound::Template->throw(
error => qq{Template not found},
templateId => $self->get("templateId"),
assetId => $self->getId,
);
}
$template->prepare;
$self->{_template} = $template;
return;
};
#----------------------------------------------------------------------------
=head2 getTemplateVars ( )
Get template variables common to all views of the Asset Report.
=cut
sub getTemplateVars {
my $self = shift;
my $session = $self->session;
my $db = $session->db;
my $var = $self->get;
#Build the lineage query
my $settings = JSON->new->decode($self->settings);
#TO DO - ADD CACHE CONTROL
my $assetId = $settings->{startNode};
my $asset = WebGUI::Asset->newById($session,$assetId);
my $rules = {};
$rules->{'isa'} = $settings->{className};
#Build where condition
my $condition = $settings->{anySelect};
$rules->{'whereClause'} = undef;
my $where = $settings->{where};
foreach my $key (sort(keys %{$where})) {
my $clause = $where->{$key};
my $prop = $self->secure_identifier($clause->{propSelect});
my $op = $self->validate_clause($clause->{opSelect});
my $value = $db->quote($clause->{valText});
$rules->{'whereClause'} .= qq{ $condition } if ($key > 1);
$rules->{'whereClause'} .= qq{$prop $op $value};
}
if($rules->{'whereClause'}) {
$rules->{'joinClass'} = $settings->{className};
}
#Build the order by condition
my $order = $settings->{order};
my @order = sort(keys %{$order});
if(scalar(@order)) {
$rules->{'orderByClause'} = undef;
foreach my $key (@order) {
my $orderBy = $order->{$key};
my $orderSelect = $self->secure_identifier($orderBy->{orderSelect});
my $dirSelect = (lc($orderBy->{dirSelect}) eq "desc") ? "DESC" : "ASC";
$rules->{'orderByClause'} .= q{, } if($key > 1);
$rules->{'orderByClause'} .= qq{$orderSelect $dirSelect};
}
}
if($settings->{'limit'}) {
$rules->{'limit'} = $settings->{'limit'};
}
my $sql = $asset->getLineageSql(["descendants"],$rules);
my $p = WebGUI::Paginator->new($session,$self->getUrl,$self->paginateAfter);
$p->setDataByQuery($sql);
#Build the data for all the assets on the page
$var->{'asset_loop'} = [];
my $data = $p->getPageData;
ROW: foreach my $row (@{$data}) {
my $returnAsset = eval { WebGUI::Asset->newById($session, $row->{assetId}); };
next ROW if Exception::Class->caught();
push(@{$var->{'asset_loop'}}, $returnAsset->get);
}
#Append template variables
$p->appendTemplateVars($var);
return $var;
}
#----------------------------------------------------------------------------
=head2 secure_identifier ( identifier )
Checks the identifier and passes back a secure string.
=cut
sub secure_identifier {
my $self = shift;
my $db = $self->session->db;
my $identifier = shift;
my @parts = split(/\./,$identifier);
if(scalar(@parts) > 1) {
my $table = $parts[0];
my $column = $parts[1];
$identifier = $db->dbh->quote_identifier($table).".".$db->dbh->quote_identifier($column);
}
else {
$identifier = $db->dbh->quote_identifier($identifier);
}
return $identifier;
}
#----------------------------------------------------------------------------
=head2 validate_clause ( clause )
validates a clause against valid types. Returns "=" if no match is found.
=cut
sub validate_clause {
my $self = shift;
my $clause = shift;
my $ops = WebGUI::Form::AssetReportQuery->getOps();
unless ($ops->{$clause}) {
$clause = "=";
}
return $clause;
}
#----------------------------------------------------------------------------
=head2 view ( )
method called by the www_view method. Returns a processed template
to be displayed within the page style.
=cut
sub view {
my $self = shift;
my $var = $self->getTemplateVars;
return $self->processTemplate( $var, undef, $self->{_template} );
}
1;

View file

@ -61,6 +61,14 @@ sub _newsletterCategories_options {
return $session->db->buildHashRef("select fieldId, fieldName from metaData_properties where fieldType in ('selectBox', 'checkList', 'radioList') order by fieldName");
}
# XXX TODO: Do this in Moose instead, if we can.
# # Change the default Collaboration template
# for my $def ( @$definition ) {
# if ( exists $def->{properties}->{collaborationTemplateId} ) {
# $def->{properties}->{collaborationTemplateId}->{defaultValue} = 'newslettercs0000000001';
# }
# }
use WebGUI::Form;
use WebGUI::International;
use WebGUI::Utility;

View file

@ -24,6 +24,7 @@ property data => (
fieldType => 'DataTable',
default => undef,
label => '',
dateFormat => \&getDateFormat,
);
property templateId => (
tab => "display",
@ -120,6 +121,41 @@ sub getDataTemplateVars {
#----------------------------------------------------------------------------
=head2 getDateFormat ( )
Get the current date format for the current user in a strftime format that YUI can
understand.
=cut
sub getDateFormat {
my ( $self ) = @_;
my $dateFormat
= WebGUI::DateTime->new( $self->session )->webguiToStrftime( $self->session->user->get('dateFormat') );
# Special handle %_varmonth_ super special WebGUI field that strftime doesn't have
$dateFormat =~ s/%_varmonth_/%m/g;
return $dateFormat;
}
#----------------------------------------------------------------------------
=head2 getEditTabs ( )
Add a tab for the data table.
=cut
sub getEditTabs {
my $self = shift;
my $i18n = WebGUI::International->new( $self->session, "Asset_DataTable" );
return ( $self->SUPER::getEditTabs, [ "data" => $i18n->get("tab label data") ], );
}
#----------------------------------------------------------------------------
=head2 getTemplateVars ( )
Get the template vars for this asset.
@ -159,6 +195,7 @@ sub prepareView {
name => $self->getId,
value => $self->data,
defaultValue => undef,
dateFormat => $self->getDateFormat,
}
);
$dt->prepare;

View file

@ -1123,7 +1123,6 @@ sub www_getCompareFormData {
$parameter->{value} = $form->process($param);
my $attributeId = $param;
$attributeId =~ s/^search_//;
$attributeId =~ s/_____/-/g;
$parameter->{attributeId} = $attributeId;
push(@searchParamList, $db->quote($parameter->{attributeId}) );
push(@searchParams, $parameter);
@ -1175,20 +1174,17 @@ sub www_getCompareFormData {
$checked = 'checked';
}
}
$result->{assetId} =~ s/-/_____/g;
push @results, $result if $checked eq 'checked';
}
}
else {
foreach my $result (@{$self->getListings}) {
$result->{assetId} =~ s/-/_____/g;
push @results, $result;
}
}
}
else {
foreach my $result (@{$self->getListings}) {
$result->{assetId} =~ s/-/_____/g;
if(WebGUI::Utility::isIn($result->{assetId},@listingIds)){
$result->{checked} = 'checked';
}
@ -1233,7 +1229,6 @@ sub www_getCompareListData {
my @responseFields = ("attributeId", "name", "description","fieldType", "checked");
foreach my $listingId (@listingIds){
$listingId =~ s/_____/-/g;
my $listing = WebGUI::Asset::MatrixListing->newById($session,$listingId);
$listing->incrementCounter("compares");
my $listingId_safe = $listingId;

View file

@ -49,6 +49,23 @@ property storyTemplateId => (
namespace => 'Story',
default => 'TbDcVLbbznPi0I0rxQf2CQ',
);
property storySortOrder => (
fieldType => "selectBox",
tab => 'display',
default => 'Chronologically',
options => \&_storySortOrder_options,
label => ['sortAlphabeticallyChronologically', 'Asset_StoryArchive'],
hoverHelp => ['sortAlphabeticallyChronologically description', 'Asset_StoryArchive'],
);
sub _storySortOrder_options {
my $session = shift->session;
my $i18n = WebGUI::International->new($session, 'Asset_StoryArchive');
return {
Alphabetically => $i18n->get('alphabetically'),
Chronologically => $i18n->get('chronologically'),
};
}
with 'WebGUI::Role::Asset::RssFeed';
@ -147,10 +164,11 @@ sub viewTemplateVariables {
my $wordList = WebGUI::Keyword::string2list($self->keywords);
my $key = WebGUI::Keyword->new($session);
my $p = $key->getMatchingAssets({
keywords => $wordList,
isa => 'WebGUI::Asset::Story',
usePaginator => 1,
rowsPerPage => $numberOfStories,
sortOrder => $self->get('storySortOrder') || 'Chronologically',
keywords => $wordList,
isa => 'WebGUI::Asset::Story',
usePaginator => 1,
rowsPerPage => $numberOfStories,
});
my $storyIds = $p->getPageData();
$var->{story_loop} = [];
@ -180,7 +198,7 @@ sub viewTemplateVariables {
push @{$var->{story_loop}}, $storyVars;
}
if ($self->{_standAlone}) {
if ($self->{_standAlone} and @$storyIds) {
my $topStoryData = $storyIds->[0];
shift @{ $var->{story_loop} };
##Note, this could have saved from the loop above, but this looks more clean and encapsulated to me.

View file

@ -350,7 +350,8 @@ sub view {
my $self = shift;
my $form = $self->session->form;
my $url = $self->session->url;
my $url = $self->session->url;
my $dbh = $self->session->db->dbh;
my $i18n = WebGUI::International->new($self->session, "Asset_UserList");
my (%var, @users, @profileField_loop, @profileFields);
my ($user, $sth, $sql, $profileField);
@ -432,7 +433,6 @@ sub view {
# Query user profile data. Exclude the visitor account and users that have been deactivated.
$sql = "select distinct users.userId, users.userName, userProfileData.publicProfile ";
# Include remaining profile fields in the query
my $dbh = $self->session->db->dbh;
foreach my $profileField (@profileFields){
$sql .= ", userProfileData." . $dbh->quote_identifier($profileField->{fieldName});
}
@ -441,22 +441,22 @@ sub view {
my $constraint;
my @profileSearchFields = ();
my $searchType = $form->process('searchType') || 'or';
my $searchType = lc $form->process('searchType') eq 'and' ? 'and' : 'or';
if ($form->process('search')){
# Normal search with one keyword takes precedence over other search options
if($form->process('limitSearch')){
# Normal search with one keyword in a limited number of fields
foreach my $profileField (@profileFields){
if ($form->process('includeInSearch_'.$profileField->{fieldName})){
push(@profileSearchFields,'userProfileData.'.$profileField->{fieldName}
.' like "%'.$form->process('search').'%"');
push(@profileSearchFields, 'userProfileData.'.$dbh->quote_identifier($profileField->{fieldName})
.' like '. $dbh->quote('%'.$form->process('search').'%'));
}
}
}
else{
# Normal search with one keyword in all fields
$constraint = "(".join(' or ', map {'userProfileData.'.$_->{fieldName}
.' like "%'.$form->process('search').'%"'} @profileFields).")";
$constraint = "(".join(' or ', map {'userProfileData.'.$dbh->quote_identifier($_->{fieldName})
.' like '.$dbh->quote('%'.$form->process('search').'%')} @profileFields).")";
}
}
elsif ($form->process('searchExact')){
@ -465,15 +465,15 @@ sub view {
# Exact search with one keyword in a limited number of fields
foreach my $profileField (@profileFields){
if ($form->process('includeInSearch_'.$profileField->{fieldName})){
push(@profileSearchFields,'userProfileData.'.$profileField->{fieldName}
.' like "'.$form->process('search').'"');
push(@profileSearchFields,'userProfileData.'.$dbh->quote_identifier($profileField->{fieldName})
.' like '.$dbh->quote($form->process('search')));
}
}
}
else{
# Exact search with one keyword in all fields
$constraint = "(".join(' or ', map {'userProfileData.'.$_->{fieldName}
.' like "'.$form->process('searchExact').'"'} @profileFields).")";
$constraint = "(".join(' or ', map {'userProfileData.'.$dbh->quote_identifier($_->{fieldName})
.' like ' . $dbh->quote($form->process('searchExact'))} @profileFields).")";
}
}
else{
@ -481,12 +481,12 @@ sub view {
foreach my $profileField (@profileFields){
# Exact search has precedence over normal search
if ($form->process('searchExact_'.$profileField->{fieldName})){
push(@profileSearchFields,'userProfileData.'.$profileField->{fieldName}
.' like "'.$form->process('searchExact_'.$profileField->{fieldName}).'"');
push(@profileSearchFields,'userProfileData.'.$dbh->quote_identifier($profileField->{fieldName})
.' like '. $dbh->quote($form->process('searchExact_'.$profileField->{fieldName})));
}
elsif ($form->process('search_'.$profileField->{fieldName})){
push(@profileSearchFields,'userProfileData.'.$profileField->{fieldName}
.' like "%'.$form->process('search_'.$profileField->{fieldName}).'%"');
push(@profileSearchFields,'userProfileData.'.$dbh->quote_identifier($profileField->{fieldName})
.' like '. $dbh->quote('%'.$form->process('search_'.$profileField->{fieldName})));
}
}
}
@ -495,14 +495,17 @@ sub view {
}
$sql .= " and ".$constraint if ($constraint);
my $sortBy = $form->process('sortBy') || $self->sortBy || 'users.username';
my $sortBy = $form->process('sortBy') || $self->sortBy || 'users.username';
my $sortOrder = $form->process('sortOrder') || $self->sortOrder || 'asc';
if (lc $sortOrder ne 'desc') {
$sortOrder = 'asc';
}
my @sortByUserProperties = ('dateCreated', 'lastUpdated', 'karma', 'userId');
if(isIn($sortBy,@sortByUserProperties)){
$sortBy = 'users.'.$sortBy;
}
$sortBy = join '.', map { $self->session->db->quoteIdentifier($_) } split /\./, $sortBy;
$sortBy = join '.', map { $dbh->quote_identifier($_) } split /\./, $sortBy;
$sql .= " order by ".$sortBy." ".$sortOrder;
my $paginatePage = $form->param('pn') || 1;

View file

@ -554,7 +554,11 @@ sub getKeywordHierarchy {
my $datum = {
title => $keyword, ##Note, same as keyword
url => $self->getUrl('func=byKeyword;keyword='.$keyword),
descendants => scalar @{ $assetKeyword->getMatchingAssets( { startAsset => $self, keyword => $keyword, }) },
descendants => scalar @{ $assetKeyword->getMatchingAssets( {
startAsset => $self,
keyword => $keyword,
sortOrder => 'Alphabetically',
}) },
};
##Prevent recursion if seen again
if (! $seen->{$keyword}++) {

View file

@ -19,6 +19,7 @@ use LWP::MediaTypes qw(guess_media_type);
use Time::HiRes;
use WebGUI::Asset;
use WebGUI::PassiveAnalytics::Logging;
use URI;
=head1 NAME
@ -41,6 +42,57 @@ 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. 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
A WebGUI::Session object.
=head4 $assetUrl
The URL for this request.
=cut
sub dispatch {
my $session = shift;
my $assetUrl = shift;
return undef unless $assetUrl;
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'))) {
$session->http->setStatus("304","Content Not Modified");
$session->http->sendHeader;
$session->close;
return "chunked";
}
my $fragment = $assetUrl;
$fragment =~ s/$url//;
$session->asset($asset);
my $output = eval { $asset->dispatch($fragment); };
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;
}
#-------------------------------------------------------------------
=head2 getAsset ( session [, assetUrl ] )
Returns an asset based upon the requested asset URL, or optionally pass one in.
@ -73,6 +125,36 @@ sub getRequestedAssetUrl {
#-------------------------------------------------------------------
=head2 getUrlPermutations ( $url )
Returns an array reference of permutations for the URL.
=head3 $url
The URL to permute.
=cut
sub getUrlPermutations {
my $url = shift;
my @permutations = ();
return \@permutations if !$url;
if ($url =~ /\.\w+$/) {
push @permutations, $url;
$url =~ s/\.\w+$//;
}
my $uri = URI->new($url);
my @fragments = $uri->path_segments();
FRAG: while (@fragments) {
last FRAG if $fragments[-1] eq '';
push @permutations, join "/", @fragments;
pop @fragments;
}
return \@permutations;
}
#-------------------------------------------------------------------
=head2 handler ( session )
The content handler for this package.
@ -85,26 +167,28 @@ sub handler {
my $output = "";
if (my $perfLog = $errorHandler->performanceLogger) { #show performance indicators if required
my $t = [Time::HiRes::gettimeofday()];
$output = page($session);
$perfLog->({ time => Time::HiRes::tv_interval($t), type => 'Page'});
}
else {
my $asset = getAsset($session, getRequestedAssetUrl($session));
# display from cache if page hasn't been modified.
if ($var->get("userId") eq "1"
&& defined $asset
&& !$http->ifModifiedSince($asset->getContentLastModified, $session->setting->get('maxCacheTimeout'))) {
$http->setStatus(304);
$http->sendHeader;
return "chunked";
$output = dispatch($session, getRequestedAssetUrl($session));
$t = Time::HiRes::tv_interval($t) ;
if ($output =~ /<\/title>/) {
$output =~ s/<\/title>/ : ${t} seconds<\/title>/i;
}
# return the page.
else {
$output = page($session, undef, $asset);
else {
# Kludge.
my $mimeType = $http->getMimeType();
if ($mimeType eq 'text/css') {
$session->output->print("\n/* Page generated in $t seconds. */\n");
}
elsif ($mimeType =~ m{text/html}) {
$session->output->print("\nPage generated in $t seconds.\n");
}
else {
# Don't apply to content when we don't know how
# to modify it semi-safely.
}
}
}
else {
$output = dispatch($session, getRequestedAssetUrl($session));
}
my $filename = $http->getStreamedFile();
@ -122,89 +206,4 @@ sub handler {
return $output;
}
#-------------------------------------------------------------------
=head2 page ( session , [ assetUrl ] )
Processes operations (if any), then tries the requested method on the asset corresponding to the requested URL. If that asset fails to be created, it tries the default page.
=head3 session
The current WebGUI::Session object.
=head3 assetUrl
Optionally pass in a URL to be loaded.
=cut
sub page {
my $session = shift;
my $assetUrl = getRequestedAssetUrl($session, shift);
my $asset = shift || getAsset($session, $assetUrl);
my $output = undef;
if (defined $asset) {
my $method = "view";
if ($session->form->param("func")) {
$method = $session->form->param("func");
unless ($method =~ /^[A-Za-z0-9]+$/) {
$session->errorHandler->security("to call a non-existent method $method on $assetUrl");
$method = "view";
}
}
##Passive Analytics Logging
WebGUI::PassiveAnalytics::Logging::log($session, $asset);
$output = tryAssetMethod($session,$asset,$method);
$output = tryAssetMethod($session,$asset,"view") unless ($output || ($method eq "view"));
}
if ($output eq "") {
if ($session->var->isAdminOn) { # they're expecting it to be there, so let's help them add it
my $asset = WebGUI::Asset->newByUrl($session, $session->url->getRefererUrl);
if (Exception::Class->caught()) {
$asset = WebGUI::Asset->getDefault($session);
}
$output = $asset->addMissing($assetUrl);
}
}
return $output;
}
#-------------------------------------------------------------------
=head2 tryAssetMethod ( session )
Tries an asset method on the requested asset. Tries the "view" method if that method fails.
=head3 session
The current WebGUI::Session object.
=cut
sub tryAssetMethod {
my $session = shift;
my $asset = shift;
my $method = shift;
my $state = $asset->get("state");
return undef if ($state ne "published" && $state ne "archived" && !$session->var->isAdminOn); # can't interact with an asset if it's not published
$session->asset($asset);
my $methodToTry = "www_".$method;
my $output = eval{$asset->$methodToTry()};
if (my $e = Exception::Class->caught('WebGUI::Error::ObjectNotFound::Template')) {
$session->errorHandler->error(sprintf "%s templateId: %s assetId: %s", $e->error, $e->templateId, $e->assetId);
}
elsif ($@) {
$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;
}
1;

View file

@ -486,6 +486,63 @@ sub session {
=head2 webguiToStrftime ( format )
Change a WebGUI format into a Strftime format.
NOTE: %M in WebGUI's format has no equivalent in strftime format, so it will
be replaced with "_varmonth_". Do something with it.
=cut
sub webguiToStrftime {
my ( $self, $format ) = @_;
$format ||= "%z %Z";
my $session = $self->session;
my $temp;
#--- date format preference
$temp = $session->user->profileField('dateFormat') || '%y-%M-%D';
$format =~ s/\%z/$temp/g;
#--- time format preference
$temp = $session->user->profileField('timeFormat') || '%H:%n %p';
$format =~ s/\%Z/$temp/g;
#--- convert WebGUI date formats to DateTime formats
my %conversion = (
"c" => "B",
"C" => "b",
"d" => "d",
"D" => "e",
"h" => "I",
"H" => "l",
"j" => "H",
"J" => "k",
"m" => "m",
"M" => "_varmonth_",
"n" => "M",
"t" => "Z",
"O" => "z",
"p" => "P",
"P" => "p",
"s" => "S",
"V" => "V",
"w" => "A",
"W" => "a",
"y" => "Y",
"Y" => "y"
);
$format =~ s/\%(\w)/\~$1/g;
foreach my $key (keys %conversion) {
my $replacement = $conversion{$key};
$format =~ s/\~$key/\%$replacement/g;
}
return $format;
}
#######################################################################
=head2 webguiDate ( format )
@ -527,53 +584,14 @@ sub webguiDate {
my $self = shift;
my $session = $self->session;
return undef unless ($session);
my $format = shift || "%z %Z";
my $temp;
#---date format preference
$temp = $session->user->profileField('dateFormat') || '%y-%M-%D';
$format =~ s/\%z/$temp/g;
#---time format preference
$temp = $session->user->profileField('timeFormat') || '%H:%n %p';
$format =~ s/\%Z/$temp/g;
#--- convert WebGUI date formats to DateTime formats
my %conversion = (
"c" => "B",
"C" => "b",
"d" => "d",
"D" => "e",
"h" => "I",
"H" => "l",
"j" => "H",
"J" => "k",
"m" => "m",
"M" => "_varmonth_",
"n" => "M",
"t" => "Z",
"O" => "z",
"p" => "P",
"P" => "p",
"s" => "S",
"V" => "V",
"w" => "A",
"W" => "a",
"y" => "Y",
"Y" => "y"
);
$format =~ s/\%(\w)/\~$1/g;
foreach my $key (keys %conversion) {
my $replacement = $conversion{$key};
$format =~ s/\~$key/\%$replacement/g;
}
my $format = $self->webguiToStrftime( shift || "%z %Z" );
#--- %M
my $datestr = $self->strftime($format);
$temp = int($self->month);
my $temp = int($self->month);
$datestr =~ s/\%_varmonth_/$temp/g;
#--- return
return $datestr;
}

View file

@ -0,0 +1,424 @@
package WebGUI::Form::AssetReportQuery;
use strict;
use base 'WebGUI::Form::Control';
use JSON;
use WebGUI::International;
use WebGUI::Utility;
=head1 NAME
WebGUI::Form::AssetReportQuery -- Builds a form to collect query information used by Asset Report
=head1 SYNOPSIS
=head1 DESCRIPTION
=head1 METHODS
=cut
#-------------------------------------------------------------------
=head2 getDatabaseFieldType ( )
Returns "MEDIUMTEXT".
=cut
sub getDatabaseFieldType {
return "MEDIUMTEXT";
}
#----------------------------------------------------------------------------
=head2 getAnyList
Get the operator list.
=cut
sub getAnyList {
my $self = shift;
my $i18n = $self->i18n;
tie my %options, 'Tie::IxHash', (
'or' => $i18n->get("any option"),
'and' => $i18n->get("all option"),
);
return \%options;
}
#----------------------------------------------------------------------------
=head2 getDirs
Get the direction list.
=cut
sub getDirs {
my $self = shift;
my $i18n = $self->i18n;
tie my %options, 'Tie::IxHash', (
'asc' => $i18n->get("ascending option"),
'desc' => $i18n->get("descending option"),
);
return \%options;
}
#----------------------------------------------------------------------------
=head2 getOps
Get the operator list.
=cut
sub getOps {
my $self = shift;
tie my %options, 'Tie::IxHash', (
'=' => '=',
'<>' => '<>',
'>' => '>',
'>=' => '>=',
'<' => '<',
'<=' => '<=',
'LIKE' => 'LIKE',
'NOT LIKE' => 'NOT LIKE',
'IS NULL' => 'IS NULL',
'IS NOT NULL' => 'IS NOT NULL',
);
return \%options;
}
#----------------------------------------------------------------------------
=head2 getValue ()
Get the value of the form
=cut
sub getValue {
my $self = shift;
my $session = $self->session;
my $form = $session->form;
my $propCount = $form->process("propCount","hidden");
my $orderCount = $form->process("orderCount","hidden");
if($propCount) {
my $where = {};
my $whereCount = 1;
for(my $i = 0; $i < $propCount; $i++ ) {
my $propSelect = $form->process("propSelect_".$i,"selectBox");
if($propSelect ne "") {
my $opSelect = $form->process("opSelect_".$i,"selectBox");
my $valText = $form->process("valText_".$i,"text");
$where->{$whereCount} = {
propSelect => $propSelect,
opSelect => $opSelect,
valText => $valText,
};
$whereCount++;
}
}
my $orderBy = {};
my $orderByCount = 1;
for(my $i = 0; $i < $orderCount; $i++ ) {
my $orderSelect = $form->process("orderSelect_".$i,"selectBox");
if($orderSelect ne "") {
my $dirSelect = $form->process("dirSelect_".$i,"selectBox");
$orderBy->{$orderByCount} = {
"orderSelect" => $orderSelect,
"dirSelect" => $dirSelect,
};
$orderByCount++;
}
}
my $jsonHash = {
isNew => "false",
className => $form->process("className","selectBox"),
startNode => $form->process("startNode","asset"),
anySelect => $form->process("anySelect","selectBox"),
where => $where,
whereCount => $whereCount,
order => $orderBy,
orderCount => $orderByCount,
limit => $form->process("limit","integer"),
};
my $jsonStr = JSON->new->canonical->encode($jsonHash);
#Set the value in the form
$self->set('value',$jsonStr);
}
return $self->get('value') || $self->get('defaultValue');
}
#-------------------------------------------------------------------
=head2 i18n
Returns the i18n object for the form
=cut
sub i18n {
my $self = shift;
my $session = $self->session;
unless ($self->{_i18n}) {
$self->{_i18n}
= WebGUI::International->new($session,'Form_AssetReportQuery');
}
return $self->{_i18n};
}
#----------------------------------------------------------------------------
=head2 toHtml
Render the form control.
=cut
sub toHtml {
my $self = shift;
my $session = $self->session;
my $db = $session->db;
my $style = $session->style;
my $i18n = $self->i18n;
#Build a JSON Array of all the possible classes and their fields
my $json = {};
#Get all of the classes being used in the WebGUI instance
my $classes = $db->buildArrayRef(q{
SELECT
distinct className
FROM
asset
ORDER BY
className
});
#Hard code these for now
my %asset = (
"asset.creationDate" => $i18n->get("creationDate (asset)"),
"asset.createdBy" => $i18n->get("createdBy (asset)"),
"asset.stateChanged" => $i18n->get("stateChanged (asset)"),
"asset.stateChangedBy" => $i18n->get("stateChangedBy (asset)"),
"asset.isLockedBy" => $i18n->get("isLockedBy (asset)"),
);
#Get the fields from the definition of each class
foreach my $class (@{$classes}) {
my $definitions = $class->definition($session);
tie my %fields, "Tie::IxHash", ();
foreach my $definition (@{$definitions}) {
my $properties = $definition->{properties};
my $tableName = $definition->{tableName};
foreach my $property (keys %{$properties}) {
my $key = $tableName.".".$property;
$fields{$key} = qq{$property ($tableName)};
}
}
%fields = (%asset,%fields);
%fields = WebGUI::Utility::sortHash(%fields);
$json->{$class} = \%fields;
}
#Encode the JSON and add it to the end of the body
my $first_row_error_msg = $i18n->get("first_row_error_msg");
my $jsonStr = JSON->new->encode($json);
$style->setRawHeadTags(qq|<script type="text/javascript">var classValues = $jsonStr; </script>|);
my $jsonData = $self->get("value") || q|{ "isNew" : "true" }|;
$style->setRawHeadTags(qq|<script type="text/javascript">var dataValues = $jsonData; var first_row_error_msg = '$first_row_error_msg';</script>|);
$session->style->setScript($session->url->extras("yui-webgui/build/form/assetReportQuery.js"),{ type=>"text/javascript" });
#Decode JSON data for filling in some of the fields
my $jsonDataHash = JSON->new->decode($jsonData);
#Class select list
my $classSelect = WebGUI::Form::selectBox($session,{
name =>"className",
value => "",
options => {},
extras => q{onchange="loadClassName(this.value);"},
});
#Start Node
my $startNode = WebGUI::Form::asset($session,{
name =>"startNode",
value => $jsonDataHash->{startNode},
});
#Any Select
my $anySelect = WebGUI::Form::selectBox($session, {
name => "anySelect",
value => $jsonDataHash->{anySelect},
options => $self->getAnyList,
});
#Property Select
my $propSelect = WebGUI::Form::selectBox($session,{
name => "propSelect",
value => "",
options => { ""=>$i18n->get("choose one option") },
});
#Op Select
my $opSelect = WebGUI::Form::selectBox( $session, {
name => "opSelect",
value => "",
options => $self->getOps,
});
#Value Test
my $valText = WebGUI::Form::text($session,{
name => "valText"
});
#Delete Button
my $deleteButton = WebGUI::Form::button($session,{
value => "-",
extras => q{id="deleteButton_formId"}
});
#Add Button
my $addButton = WebGUI::Form::button($session,{
value => "+",
extras => q{ onclick="addRow(document.getElementById('row_1'),document.getElementById('whereBody'),'propCount_id');" },
});
#Order Select
my $orderSelect = WebGUI::Form::selectBox($session,{
name => "orderSelect",
value => "",
options => { ""=>$i18n->get("choose one option") },
});
#Dir Select
my $dirSelect = WebGUI::Form::selectBox($session, {
name => "dirSelect",
value => "",
options => $self->getDirs,
});
#Delete Button
my $orderDelButton = WebGUI::Form::button($session,{
value => "-",
extras => q{id="orderDelButton_formId"}
});
#Add Button
my $orderAddButton = WebGUI::Form::button($session,{
value => "+",
extras => q{ onclick="addRow(document.getElementById('order_1'),document.getElementById('orderBody'),'orderCount_id');" },
});
#Prop Count
my $propCount = WebGUI::Form::hidden($session, {
name => "propCount",
value => 1,
extras => q{id="propCount_id"},
});
#Order Count
my $orderCount = WebGUI::Form::hidden($session, {
name => "orderCount",
value => 1,
extras => q{id="orderCount_id"},
});
#Limit
my $limit = WebGUI::Form::integer($session,{
name => "limit",
value => $jsonDataHash->{limit},
});
my $classSelectLabel = $i18n->get("class select label");
my $startNodeLabel = $i18n->get("start node label");
my $anySelectLabel = sprintf($i18n->get("any select label"), $anySelect);
my $orderByLabel = $i18n->get("order by label");
my $limitLabel = $i18n->get("limit label");
my $limitSubText = $i18n->get("limit subtext");
#Choose a class
my $output = qq{
$propCount
$orderCount
<table>
<thead>
<tr><th>$classSelectLabel</th></tr>
</thead>
<tbody>
<tr><td>$classSelect</td></tr>
</tbody>
</table>
<table>
<thead>
<tr><th>$startNodeLabel</th></tr>
</thead>
<tbody>
<tr><td>$startNode</td></tr>
</tbody>
</table>
<table>
<thead>
<tr><th>$anySelectLabel</th><tr>
</thead>
</table>
<table>
<tbody id="whereBody">
<tr>
<td>$propSelect</td>
<td>$opSelect</td>
<td>$valText</td>
<td>$deleteButton</td>
<td>$addButton</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr><th colspan="4">$orderByLabel</th></tr>
</thead>
<tbody id="orderBody">
<tr>
<td>$orderSelect</td>
<td>$dirSelect</td>
<td>$orderDelButton</td>
<td>$orderAddButton</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr><th>$limitLabel</th></tr>
</thead>
<tbody>
<tr>
<td>$limit <span style="font-size:10px">($limitSubText)</span></td>
</tr>
</tbody>
</table>
};
return $output;
}
1;

View file

@ -68,6 +68,10 @@ Any extra name=value pairs needed to save the data successfully
If true, will enable the table for editing. This is only necessary when
displaying the table with getValueAsHtml().
=head4 dateFormat
A strftime string describing the proper date format
=cut
sub definition {
@ -81,6 +85,7 @@ sub definition {
ajaxSaveUrl => { defaultValue => undef, },
ajaxSaveFunc => { defaultValue => "view", },
ajaxSaveExtras => { defaultValue => undef, },
dateFormat => { defaultValue => '%y-%m-%d', },
};
return $class->SUPER::definition( $session, $definition );
@ -116,6 +121,8 @@ sub getDataTableHtml {
textbox => "textbox",
);
my $dateFormat = $self->get('dateFormat') || '%y-%m-%d';
my @columnsJson = ();
for my $column ( @{ $data->{columns} } ) {
@ -125,6 +132,7 @@ sub getDataTableHtml {
. qq["key" : "$column->{ key }", ]
. qq["abbr" : "$column->{ key }", ]
. qq["formatter" : "$column->{ formatter }", ]
. ( $column->{formatter} eq "Date" ? qq["dateOptions" : { "format" : "$dateFormat" },] : "" )
. qq["resizable" : 1, ]
. qq["sortable" : 1];
@ -155,6 +163,7 @@ sub getDataTableHtml {
"ajaxDataFunc" => $self->get('ajaxDataFunc'),
"ajaxSaveUrl" => $self->get('ajaxSaveUrl'),
"ajaxSaveFunc" => $self->get('ajaxSaveFunc'),
"dateFormat" => $dateFormat,
};
my $optionsJson = JSON->new->encode($options);

View file

@ -0,0 +1,34 @@
package WebGUI::Help::Asset_AssetReport;
use strict;
our $HELP = {
'asset report template' => {
title => 'help_asset_report_template',
body => 'help_asset_report_body',
isa => [
{ namespace => "Asset_Wobject",
tag => "wobject template variables",
},
{ namespace => "Asset_Template",
tag => "template variables"
},
{ namespace => "Asset",
tag => "asset template"
},
{ tag => 'pagination template variables',
namespace => 'WebGUI'
},
],
variables => [
{ 'name' => 'asset_loop',
'variables' => [
{ 'name' => 'asset_info' },
],
},
],
related => [],
},
};
1;

View file

@ -324,6 +324,11 @@ If usePaginator is not passed, then this variable will limit the number of asset
An array reference of asset states. The ids of assets in those states will be returned. If this option
is missing, only assets in the C<published> state will be returned.
=head4 sortOrder
Determines the order that assets are returned. By default, it is in Chronological order, by creationDate. If
you set sortOrder to Alphabetically, it will sort by title, and then lineage.
=cut
sub getMatchingAssets {
@ -384,9 +389,18 @@ sub getMatchingAssets {
push @clauses, 'keyword in ('.join(',', @placeholders).')';
}
my $sortOrder = $options->{sortOrder} || 'Chronologically';
my $orderBy = $sortOrder eq 'Alphabetically' ? ' order by upper(title), lineage' : ' order by creationDate desc, lineage';
# write the query
my $query = 'select distinct assetKeyword.assetId from assetKeyword left join asset using (assetId)
where '.join(' and ', @clauses).' order by creationDate desc, lineage';
my $query = q{
select distinct assetKeyword.assetId
from assetKeyword
left join asset using (assetId)
left join assetData using (assetId)
where } .
join(' and ', @clauses) . $orderBy;
# perform the search
if ($options->{usePaginator}) {

View file

@ -235,7 +235,11 @@ sub load {
croak $moduleError{$module};
}
# Check if we already have it
# Sanitize
if ( $module !~ m{^\w+(?:::\w+)*$} ) {
croak "Invalid module name: $module";
}
# Try to load the module
my $modulePath = $module . ".pm";
$modulePath =~ s{::|'}{/}g;

View file

@ -123,6 +123,28 @@ These methods are available from this class:
#-------------------------------------------------------------------
=head2 dispatch ( )
Extent the base method in Asset.pm to handle RSS feeds.
=cut
sub dispatch {
my ( $self, $fragment ) = @_;
if ($fragment eq '.rss') {
return $self->www_viewRss;
}
elsif ($fragment eq '.atom') {
return $self->www_viewAtom;
}
elsif ($fragment eq '.rdf') {
return $self->www_viewRdf;
}
return $self->next::method();
}
#-------------------------------------------------------------------
=head2 _httpBasicLogin ( )
Set header values and content to show the HTTP Basic Auth login box.

View file

@ -1314,9 +1314,8 @@ sub www_view {
my $style = $session->style;
my $yui = $url->extras('/yui/build');
$style->setScript("$yui/yahoo/yahoo-min.js");
$style->setScript("$yui/yahoo-dom-event/yahoo-dom-event.js");
$style->setScript("$yui/json/json-min.js");
$style->setScript("$yui/event/event-min.js");
$style->setScript("$yui/connection/connection-min.js");
$style->setScript($url->extras('underscore/underscore-min.js'));
$style->setScript($url->extras('shop/cart.js'), undef, 1);

View file

@ -229,7 +229,7 @@ sub paymentVariables {
return => $return->as_string,
cancel_return => $cancel->as_string,
shipping => $cart->calculateShipping,
handling_cart => $cart->calculateShipping, ##According to https://www.x.com/message/180018#180018
tax_cart => $cart->calculateTaxes,
discount_amount_cart => -($cart->calculateShopCreditDeduction),

View file

@ -238,20 +238,24 @@ sub correctCountry {
my $self = shift;
my $country = shift;
return $country eq q{United Kingdom} ? q{United Kingdom (Great Britain)}
: $country eq q{Bosnia and Herzegovina} ? q{Bosnia-Herzegovina}
: $country eq q{Christmas Island} ? q{Christmas Island (Australia)}
: $country eq q{Congo, the Democratic Republic of the} ? q{Congo, Democratic Republic of the}
: $country eq q{Cocos (Keeling) Islands} ? q{Cocos Island (Australia)}
: $country eq q{Congo} ? q{Congo, Republic of the}
: $country eq q{Christmas Island} ? q{Christmas Island (Australia)}
: $country eq q{Cote d'Ivoire} ? q{Ivory Coast (Cote dIvoire)}
: $country eq q{Georgia} ? q{Georgia, Republic of}
: $country eq q{Heard and Mc Donald Islands} ? q{Australia}
: $country eq q{Korea (South)} ? q{South Korea}
: $country eq q{Korea, Republic of} ? q{Democratic People's Republic of Korea}
: $country eq q{Korea, Republic of} ? q{Korea, Democratic Peoples Republic of (North Korea)}
: $country eq q{Lao People's Democratic Republic} ? q{Laos}
: $country eq q{Macedonia} ? q{Macedonia, Republic of}
: $country eq q{Moldova, Republic of} ? q{Moldova}
: $country eq q{Pitcairn} ? q{Pitcairn Island}
: $country eq q{Russian Federation} ? q{Russia}
: $country eq q{Saint Kitts and Nevis} ? q{Saint Christopher and Nevis}
: $country eq q{Slovakia} ? q{Slovak Republic}
: $country eq q{South Georgia and the South Sandwich Islands} ? q{South Georgia (Falkland Islands)}
: $country eq q{Tokelau} ? q{Tokelau (Union) Group (Western Samoa)}
: $country eq q{Trinidad} ? q{Trinidad and Tobago}
: $country eq q{Vatican City State (Holy See)} ? q{Vatican City}

View file

@ -316,7 +316,7 @@ sub addFileFromFilesystem {
return undef;
}
my $filename = (File::Spec->splitpath( $pathToFile ))[2];
if (isIn($self->getFileExtension($filename), qw(pl perl sh cgi php asp))) {
if (isIn($self->getFileExtension($filename), qw(pl perl sh cgi php asp pm))) {
$filename =~ s/\./\_/g;
$filename .= ".txt";
}

View file

@ -89,6 +89,45 @@ sub canView {
#----------------------------------------------------------------------------
=head2 updateDefaultStyle ( styleTemplateId [, asset ])
Update the default style to the given style template. If an asset is given,
also update all descendants of that asset.
=cut
sub updateDefaultStyle {
my ( $self, $styleTemplateId, $home ) = @_;
my $session = $self->session;
# WebGUI::Account modules cannot be introspected, so we hard-code the default set here
my @settingStyles = qw( userFunctionStyleId contribStyleTemplateId fmStyleTemplateId
friendsStyleTemplateId inboxStyleTemplateId profileStyleTemplateId
shopStyleTemplateId userAccountStyleTemplateId );
for my $setting ( @settingStyles ) {
$session->setting->set( $setting, $styleTemplateId );
}
# update default content styles
if ( $home ) {
my $assetIter = $home->getLineageIterator( [ "self", "descendants" ] );
while ( 1 ) {
my $asset;
eval { $asset = $assetIter->() };
if ( my $x = WebGUI::Error->caught('WebGUI::Error::ObjectNotFound') ) {
$session->log->error($x->full_message);
next;
}
last unless $asset;
$asset->update( { styleTemplateId => $styleTemplateId } );
}
}
return;
}
#----------------------------------------------------------------------------
=head2 wrapStyle ( $output )
Wrap the output in the wizard style.
@ -255,18 +294,7 @@ sub www_chooseContentSave {
}
# update default site style
$session->setting->set( "userFunctionStyleId", $self->get('styleTemplateId') );
my $assetIter = $home->getLineageIterator( [ "self", "descendants" ] );
while ( 1 ) {
my $asset;
eval { $asset = $assetIter->() };
if ( my $x = WebGUI::Error->caught('WebGUI::Error::ObjectNotFound') ) {
$session->log->error($x->full_message);
next;
}
last unless $asset;
$asset->update( { styleTemplateId => $self->get("styleTemplateId") } );
}
$self->updateDefaultStyle( $self->get('styleTemplateId'), $home );
# add new pages
if ( $form->get("aboutUs") ) {

View file

@ -362,22 +362,9 @@ sub www_defaultStyleSave {
my ( $self, @args ) = @_;
my $output = WebGUI::Wizard::HomePage::www_pickStyleSave( $self, @args );
my $session = $self->session;
# update default site style
$session->setting->set( "userFunctionStyleId", $self->get('styleTemplateId') );
my $home = WebGUI::Asset->getDefault( $session );
my $assetIter = $home->getLineageIterator( [ "self", "descendants" ] );
while ( 1 ) {
my $asset;
eval { $asset = $assetIter->() };
if ( my $x = WebGUI::Error->caught('WebGUI::Error::ObjectNotFound') ) {
$session->log->error($x->full_message);
next;
}
last unless $asset;
if ( defined $asset ) {
$asset->update( { styleTemplateId => $self->get("styleTemplateId") } );
}
}
my $home = WebGUI::Asset->getDefault( $session );
WebGUI::Wizard::HomePage::updateDefaultStyle( $self, $self->get('styleTemplateId'), $home );
return $output;
}

View file

@ -0,0 +1,76 @@
package WebGUI::i18n::English::Asset_AssetReport;
use strict;
our $I18N = {
'assetName' => {
message => q{Asset Report},
lastUpdated => 0,
},
'templateId label' => {
message => q{Asset Report Template},
lastUpdated => 1226174617,
context => q{Label for asset edit screen},
},
'templateId description' => {
message => q{Select a template to display your asset report.},
lastUpdated => 1226174619,
context => q{Hover help for asset edit screen},
},
'paginateAfter label' => {
message => q{Assets Per Page},
lastUpdated => 1226174617,
context => q{Label for asset edit screen},
},
'paginateAfter description' => {
message => q{Choose the number of assets to display per page.},
lastUpdated => 1226174619,
context => q{Hover help for asset edit screen},
},
'help_asset_report_template' => {
message => q{Asset Report Template Help},
lastUpdate => 1226174619,
context => q{Title for Asset Report Template Help},
},
'help_asset_report_template' => {
message => q{Asset Report Template Help},
lastUpdate => 1226174619,
context => q{Title for Asset Report Template Help},
},
'help_asset_report_body' => {
message => q{<p>The following template variables are available for asset report templates.</p>},
lastUpdate => 1226174619,
context => q{Body for Asset Report Template Help},
},
'asset_loop' => {
message => q|A loop containing the assets returned by this report.|,
lastUpdated => 0,
context => q|Description of the asset_loop tmpl_loop for the template help.|
},
'asset_info' => {
message => q|General Asset information returned for the asset. See WebGUI Asset Template Help for more details.|,
lastUpdated => 0,
context => q|Description of the asset_loop tmpl_loop for the template help.|
},
'creation_date' => {
message => q{Creation Date},
lastUpdate => 1226174619,
context => q{Label for Creation Date inside template},
},
'created_by' => {
message => q{Created By},
lastUpdate => 1226174619,
context => q{Label for Created By inside template},
},
};
1;

View file

@ -0,0 +1,108 @@
package WebGUI::i18n::English::Form_AssetReportQuery;
use strict;
our $I18N = {
'any option' => {
message => q|any|,
lastUpdated => 1078852836,
context => q{Select list option in AssetReportQuery Form},
},
'all option' => {
message => q|all|,
lastUpdated => 1078852836,
context => q{Select list option in AssetReportQuery Form},
},
'ascending option' => {
message => q|Ascending|,
lastUpdated => 1078852836,
context => q{Select list option in AssetReportQuery Form},
},
'descending option' => {
message => q|Descending|,
lastUpdated => 1078852836,
context => q{Select list option in AssetReportQuery Form},
},
'choose one option' => {
message => q|Choose One|,
lastUpdated => 1078852836,
context => q{Select list option in AssetReportQuery Form},
},
'class select label' => {
message => q|Search for assets of type|,
lastUpdated => 1078852836,
context => q{Text label in AssetReportQuery Form},
},
'start node label' => {
message => q|That are descendants of the following asset|,
lastUpdated => 1078852836,
context => q{Text label in AssetReportQuery Form},
},
'any select label' => {
message => q|Matching %s of the following constraints|,
lastUpdated => 1078852836,
context => q{Text label in AssetReportQuery Form},
},
'order by label' => {
message => q|Order the results by|,
lastUpdated => 1078852836,
context => q{Text label in AssetReportQuery Form},
},
'limit label' => {
message => q|Limit the number of results returned to|,
lastUpdated => 1078852836,
context => q{Text label in AssetReportQuery Form},
},
'limit subtext' => {
message => q|Enter a zero if you do not wish to limit the number of results|,
lastUpdated => 1078852836,
context => q{Subtext for limit field in AssetReportQuery Form},
},
'creationDate (asset)' => {
message => q|creationDate (asset)|,
lastUpdated => 1078852836,
context => q{General item in asset select list},
},
'createdBy (asset)' => {
message => q|createdBy (asset)|,
lastUpdated => 1078852836,
context => q{General item in asset select list},
},
'stateChanged (asset)' => {
message => q|stateChanged (asset)|,
lastUpdated => 1078852836,
context => q{General item in asset select list},
},
'stateChangedBy (asset)' => {
message => q|stateChangedBy (asset)|,
lastUpdated => 1078852836,
context => q{General item in asset select list},
},
'isLockedBy (asset)' => {
message => q|isLockedBy (asset)|,
lastUpdated => 1078852836,
context => q{General item in asset select list},
},
'first_row_error_msg' => {
message => q|The first row may not be deleted. Please adjust your query appropriately|,
lastUpdated => 1078852836,
context => q{Error message in javascript},
},
};
1;