Merge commit 'v7.10.23' into WebGUI8. Tests need fixing.
This commit is contained in:
commit
a2a821822d
72 changed files with 578 additions and 132 deletions
|
|
@ -1427,6 +1427,28 @@ sub getImportNode {
|
|||
return WebGUI::Asset->newById($session, "PBasset000000000000002");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getInheritableProperties ( )
|
||||
|
||||
Returns a hash (list) of properties that should be inherited from a parent when creating an asset.
|
||||
|
||||
=cut
|
||||
|
||||
sub getInheritableProperties {
|
||||
my $self = shift;
|
||||
return (
|
||||
parentId => $self->getId,
|
||||
groupIdView => $self->get("groupIdView"),
|
||||
groupIdEdit => $self->get("groupIdEdit"),
|
||||
ownerUserId => $self->get("ownerUserId"),
|
||||
encryptPage => $self->get("encryptPage"),
|
||||
styleTemplateId => $self->get("styleTemplateId"),
|
||||
printableStyleTemplateId => $self->get("printableStyleTemplateId"),
|
||||
isHidden => $self->get("isHidden"),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -2749,15 +2771,8 @@ sub www_add {
|
|||
}
|
||||
my %properties = (
|
||||
%prototypeProperties,
|
||||
parentId => $self->getId,
|
||||
groupIdView => $self->get("groupIdView"),
|
||||
groupIdEdit => $self->get("groupIdEdit"),
|
||||
ownerUserId => $self->get("ownerUserId"),
|
||||
encryptPage => $self->get("encryptPage"),
|
||||
styleTemplateId => $self->get("styleTemplateId"),
|
||||
printableStyleTemplateId => $self->get("printableStyleTemplateId"),
|
||||
isHidden => $self->get("isHidden"),
|
||||
className=>$class,
|
||||
$self->getInheritableProperties,
|
||||
assetId=>"new",
|
||||
url=>scalar($self->session->form->param("url")),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -637,15 +637,15 @@ sub prepare {
|
|||
|
||||
$style->setRawHeadTags($headBlock);
|
||||
|
||||
my %props = ( type => 'text/css', rel => 'stylesheet' );
|
||||
foreach my $sheet ( @{ $self->getAttachments('stylesheet') } ) {
|
||||
my %props = ( type => 'text/css', rel => 'stylesheet' );
|
||||
$style->setLink($sheet->{url}, \%props);
|
||||
}
|
||||
|
||||
my $doScripts = sub {
|
||||
my ($type, $body) = @_;
|
||||
my %props = ( type => 'text/javascript' );
|
||||
foreach my $script ( @{ $self->getAttachments($type) } ) {
|
||||
my %props = ( type => 'text/javascript' );
|
||||
$style->setScript($script->{url}, \%props, $body);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -226,6 +226,21 @@ sub getCollateral {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getInheritableProperties ( )
|
||||
|
||||
Extend the base class to include the mobileStyleTemplateId.
|
||||
|
||||
=cut
|
||||
|
||||
override getInheritableProperties => sub {
|
||||
my $self = shift;
|
||||
my %properties = super();
|
||||
$properties{mobileStyleTemplateId} = $self->mobileStyleTemplateId;
|
||||
return %properties;
|
||||
};
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getStyleTemplateId
|
||||
|
|
|
|||
|
|
@ -139,9 +139,8 @@ sub getTemplateVars {
|
|||
$rules->{'whereClause'} .= qq{$prop $op $value};
|
||||
}
|
||||
|
||||
if($rules->{'whereClause'}) {
|
||||
$rules->{'joinClass'} = $settings->{className};
|
||||
}
|
||||
# Always join to the class, asset and assetData are excluded by getLineageSql
|
||||
$rules->{'joinClass'} = $settings->{className};
|
||||
|
||||
#Build the order by condition
|
||||
my $order = $settings->{order};
|
||||
|
|
|
|||
|
|
@ -1383,7 +1383,7 @@ around groupIdView => sub {
|
|||
my $instance_data = {
|
||||
workflowId => 'xR-_GRRbjBojgLsFx3dEMA',
|
||||
className => 'WebGUI::Asset',
|
||||
methodName => 'newById',
|
||||
methodName => 'newPending',
|
||||
parameters => $self->getId,
|
||||
};
|
||||
my $instance = WebGUI::Workflow::Instance->create($self->session, $instance_data);
|
||||
|
|
|
|||
|
|
@ -393,6 +393,21 @@ sub getContentLastModifiedBy {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getInheritableProperties ( )
|
||||
|
||||
Extend the base class to include the mobileTemplateId.
|
||||
|
||||
=cut
|
||||
|
||||
override getInheritableProperties => sub {
|
||||
my $self = shift;
|
||||
my %properties = super();
|
||||
$properties{mobileTemplateId} = $self->mobileTemplateId;
|
||||
return %properties;
|
||||
};
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_view
|
||||
|
||||
Extend the base method to handle caching and ad rotation.
|
||||
|
|
@ -437,4 +452,3 @@ override www_view => sub {
|
|||
|
||||
__PACKAGE__->meta->make_immutable;
|
||||
1;
|
||||
|
||||
|
|
|
|||
|
|
@ -1056,7 +1056,7 @@ sub getFieldValue {
|
|||
# TODO: The otherThing field type is probably also handled by getFormPlugin, so the elsif below can probably be
|
||||
# safely removed. However, this requires more testing than I can provide right now, so for now this stays the
|
||||
# way it was.
|
||||
elsif ($field->{fieldType} =~ m/^otherthing/x) {
|
||||
elsif ($fieldType =~ m/^otherthing/x) {
|
||||
my $otherThingId = $field->{fieldType};
|
||||
$otherThingId =~ s/^otherThing_//x;
|
||||
my $tableName = 'Thingy_'.$otherThingId;
|
||||
|
|
@ -1603,11 +1603,11 @@ sub indexThing {
|
|||
return unless $thing;
|
||||
my $index = WebGUI::Search::Index->new($self);
|
||||
$index->addRecord(
|
||||
url => $self->getUrl($self->getThingUrl($thing)),
|
||||
groupIdView => $thing->{groupIdView},
|
||||
title => $thing->{label},
|
||||
subId => $thing->{thingId},
|
||||
keywords => join(' ', @{$thing}{qw/label editScreenTitle editInstructions searchScreenTitle searchDescription/}),
|
||||
url => $self->session->url->append($self->get('url'), $self->getThingUrl($thing)),
|
||||
);
|
||||
##Easy update of all thingData fields for this thing. This is in lieu of deleting all records
|
||||
##And rebuilding them all.
|
||||
|
|
@ -1679,7 +1679,7 @@ sub indexThingData {
|
|||
|| $self->getTitle;
|
||||
$index->addRecord(
|
||||
assetId => $self->getId,
|
||||
url => $self->getUrl('func=viewThingData;thingId='. $thing->{thingId} . ';thingDataId='. $thingData->{thingDataId}),
|
||||
url => $session->url->append($self->get('url'), 'func=viewThingData;thingId='. $thing->{thingId} . ';thingDataId='. $thingData->{thingDataId}),
|
||||
groupIdView => $thing->{groupIdView},
|
||||
title => $title,
|
||||
subId => $thing->{thingId} . '-' . $thingData->{thingDataId},
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ package WebGUI::Asset;
|
|||
=cut
|
||||
|
||||
use strict;
|
||||
use Tie::IxHash;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -380,7 +379,7 @@ sub www_editMetaDataField {
|
|||
label=>$i18n->get(486),
|
||||
hoverHelp=>$i18n->get('Data Type description'),
|
||||
value=>$fieldInfo->{fieldType} || "text",
|
||||
types=> [ qw /text integer yesNo selectBox radioList checkList dateTime/ ]
|
||||
types=> [ qw /text integer yesNo selectBox radioList checkList date/ ]
|
||||
);
|
||||
|
||||
my $default = ref WebGUI::Asset->assetName eq 'ARRAY'
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ use WebGUI::Shop::AddressBook;
|
|||
use WebGUI::Inbox;
|
||||
use WebGUI::Friends;
|
||||
use WebGUI::Deprecate;
|
||||
use URI;
|
||||
|
||||
# Profile field name for the number of times the showMessageOnLogin has been
|
||||
# seen.
|
||||
|
|
@ -1209,13 +1210,7 @@ sub www_login {
|
|||
$u->karma($self->session->setting->get("karmaPerLogin"),"Login","Just for logging in.") if ($self->session->setting->get("useKarma"));
|
||||
$self->_logLogin($uid,"success");
|
||||
|
||||
if ($self->session->setting->get('encryptLogin')) {
|
||||
my $currentUrl = $self->session->url->page(undef,1);
|
||||
$currentUrl =~ s/^https:/http:/;
|
||||
$self->session->response->setRedirect($currentUrl);
|
||||
}
|
||||
|
||||
# Run on login
|
||||
# Run on login
|
||||
my $command = $self->session->config->get("runOnLogin");
|
||||
if ($command ne "") {
|
||||
WebGUI::Macro::process($self->session,\$command);
|
||||
|
|
@ -1223,7 +1218,6 @@ sub www_login {
|
|||
$self->session->log->warn($error) if $error;
|
||||
}
|
||||
|
||||
|
||||
# Set the proper redirect
|
||||
if ( $self->session->setting->get( 'showMessageOnLogin' )
|
||||
&& $self->user->get( $LOGIN_MESSAGE_SEEN )
|
||||
|
|
@ -1242,6 +1236,11 @@ sub www_login {
|
|||
$self->session->response->setRedirect($self->session->setting->get("redirectAfterLoginUrl"));
|
||||
$self->session->scratch->delete("redirectAfterLogin");
|
||||
}
|
||||
elsif ($self->session->setting->get('encryptLogin')) {
|
||||
my $currentUrl = $self->session->url->page(undef,1);
|
||||
$currentUrl =~ s/^https:/http:/;
|
||||
$self->session->response->setRedirect($currentUrl);
|
||||
}
|
||||
|
||||
# Get open version tag. This is needed if we want
|
||||
# to reclaim a version right after login (singlePerUser and siteWide mode)
|
||||
|
|
@ -1308,18 +1307,27 @@ sub www_showMessageOnLogin {
|
|||
|
||||
# Add the link to continue
|
||||
my $session = $self->session;
|
||||
my $redirectUrl = $self->session->form->get( 'returnUrl' )
|
||||
|| $self->session->setting->get("redirectAfterLoginUrl")
|
||||
|| $self->session->scratch->get( 'redirectAfterLogin' )
|
||||
|| $self->session->url->getBackToSiteURL
|
||||
my $redirectUrl = $session->form->get( 'returnUrl' )
|
||||
|| $session->setting->get("redirectAfterLoginUrl")
|
||||
|| $session->scratch->get( 'redirectAfterLogin' )
|
||||
|| $session->url->getBackToSiteURL
|
||||
;
|
||||
|
||||
$output .= '<p><a href="' . $redirectUrl . '">' . $i18n->get( 'showMessageOnLogin return' )
|
||||
. '</a></p>'
|
||||
;
|
||||
|
||||
if ($session->setting->get('encryptLogin') && ( ! $redirectUrl =~ /^http/)) {
|
||||
##A scheme-less URL has been supplied. We need to make it an absolute one
|
||||
##with a non-encrypted scheme. Otherwise the user will stay in SSL mode.
|
||||
##We assume that the user put the gateway URL into their URL.
|
||||
my $uri = URI->new_abs($redirectUrl, $session->url->getSiteURL);
|
||||
$uri->scheme('http');
|
||||
$redirectUrl = $uri->as_string;
|
||||
}
|
||||
|
||||
# No matter what, we won't be redirecting after this
|
||||
$self->session->scratch->delete( 'redirectAfterLogin' );
|
||||
$session->scratch->delete( 'redirectAfterLogin' );
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1115,12 +1115,19 @@ Membership will always be false if no IpFilter has been set
|
|||
|
||||
id of the user to check for membership
|
||||
|
||||
=head3 sessionId
|
||||
|
||||
id of the session to check for user data. If no sessionId is passed in, then the
|
||||
group's session will be used to find one.
|
||||
|
||||
|
||||
=cut
|
||||
|
||||
sub hasIpUser {
|
||||
my $self = shift;
|
||||
my $userId = shift;
|
||||
my $session = $self->session;
|
||||
my $userId = shift;
|
||||
my $userSessionId = shift || $session->getId;
|
||||
|
||||
my $IpFilter = $self->ipFilter();
|
||||
return 0 unless ($IpFilter && $userId);
|
||||
|
|
@ -1128,9 +1135,9 @@ sub hasIpUser {
|
|||
$IpFilter =~ s/\s//g;
|
||||
my @filters = split /;/, $IpFilter;
|
||||
|
||||
my @ips = $session->db->buildArray(
|
||||
q{ select lastIP from userSession where expires > ? and userId = ? }
|
||||
,[ time(), $userId ]
|
||||
my @ips = $session->db->buildArray(
|
||||
q{ select lastIP from userSession where expires > ? and userId = ? and sessionId=?}
|
||||
,[ time(), $userId, $userSessionId, ]
|
||||
);
|
||||
|
||||
foreach my $ip (@ips) {
|
||||
|
|
@ -1231,7 +1238,7 @@ sub hasLDAPUser {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 hasScratchUser ( userId )
|
||||
=head2 hasScratchUser ( userId, [ $sessionId ] )
|
||||
|
||||
Determine if the user passed in is a member of this group via session scratch
|
||||
variable settings and this group's scratchFilter.
|
||||
|
|
@ -1242,12 +1249,18 @@ If no scratchFilter has been set for this group, membership will always be false
|
|||
|
||||
id of the user to check for membership
|
||||
|
||||
=head3 sessionId
|
||||
|
||||
id of the session for the user being checked for membership. If no sessionId is passed in, then the
|
||||
group's session will be used to find one.
|
||||
|
||||
=cut
|
||||
|
||||
sub hasScratchUser {
|
||||
my $self = shift;
|
||||
my $userId = shift;
|
||||
my $session = $self->session;
|
||||
my $userId = shift;
|
||||
my $userSessionId = shift || $self->session;
|
||||
|
||||
my $scratchFilter = $self->scratchFilter();
|
||||
return 0 unless ($scratchFilter && $userId);
|
||||
|
|
@ -1256,7 +1269,7 @@ sub hasScratchUser {
|
|||
my @filters = split /;/, $scratchFilter;
|
||||
|
||||
my @scratchClauses = ();
|
||||
my @scratchPlaceholders = ( $userId, time() );
|
||||
my @scratchPlaceholders = ( $userSessionId, $userId, time() );
|
||||
foreach my $filter (@filters) {
|
||||
my ($name, $value) = split /=/, $filter;
|
||||
push @scratchClauses, "(s.name=? AND s.value=?)";
|
||||
|
|
@ -1270,6 +1283,7 @@ sub hasScratchUser {
|
|||
from
|
||||
userSession u, userSessionScratch s
|
||||
where
|
||||
u.sessionId = ? AND
|
||||
u.sessionId=s.sessionId AND
|
||||
u.userId = ? AND
|
||||
u.expires > ? AND
|
||||
|
|
@ -1297,6 +1311,7 @@ sub hasUser {
|
|||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $user = shift || WebGUI::User->new($session,3); #Check the admin account if no user is passed in
|
||||
my $uSessionId = $user->session->getId;
|
||||
my $gid = $self->getId;
|
||||
my $db = $session->db;
|
||||
|
||||
|
|
@ -1383,9 +1398,9 @@ sub hasUser {
|
|||
my $groupToCheck = __PACKAGE__->new($session,$groupIdInGroup);
|
||||
### Check the 'has' method for each of the 'other' group methods available for this user
|
||||
### perform checks in a least -> most expensive manner. If we find the user, stow the cache and return true
|
||||
if( $groupToCheck->hasIpUser($uid)
|
||||
if( $groupToCheck->hasIpUser($uid, $uSessionId)
|
||||
|| $groupToCheck->hasKarmaUser($uid)
|
||||
|| $groupToCheck->hasScratchUser($uid)
|
||||
|| $groupToCheck->hasScratchUser($uid, $uSessionId)
|
||||
|| $groupToCheck->hasDatabaseUser($uid)
|
||||
|| $groupToCheck->hasLDAPUser($uid)
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -334,7 +334,7 @@ sub getRequestedUrl {
|
|||
|
||||
=head2 getSiteURL ( )
|
||||
|
||||
Returns a constructed site url. The returned value can be overridden using the setSiteURL function.
|
||||
Returns a constructed site url without the gateway. The returned value can be overridden using the setSiteURL function.
|
||||
|
||||
=cut
|
||||
|
||||
|
|
|
|||
|
|
@ -819,10 +819,6 @@ sub updateFromForm {
|
|||
$item->update({shippingAddressId => $itemAddressId});
|
||||
}
|
||||
}
|
||||
if ($self->hasMixedItems) {
|
||||
my $i18n = WebGUI::International->new($self->session, "Shop");
|
||||
$self->error($i18n->get('mixed items warning'));
|
||||
}
|
||||
|
||||
my @cartItemIds = $form->process('remove_item', 'checkList');
|
||||
foreach my $cartItemId (@cartItemIds) {
|
||||
|
|
@ -830,6 +826,12 @@ sub updateFromForm {
|
|||
$item->remove if ! Exception::Class->caught();
|
||||
}
|
||||
|
||||
##Remove the items BEFORE we check to see if there are duplicates.
|
||||
if ($self->hasMixedItems) {
|
||||
my $i18n = WebGUI::International->new($self->session, "Shop");
|
||||
$self->error($i18n->get('mixed items warning'));
|
||||
}
|
||||
|
||||
##Visitor cannot have an address book, or set a payment gateway, so skip the rest of this.
|
||||
return 1 if $session->user->isVisitor;
|
||||
|
||||
|
|
@ -1085,6 +1087,10 @@ sub www_view {
|
|||
return $session->style->userStyle($template->process(\%var));
|
||||
}
|
||||
|
||||
if ($self->hasMixedItems) {
|
||||
$self->error($i18n->get('mixed items warning'));
|
||||
}
|
||||
|
||||
my %var = (
|
||||
%{$self->get},
|
||||
formHeader => WebGUI::Form::formHeader($session, { extras => q|id="wgCartId"|, })
|
||||
|
|
@ -1108,7 +1114,6 @@ sub www_view {
|
|||
shippableItemsInCart => $self->requiresShipping,
|
||||
);
|
||||
|
||||
|
||||
# get the shipping address
|
||||
my $address = eval { $self->getShippingAddress };
|
||||
if (my $e = WebGUI::Error->caught("WebGUI::Error::ObjectNotFound") && $self->shippingAddressId) {
|
||||
|
|
|
|||
|
|
@ -981,20 +981,17 @@ sub isInGroup {
|
|||
### Check stow before we check the cache. Stow is in memory and much faster
|
||||
my $stow = $session->stow->get("isInGroup", { noclone => 1 }) || {};
|
||||
return $stow->{$uid}->{$gid} if (exists $stow->{$uid}->{$gid});
|
||||
|
||||
|
||||
### Don't bother checking File Cache if we already have a stow for this group.
|
||||
### We can find what we need there and save ourselves a bunch of time
|
||||
my $cache = undef;
|
||||
my $groupMembers = undef;
|
||||
unless ($stow->{$uid}->{$gid}) {
|
||||
$groupMembers = $session->cache->get("groupMembers".$gid) || {};
|
||||
#If we have this user's membership cached, return what we have stored
|
||||
if (exists $groupMembers->{$uid}) {
|
||||
return $groupMembers->{$uid}->{isMember} if (!$self->isVisitor);
|
||||
return $groupMembers->{$uid}->{$session->getId}->{isMember} #Include the session check for visitors
|
||||
}
|
||||
}
|
||||
|
||||
my $cache = undef;
|
||||
my $groupMembers = $session->cache->get("groupMembers".$gid) || {};
|
||||
#If we have this user's membership cached, return what we have stored
|
||||
if (exists $groupMembers->{$uid}) {
|
||||
return $groupMembers->{$uid}->{isMember} if (!$self->isVisitor);
|
||||
return $groupMembers->{$uid}->{$session->getId}->{isMember} if exists $groupMembers->{$uid}->{$session->getId}; #Include the session check for visitors
|
||||
}
|
||||
|
||||
### Instantiate the group
|
||||
my $group = WebGUI::Group->new($session,$gid);
|
||||
if ( !$group ) {
|
||||
|
|
@ -1004,7 +1001,7 @@ sub isInGroup {
|
|||
|
||||
#Check the group for membership
|
||||
my $isInGroup = $group->hasUser($self);
|
||||
|
||||
|
||||
#Write what we found to file cache
|
||||
$group->cacheGroupings( $self, $isInGroup, $groupMembers );
|
||||
return $isInGroup;
|
||||
|
|
|
|||
|
|
@ -194,7 +194,13 @@ sub processRecurrence {
|
|||
$event->generateRecurrence($d);
|
||||
}
|
||||
|
||||
$versionTag->commit;
|
||||
##If nothing needed to happen, then don't keep the tag around.
|
||||
if ($versionTag->getAssetCount > 0) {
|
||||
$versionTag->commit;
|
||||
}
|
||||
else {
|
||||
$versionTag->rollback;
|
||||
}
|
||||
return $time_limit ? 1 : 0;
|
||||
} ## end sub processRecurrence
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ sub execute {
|
|||
if ($versionTag->getAssetCount) {
|
||||
# if there's only one asset in the tag, we might as well give them a direct link to it
|
||||
my $asset = $versionTag->getAssets->[0];
|
||||
$urlOfSingleAsset = "\n\n".$self->session->url->getSiteURL().$asset->getUrl("func=view;revision=".$asset->get("revisionDate"));
|
||||
$urlOfSingleAsset = $self->session->url->getSiteURL().$asset->getUrl("func=view;revision=".$asset->get("revisionDate"));
|
||||
}
|
||||
my $var = {
|
||||
message => $self->get('message'),
|
||||
|
|
|
|||
|
|
@ -99,6 +99,12 @@ our $I18N = {
|
|||
lastUpdated => 1230844137,
|
||||
},
|
||||
|
||||
'Return to Account' => {
|
||||
message => q{Return to Account},
|
||||
context => q{label for templates that want to provide a link back to the main account page},
|
||||
lastUpdated => 1230844137,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue