Merge branch 'master' into WebGUI8, up to 7.9.10. Some tests failing due to changes in default content.
This commit is contained in:
commit
ca9a3bd6c7
34 changed files with 386 additions and 49 deletions
|
|
@ -1127,7 +1127,7 @@ sub postProcess {
|
|||
my %data = ();
|
||||
($data{synopsis}, $data{content}) = $self->getSynopsisAndContent($self->synopsis, $self->content);
|
||||
my $spamStopWords = $self->session->config->get('spamStopWords');
|
||||
if (ref $spamStopWords eq 'ARRAY') {
|
||||
if (ref $spamStopWords eq 'ARRAY' && @{ $spamStopWords }) {
|
||||
my $spamRegex = join('|',@{$spamStopWords});
|
||||
$spamRegex =~ s/\s/\\ /g;
|
||||
if ($data{content} =~ m/$spamRegex/xmsi) {
|
||||
|
|
|
|||
|
|
@ -139,6 +139,22 @@ These methods are available from this class:
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 cut ( )
|
||||
|
||||
Extend the base method to handle cutting the User Function Style template and destroying your site.
|
||||
If the current template is the User Function Style template with the Fail Safe template.
|
||||
|
||||
=cut
|
||||
|
||||
around cut => sub {
|
||||
my ( $orig, $self ) = @_;
|
||||
my $returnValue = $self->$orig();
|
||||
if ($returnValue && $self->getId eq $self->session->setting->get('userFunctionStyleId')) {
|
||||
$self->session->setting->set('userFunctionStyleId', 'PBtmpl0000000000000060');
|
||||
}
|
||||
return $returnValue;
|
||||
};
|
||||
|
||||
=head2 addRevision ( )
|
||||
|
||||
Override the master addRevision to copy attachments
|
||||
|
|
@ -415,7 +431,7 @@ Override to import attachments from old versions of WebGUI
|
|||
override importAssetCollateralData => sub {
|
||||
my ( $self, $data, @args ) = @_;
|
||||
if ( $data->{template_attachments} ) {
|
||||
$self->update( { attachmentsJson => $data->{template_attachments} } );
|
||||
$self->update( { attachmentsJson => JSON::to_json($data->{template_attachments}) } );
|
||||
}
|
||||
return super();
|
||||
};
|
||||
|
|
@ -617,6 +633,27 @@ sub processRaw {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 purge ( )
|
||||
|
||||
Extend the base method to handle purging the User Function Style template and destroying your site.
|
||||
If the current template is the User Function Style template with the Fail Safe template.
|
||||
|
||||
=cut
|
||||
|
||||
around purge => sub {
|
||||
my $orig = shift;
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $assetId = $self->assetId;
|
||||
my $returnValue = $self->$orig(@_);
|
||||
if ($returnValue && $assetId eq $session->setting->get('userFunctionStyleId')) {
|
||||
$session->setting->set('userFunctionStyleId', 'PBtmpl0000000000000060');
|
||||
}
|
||||
return $returnValue;
|
||||
};
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_edit
|
||||
|
||||
Hand draw this form so that a warning can be displayed to the user when editing a
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ sub getAutoCommitWorkflowId {
|
|||
|
||||
# delete spam
|
||||
my $spamStopWords = $self->session->config->get('spamStopWords');
|
||||
if (ref $spamStopWords eq 'ARRAY') {
|
||||
if (ref $spamStopWords eq 'ARRAY' && @{ $spamStopWords }) {
|
||||
my $spamRegex = join('|',@{$spamStopWords});
|
||||
$spamRegex =~ s/\s/\\ /g;
|
||||
if ($self->content =~ m{$spamRegex}xmsi) {
|
||||
|
|
|
|||
|
|
@ -725,7 +725,7 @@ sub getListTemplateVars {
|
|||
} @{ $self->getFieldOrder };
|
||||
$var->{field_loop} = \@fieldLoop;
|
||||
my @recordLoop;
|
||||
my $p = WebGUI::Paginator->new($session);
|
||||
my $p = WebGUI::Paginator->new($session,$self->getUrl("mode=list"));
|
||||
$p->setDataByCallback(sub { return $self->entryClass->iterateAll($self, { offset => $_[0], limit => $_[1], }); });
|
||||
my $entryIter = $p->getPageIterator();
|
||||
while ( my $entry = $entryIter->() ) {
|
||||
|
|
|
|||
|
|
@ -95,6 +95,24 @@ property approvalWorkflowId => (
|
|||
label => ['approval workflow', 'Asset_StoryArchive'],
|
||||
hoverHelp => ['approval workflow help', 'Asset_StoryArchive'],
|
||||
);
|
||||
property storySortOrder => (
|
||||
fieldType => "selectBox",
|
||||
tab => 'display',
|
||||
default => 'Chronologically',
|
||||
options => \&_storySortOrder_options,
|
||||
label => ['sortAlphabeticallyChronologically', 'Asset_StoryArchive'],
|
||||
hoverHelp => ['sortAlphabeticallyChronologically description', 'Asset_StoryArchive'],
|
||||
);
|
||||
|
||||
sub _storySortOrder_options {
|
||||
my $self = shift;
|
||||
my $i18n = WebGUI::International->new($self->session, 'Asset_StoryArchive');
|
||||
return {
|
||||
Alphabetically => $i18n->get('alphabetically'),
|
||||
Chronologically => $i18n->get('chronologically'),
|
||||
};
|
||||
}
|
||||
|
||||
with 'WebGUI::Role::Asset::RssFeed';
|
||||
|
||||
use WebGUI::International;
|
||||
|
|
@ -506,11 +524,12 @@ sub viewTemplateVariables {
|
|||
$p = $search->getPaginatorResultSet($self->getUrl, $self->get('storiesPerPage'));
|
||||
}
|
||||
else {
|
||||
$var->{mode} = 'view';
|
||||
##Only return assetIds, we'll build data for the things that are actually displayed.
|
||||
$var->{mode} = 'view';
|
||||
my $orderBy = $self->get('storySortOrder') eq 'Alphabetically' ? 'menuTitle, lineage' : 'creationDate desc, lineage';
|
||||
my $storySql = $self->getLineageSql(['descendants'],{
|
||||
excludeClasses => ['WebGUI::Asset::Wobject::Folder'],
|
||||
orderByClause => 'creationDate desc, lineage',
|
||||
orderByClause => $orderBy,
|
||||
});
|
||||
my $storiesPerPage = $self->storiesPerPage;
|
||||
if ($exporting) {
|
||||
|
|
@ -520,6 +539,7 @@ sub viewTemplateVariables {
|
|||
$p = WebGUI::Paginator->new($session, $self->getUrl, $storiesPerPage);
|
||||
$p->setDataByQuery($storySql);
|
||||
}
|
||||
|
||||
my $storyIds = $p->getPageData();
|
||||
if (! $exporting ) {
|
||||
##Pagination variables aren't useful in export mode
|
||||
|
|
|
|||
|
|
@ -342,8 +342,10 @@ sub getFirstChild {
|
|||
my $lineage = $assetLineage->{firstChild}{$self->getId};
|
||||
unless ($lineage) {
|
||||
($lineage) = $self->session->db->quickArray("select min(asset.lineage) from asset where asset.parentId=? and asset.state='published'",[$self->getId]);
|
||||
$assetLineage->{firstChild}{$self->getId} = $lineage;
|
||||
$self->session->stow->set("assetLineage", $assetLineage);
|
||||
if ($lineage) {
|
||||
$assetLineage->{firstChild}{$self->getId} = $lineage;
|
||||
$self->session->stow->set("assetLineage", $assetLineage);
|
||||
}
|
||||
}
|
||||
$child = eval { WebGUI::Asset->newByLineage($self->session,$lineage); };
|
||||
$self->cacheChild(first => $child);
|
||||
|
|
|
|||
|
|
@ -261,15 +261,25 @@ sub importPackage {
|
|||
my $decompressed = $storage->untar($storage->getFiles->[0]);
|
||||
return undef
|
||||
if $storage->getErrorCount;
|
||||
my %assets = (); # All the assets we've imported
|
||||
my $package = undef; # The asset package
|
||||
my $error = $self->session->errorHandler;
|
||||
|
||||
# The debug output for long requests would be too long, and we'd have to
|
||||
# keep it all in memory.
|
||||
$error->preventDebugOutput();
|
||||
$error->info("Importing package.");
|
||||
|
||||
# Your parent is on this stack somewhere because we're going through these
|
||||
# assets depth-first. This way we only have to keep one branch in-memory
|
||||
# at a time, and it's always the right branch.
|
||||
my @stack;
|
||||
my $json = JSON->new->utf8->relaxed(1);
|
||||
|
||||
foreach my $file (sort(@{$decompressed->getFiles})) {
|
||||
next unless ($decompressed->getFileExtension($file) eq "json");
|
||||
$error->info("Found data file $file");
|
||||
my $data = eval {
|
||||
JSON->new->utf8->relaxed(1)->decode($decompressed->getFileContentsAsScalar($file))
|
||||
$json->decode($decompressed->getFileContentsAsScalar($file))
|
||||
};
|
||||
if ($@ || $data->{properties}{assetId} eq "" || $data->{properties}{className} eq "" || $data->{properties}{revisionDate} eq "") {
|
||||
$error->error("package corruption: ".$@) if ($@);
|
||||
|
|
@ -280,20 +290,27 @@ sub importPackage {
|
|||
my $assetStorage = WebGUI::Storage->get($self->session, $storageId);
|
||||
$decompressed->untar($storageId.".storage", $assetStorage);
|
||||
}
|
||||
my $asset = $assets{$data->{properties}{parentId}} || $self;
|
||||
|
||||
my $parentId = $data->{properties}->{parentId};
|
||||
my $asset;
|
||||
while ($asset = pop(@stack)) {
|
||||
if ($asset->getId eq $parentId) {
|
||||
push(@stack, $asset);
|
||||
last;
|
||||
}
|
||||
}
|
||||
$asset ||= $self;
|
||||
|
||||
my $newAsset = $asset->importAssetData($data, $options);
|
||||
$newAsset->importAssetCollateralData($data);
|
||||
$assets{$newAsset->getId} = $newAsset;
|
||||
# First imported asset must be the "package"
|
||||
|
||||
unless ($package) {
|
||||
$package = $newAsset;
|
||||
}
|
||||
push(@stack, $newAsset);
|
||||
|
||||
# First imported asset must be the "package"
|
||||
$package ||= $newAsset;
|
||||
}
|
||||
|
||||
return $package
|
||||
if $package;
|
||||
return 'corrupt';
|
||||
return $package || 'corrupt';
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ on your print CSS tag.
|
|||
|
||||
sub linkTag {
|
||||
my ($session, $url, $extras) = @_;
|
||||
my $template = qq|<link rel="stylesheet" type="text/css" href="%s" $extras>\n|;
|
||||
my $template = qq|<link rel="stylesheet" type="text/css" href="%s" $extras />\n|;
|
||||
return sprintf $template, $url;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ use Scalar::Util qw( weaken );
|
|||
use WebGUI::International;
|
||||
use WebGUI::Utility;
|
||||
use Scalar::Util qw(weaken);
|
||||
use Encode;
|
||||
|
||||
|
||||
=head1 NAME
|
||||
|
|
@ -326,7 +327,7 @@ sub getRequestedUrl {
|
|||
my $self = shift;
|
||||
return undef unless ($self->session->request);
|
||||
unless ($self->{_requestedUrl}) {
|
||||
$self->{_requestedUrl} = $self->session->request->path_info; # TODO - is path_info right?
|
||||
$self->{_requestedUrl} = decode_utf8($self->session->request->path_info); # TODO - is path_info right?
|
||||
my $gateway = $self->session->config->get("gateway");
|
||||
$self->{_requestedUrl} =~ s/^$gateway([^?]*)\??.*$/$1/;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ our $I18N = {
|
|||
},
|
||||
|
||||
'carousel slideHeight description' => {
|
||||
message => q|Height in pixels. The Carousel will not automatically resize itself for content of various widths. Setting this width will help it render properly. If left with the default, 0, then the width of the Carousel is set by the width of the first element.|,
|
||||
lastUpdated => 0,
|
||||
message => q|Height in pixels. The Carousel will not automatically resize itself for content of various heights. Setting this height will help it render properly. If left with the default, 0, then the height of the Carousel is set by the height of the first element.|,
|
||||
lastUpdated => 1280253825,
|
||||
context => q|Description of the carousel template field, used as hover help.|
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -333,6 +333,30 @@ our $I18N = {
|
|||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'sortAlphabeticallyChronologically' => {
|
||||
message => q|Sort Order|,
|
||||
context => q|Label in the edit screen|,
|
||||
lastUpdated => 1276631190,
|
||||
},
|
||||
|
||||
'sortAlphabeticallyChronologically description' => {
|
||||
message => q|Set messages to appear in order of publish date or alphabetically by title|,
|
||||
context => q|Tooltip in the edit screen|,
|
||||
lastUpdated => 1276631190,
|
||||
},
|
||||
|
||||
'alphabetically' => {
|
||||
message => q|Alphabetically|,
|
||||
context => q|Select option in the edit screen|,
|
||||
lastUpdated => 1276631190,
|
||||
},
|
||||
|
||||
'chronologically' => {
|
||||
message => q|Chronologically|,
|
||||
context => q|Select option in the edit screen|,
|
||||
lastUpdated => 1276631190,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue