Merge branch 'master' into WebGUI8, up to 7.9.10. Some tests failing due to changes in default content.

This commit is contained in:
Colin Kuskie 2010-07-27 22:55:57 -07:00
commit ca9a3bd6c7
34 changed files with 386 additions and 49 deletions

View file

@ -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) {

View file

@ -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

View file

@ -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) {

View file

@ -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->() ) {

View file

@ -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