Merge branch 'WebGUI8' into psgi
Conflicts: sbin/testEnvironment.pl
This commit is contained in:
commit
f16ba76b86
109 changed files with 1546 additions and 2197 deletions
|
|
@ -836,9 +836,9 @@ sub www_addSubmission {
|
|||
}
|
||||
}
|
||||
}
|
||||
$form = WebGUI::Asset->newByDynamicClass($session,$formId);
|
||||
if (!defined $form) {
|
||||
$session->errorHandler->error(__PACKAGE__ . " - failed to instanciate asset with assetId $formId");
|
||||
$form = eval { WebGUI::Asset->newById($session, $formId); };
|
||||
if (Exception::Class->caught()) {
|
||||
$session->errorHandler->error(__PACKAGE__ . " - failed to instanciate asset with assetId $formId");
|
||||
}
|
||||
return $form->www_addSubmission;
|
||||
}
|
||||
|
|
@ -1351,7 +1351,7 @@ sub www_getAllSubmissions {
|
|||
$tableInfo->{'records' } = [];
|
||||
|
||||
for my $record ( @{ $p->getPageData } ) {
|
||||
my $asset = WebGUI::Asset->newByDynamicClass( $session, $record->{assetId} );
|
||||
my $asset = WebGUI::Asset->newById( $session, $record->{assetId} );
|
||||
|
||||
my $lastReplyBy = $asset->get("lastReplyBy");
|
||||
if ($lastReplyBy) {
|
||||
|
|
|
|||
|
|
@ -551,7 +551,7 @@ sub getAlbumIds {
|
|||
my $orderBy = $options->{ orderBy }
|
||||
? $options->{ orderBy }
|
||||
: $self->viewListOrderBy
|
||||
? join( " ", $self->getviewListOrderBy, $self->viewListOrderDirection )
|
||||
? join( " ", $self->viewListOrderBy, $self->viewListOrderDirection )
|
||||
: "lineage ASC"
|
||||
;
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ use Carp qw( croak );
|
|||
use File::Find;
|
||||
use File::Spec;
|
||||
use File::Temp qw{ tempdir };
|
||||
use JSON ();
|
||||
use JSON qw();
|
||||
use WebGUI::International;
|
||||
use WebGUI::HTML;
|
||||
use WebGUI::ProgressBar;
|
||||
|
|
@ -1171,7 +1171,7 @@ sub www_ajax {
|
|||
my $result;
|
||||
|
||||
# Get arguments encoded in json format
|
||||
my $args = decode_json($form->get("args"));
|
||||
my $args = JSON::from_json($form->get("args"));
|
||||
|
||||
# Log some debug information
|
||||
$session->log->debug("Ajax service called with args=" . $form->get("args"));
|
||||
|
|
@ -1198,7 +1198,7 @@ sub www_ajax {
|
|||
$result->{ err } = -1 if $result->{ errMessage };
|
||||
|
||||
# Return results encoded in json format
|
||||
return encode_json( $result );
|
||||
return JSON::to_json( $result );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1247,10 +1247,10 @@ sub _moveFileAjaxRequest {
|
|||
|
||||
# Get Id of target photo and instantiate asset
|
||||
my $targetId = $args->{target};
|
||||
my $target = WebGUI::Asset->newByDynamicClass( $session, $targetId );
|
||||
my $target = eval { WebGUI::Asset->newById( $session, $targetId ); };
|
||||
|
||||
# Return if target photo could not be instantiated
|
||||
unless ( $target ) {
|
||||
if ( Exception::Class->caught() ) {
|
||||
$session->log->error("Couldn't move file '$targetId' because we couldn't instantiate it.");
|
||||
$result{ errMessage } = "ID of target file seems to be invalid.";
|
||||
return \%result;
|
||||
|
|
@ -1266,10 +1266,10 @@ sub _moveFileAjaxRequest {
|
|||
|
||||
# Instantiate file with ID in before/after argument
|
||||
$destId = $args->{before} ? $args->{before} : $args->{after};
|
||||
$dest = WebGUI::Asset->newByDynamicClass( $session, $destId );
|
||||
$dest = eval { WebGUI::Asset->newById( $session, $destId ); };
|
||||
|
||||
# Return if destination file could not be instantiated
|
||||
unless ( $dest ) {
|
||||
if ( Exception::Class->caught() ) {
|
||||
$session->log->error("Couldn't move file '$targetId' before/after file '$destId' because we couldn't instantiate the latter.");
|
||||
$result{ errMessage } = "ID in before/after argument seems to be invalid.";
|
||||
return \%result;
|
||||
|
|
@ -1286,14 +1286,14 @@ sub _moveFileAjaxRequest {
|
|||
# Get ID of next sibling
|
||||
$destId = $self->getNextFileId( $destId );
|
||||
# Instantiate next sibling
|
||||
$dest = WebGUI::Asset->newByDynamicClass( $session, $destId );
|
||||
$dest = WebGUI::Asset->newById( $session, $destId );
|
||||
}
|
||||
# Check for use of before argument when increasing the rank
|
||||
if ( $args->{before} && $target->getRank() < $dest->getRank() ) {
|
||||
# Get ID of previous sibling
|
||||
$destId = $self->getPreviousFileId( $destId );
|
||||
# Instantiate previous sibling
|
||||
$dest = WebGUI::Asset->newByDynamicClass( $session, $destId );
|
||||
$dest = WebGUI::Asset->newById( $session, $destId );
|
||||
}
|
||||
|
||||
# Update rank of target photo
|
||||
|
|
|
|||
|
|
@ -265,8 +265,7 @@ part of the C<groupToAdd> group.
|
|||
|
||||
=cut
|
||||
|
||||
sub canEdit {
|
||||
my $orig = shift;
|
||||
override canEdit => sub {
|
||||
my $self = shift;
|
||||
my $userId = shift || $self->session->user->userId;
|
||||
|
||||
|
|
@ -276,14 +275,8 @@ sub canEdit {
|
|||
&& $form->get( 'class' )->isa( 'WebGUI::Asset::MatrixListing' ) ) {
|
||||
return $self->canAddMatrixListing();
|
||||
}
|
||||
else {
|
||||
if ($userId eq $self->ownerUserId) {
|
||||
return 1;
|
||||
}
|
||||
my $user = WebGUI::User->new($self->session, $userId);
|
||||
return $user->isInGroup($self->groupIdEdit);
|
||||
}
|
||||
}
|
||||
return super();
|
||||
};
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ use HTML::Entities;
|
|||
use WebGUI::Exception;
|
||||
use WebGUI::HTML;
|
||||
use WebGUI::International;
|
||||
use LWP::UserAgent;
|
||||
|
||||
use Moose;
|
||||
use WebGUI::Definition::Asset;
|
||||
|
|
@ -216,6 +217,7 @@ sub getRssFeedItems {
|
|||
author => $item->author,
|
||||
guid => $item->guid,
|
||||
);
|
||||
push @items, \%feed_item;
|
||||
}
|
||||
return \@items;
|
||||
}
|
||||
|
|
@ -293,11 +295,12 @@ See WebGUI::Asset::prepareView() for details.
|
|||
|
||||
=cut
|
||||
|
||||
sub prepareView {
|
||||
around prepareView => sub {
|
||||
my $orig = shift;
|
||||
my $self = shift;
|
||||
$self->next::method;
|
||||
my $template = WebGUI::Asset::Template->newById($self->session, $self->templateId);
|
||||
if (!$template) {
|
||||
$self->$orig();
|
||||
my $template = eval { WebGUI::Asset->newById($self->session, $self->templateId); };
|
||||
if (Exception::Class->caught()) {
|
||||
WebGUI::Error::ObjectNotFound::Template->throw(
|
||||
error => qq{Template not found},
|
||||
templateId => $self->templateId,
|
||||
|
|
@ -306,7 +309,7 @@ sub prepareView {
|
|||
}
|
||||
$template->prepare($self->getMetaDataAsTemplateVariables);
|
||||
$self->{_viewTemplate} = $template;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -358,63 +361,11 @@ See WebGUI::Asset::Wobject::www_view() for details.
|
|||
|
||||
=cut
|
||||
|
||||
sub www_view {
|
||||
my $self = shift;
|
||||
$self->session->http->setCacheControl($self->cacheTimeout);
|
||||
$self->next::method(@_);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_viewRSS090 ( )
|
||||
|
||||
Deprecated. Use www_viewRss() instead.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_viewRSS090 {
|
||||
my $self = shift;
|
||||
return $self->www_viewRss;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_viewRSS091 ( )
|
||||
|
||||
Deprecated. Use www_viewRss() instead.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_viewRSS091 {
|
||||
my $self = shift;
|
||||
return $self->www_viewRss;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_viewRSS10 ( )
|
||||
|
||||
Deprecated. Use www_viewRdf() instead.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_viewRSS10 {
|
||||
my $self = shift;
|
||||
return $self->www_viewRdf;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_viewRSS20 ( )
|
||||
|
||||
Deprecated. Use www_viewRss() instead.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_viewRSS20 {
|
||||
my $self = shift;
|
||||
return $self->www_viewRss;
|
||||
}
|
||||
override www_view => sub {
|
||||
my $self = shift;
|
||||
$self->session->http->setCacheControl($self->cacheTimeout);
|
||||
super();
|
||||
};
|
||||
|
||||
__PACKAGE__->meta->make_immutable;
|
||||
1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue