fixed [ 1306912 ] CMS Matrix - Unable to approve article's
This commit is contained in:
parent
e4c2bc9969
commit
7576dbfa78
6 changed files with 22 additions and 9 deletions
|
|
@ -88,7 +88,7 @@ sub page {
|
|||
return _setup() if ($session{setting}{specialState} eq "init");
|
||||
my $output = _processOperations();
|
||||
if ($output eq "") {
|
||||
my $asset = WebGUI::Asset->newByUrl($assetUrl);
|
||||
my $asset = WebGUI::Asset->newByUrl($assetUrl,$session{form}{revision});
|
||||
if (defined $asset) {
|
||||
$session{asset} = $asset;
|
||||
my $method = "view";
|
||||
|
|
|
|||
|
|
@ -974,7 +974,7 @@ sub new {
|
|||
my $revisionDate = shift || $session{assetRevision}{$assetId}{$session{scratch}{versionTag}||'_'};
|
||||
unless ($revisionDate) {
|
||||
($revisionDate) = WebGUI::SQL->quickArray("select max(revisionDate) from assetData where assetId="
|
||||
.quote($assetId)." and (status='approved' or status='archived' or status='pending' or tagId=".quote($session{scratch}{versionTag}).")
|
||||
.quote($assetId)." and (status='approved' or status='archived' or tagId=".quote($session{scratch}{versionTag}).")
|
||||
group by assetData.assetId order by assetData.revisionDate");
|
||||
$session{assetRevision}{$assetId}{$session{scratch}{versionTag}||'_'} = $revisionDate unless ($session{config}{disableCache});
|
||||
}
|
||||
|
|
@ -1068,7 +1068,7 @@ sub newByPropertyHashRef {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 newByUrl ( [url] )
|
||||
=head2 newByUrl ( [url, revisionDate] )
|
||||
|
||||
Returns a new Asset object based upon current url, given url or defaultPage.
|
||||
|
||||
|
|
@ -1076,11 +1076,16 @@ Returns a new Asset object based upon current url, given url or defaultPage.
|
|||
|
||||
Optional string representing a URL.
|
||||
|
||||
=head3 revisionDate
|
||||
|
||||
A specific revision to instanciate. By default we instanciate the newest published revision.
|
||||
|
||||
=cut
|
||||
|
||||
sub newByUrl {
|
||||
my $class = shift;
|
||||
my $url = shift || $session{env}{PATH_INFO};
|
||||
my $revisionDate = shift;
|
||||
$url = lc($url);
|
||||
$url =~ s/\/$//;
|
||||
$url =~ s/^\///;
|
||||
|
|
@ -1102,7 +1107,7 @@ sub newByUrl {
|
|||
assetData.assetId
|
||||
");
|
||||
if ($id ne "" || $class ne "") {
|
||||
return WebGUI::Asset->new($id, $class);
|
||||
return WebGUI::Asset->new($id, $class, $revisionDate);
|
||||
} else {
|
||||
WebGUI::ErrorHandler::warn("The URL $url was requested, but does not exist in your asset tree.");
|
||||
return undef;
|
||||
|
|
|
|||
|
|
@ -595,7 +595,7 @@ sub notifySubscribers {
|
|||
foreach my $userId (keys %subscribers) {
|
||||
my $u = WebGUI::User->new($userId);
|
||||
if ($lang{$u->profileField("language")}{message} eq "") {
|
||||
$lang{$u->profileField("language")}{var} = $self->getTemplateVars($lang{$u->profileField("language")}{var});
|
||||
$lang{$u->profileField("language")}{var} = $self->getTemplateVars();
|
||||
$self->getThread->getParent->appendTemplateLabels($lang{$u->profileField("language")}{var});
|
||||
$lang{$u->profileField("language")}{var}{url} = WebGUI::URL::getSiteURL().$self->getUrl;
|
||||
$lang{$u->profileField("language")}{var}{'notify.subscription.message'} =
|
||||
|
|
@ -810,7 +810,7 @@ sub setStatusPending {
|
|||
} else {
|
||||
$self->update({status=>'pending'});
|
||||
WebGUI::MessageLog::addInternationalizedEntry('',$self->getThread->getParent->get("moderateGroupId"),
|
||||
$self->getUrl,578,'WebGUI','pending');
|
||||
$self->getUrl("revision=".$self->get("revisionDate")),578,'WebGUI','pending');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,10 +76,16 @@ sub appendPostListTemplateVars {
|
|||
);
|
||||
}
|
||||
}
|
||||
my $url;
|
||||
if ($post->get("status") eq "pending" || $post->get("status") eq "denied") {
|
||||
$url = $post->getUrl("revision=".$post->get("revisionDate"))."#".$post->getId;
|
||||
} else {
|
||||
$url = $post->getUrl."#".$post->getId;
|
||||
}
|
||||
push(@{$var->{post_loop}}, {
|
||||
%{$post->get},
|
||||
"id"=>$post->getId,
|
||||
"url"=>$post->getUrl.'#'.$post->getId,
|
||||
"url"=>$url,
|
||||
rating_loop=>\@rating_loop,
|
||||
"content"=>$post->formatContent,
|
||||
"status"=>$post->getStatus,
|
||||
|
|
@ -898,7 +904,7 @@ sub view {
|
|||
$var{"subscribe.url"} = $self->getSubscribeUrl;
|
||||
$var{"unsubscribe.url"} = $self->getUnsubscribeUrl;
|
||||
my $constraints = "(assetData.status='approved' or (assetData.ownerUserId=".quote($session{user}{userId})." and assetData.ownerUserId<>'1') or assetData.tagId=".quote($session{scratch}{versionTag});
|
||||
if ($var{canModerate}) {
|
||||
if ($var{'user.isModerator'}) {
|
||||
$constraints .= " or assetData.status='pending'";
|
||||
}
|
||||
$constraints .= ")";
|
||||
|
|
|
|||
|
|
@ -422,7 +422,7 @@ Returns an asset hash of the parent of current Asset.
|
|||
|
||||
sub getParent {
|
||||
my $self = shift;
|
||||
return $self if ($self->get("assetId") eq "PBasset000000000000001");
|
||||
return $self if ($self->getId eq "PBasset000000000000001");
|
||||
$self->{_parent} = WebGUI::Asset->newByDynamicClass($self->get("parentId")) unless (exists $self->{_parent});
|
||||
return $self->{_parent};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue