Merge commit '41575d24bb' into webgui8. Some tests still failing.
Conflicts: docs/gotcha.txt lib/WebGUI.pm lib/WebGUI/Asset.pm lib/WebGUI/Asset/File/GalleryFile/Photo.pm lib/WebGUI/Asset/Post.pm lib/WebGUI/Asset/Template.pm lib/WebGUI/Asset/WikiPage.pm lib/WebGUI/Asset/Wobject/WikiMaster.pm lib/WebGUI/Cache.pm lib/WebGUI/Content/Setup.pm lib/WebGUI/Role/Asset/Subscribable.pm lib/WebGUI/Shop/Cart.pm lib/WebGUI/Shop/Pay.pm lib/WebGUI/Shop/PayDriver/ITransact.pm sbin/testEnvironment.pl t/Asset/WikiPage.t t/Shop/PayDriver.t t/Shop/PayDriver/ITransact.t t/Shop/PayDriver/Ogone.t t/Shop/TaxDriver/EU.t t/Shop/TaxDriver/Generic.t t/Workflow/Activity/RemoveOldCarts.t t/lib/WebGUI/Test.pm
This commit is contained in:
commit
5febc0ebbc
258 changed files with 5528 additions and 2230 deletions
82
lib/WebGUI/Role/Asset/AutoSynopsis.pm
Normal file
82
lib/WebGUI/Role/Asset/AutoSynopsis.pm
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
package WebGUI::Role::Asset::AutoSynopsis;
|
||||
|
||||
=head1 LEGAL
|
||||
|
||||
-------------------------------------------------------------------
|
||||
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
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use Moose::Role;
|
||||
use WebGUI::HTML;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::AssetAspect::AutoSynopsis
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This is a role which provides a method for an asset to create a synopsis based on user submitted content.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
with 'WebGUI::Role::Asset::AutoSynopsis';
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
These methods are available from this class:
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getSynopsisAndContent ($synopsis, $body)
|
||||
|
||||
Returns a synopsis taken from the body of the Post, based on either the separator
|
||||
macro, the first html paragraph, or the first physical line of text as defined by
|
||||
newlines.
|
||||
|
||||
Returns both the synopsis, and the original body content.
|
||||
|
||||
=head3 $synopsis
|
||||
|
||||
If passed in, it returns that instead of the calculated synopsis.
|
||||
|
||||
=head3 $body
|
||||
|
||||
Body of the Post to use a source for the synopsis.
|
||||
|
||||
=cut
|
||||
|
||||
sub getSynopsisAndContent {
|
||||
my $self = shift;
|
||||
my $synopsis = shift;
|
||||
my $body = shift;
|
||||
unless ($synopsis) {
|
||||
my @content;
|
||||
if( $body =~ /\^\-\;/ ) {
|
||||
my @pieces = WebGUI::HTML::splitSeparator($body);
|
||||
$content[0] = shift @pieces;
|
||||
$content[1] = join '', @pieces;
|
||||
}
|
||||
elsif( $body =~ /<p>/ ) {
|
||||
@content = WebGUI::HTML::splitTag($body);
|
||||
}
|
||||
else {
|
||||
@content = split("\n",$body);
|
||||
}
|
||||
shift @content if $content[0] =~ /^\s*$/;
|
||||
$synopsis = WebGUI::HTML::filter($content[0],"all");
|
||||
}
|
||||
return ($synopsis,$body);
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
@ -14,6 +14,7 @@ package WebGUI::Role::Asset::Subscribable;
|
|||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
|
||||
use Moose::Role;
|
||||
use WebGUI::Definition::Asset;
|
||||
|
|
@ -39,6 +40,7 @@ sub _subscriptionTemplateId_namespace {
|
|||
return $self->getSubscriptionTemplateNamespace($self->session);
|
||||
}
|
||||
|
||||
use WebGUI::International;
|
||||
use WebGUI::Mail::Send;
|
||||
|
||||
=head1 NAME
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue