Merge commit '17ce3572bf' into WebGUI8. All tests passing.
This commit is contained in:
commit
5e502fee53
117 changed files with 2012 additions and 1027 deletions
|
|
@ -108,8 +108,7 @@ override applyConstraints => sub {
|
|||
$storage->resize( $file, undef, undef, $gallery->imageDensity );
|
||||
$storage->adjustMaxImageSize($file, $maxImageSize);
|
||||
|
||||
$self->generateThumbnail;
|
||||
$self->setSize;
|
||||
$self->generateThumbnail;
|
||||
$self->updateExifDataFromFile;
|
||||
super();
|
||||
};
|
||||
|
|
@ -229,10 +228,11 @@ sub getEditFormUploadControl {
|
|||
}
|
||||
|
||||
# Control to upload a new file
|
||||
$html .= WebGUI::Form::file( $session, {
|
||||
name => 'newFile',
|
||||
label => $i18n->get('new file'),
|
||||
hoverHelp => $i18n->get('new file description'),
|
||||
$html .= WebGUI::Form::image( $session, {
|
||||
name => 'newFile',
|
||||
label => $i18n->get('new file'),
|
||||
hoverHelp => $i18n->get('new file description'),
|
||||
forceImageOnly => 1,
|
||||
});
|
||||
|
||||
return $html;
|
||||
|
|
@ -378,11 +378,19 @@ contained in.
|
|||
sub makeResolutions {
|
||||
my $self = shift;
|
||||
my $resolutions = shift;
|
||||
my $session = $self->session;
|
||||
my $error;
|
||||
|
||||
croak "Photo->makeResolutions: resolutions must be an array reference"
|
||||
if $resolutions && ref $resolutions ne "ARRAY";
|
||||
|
||||
# # Return immediately if no image is available
|
||||
# if ( $self->get("filename") eq '' )
|
||||
# {
|
||||
# $session->log->error("makeResolutions skipped since no image available");
|
||||
# return;
|
||||
# }
|
||||
|
||||
# Get default if necessary
|
||||
$resolutions ||= $self->getGallery->getImageResolutions;
|
||||
|
||||
|
|
@ -413,13 +421,20 @@ Make the default title into the file name minus the extention.
|
|||
|
||||
override processPropertiesFromFormPost => sub {
|
||||
my $self = shift;
|
||||
my $i18n = WebGUI::International->new( $self->session,'Asset_Photo' );
|
||||
my $form = $self->session->form;
|
||||
my $errors = super() || [];
|
||||
|
||||
# Make sure there is an image file attached to this asset.
|
||||
if ( !$self->get('filename') ) {
|
||||
push @{ $errors }, $i18n->get('error no image');
|
||||
}
|
||||
|
||||
# Return if errors
|
||||
return $errors if @$errors;
|
||||
|
||||
### Passes all checks
|
||||
|
||||
# If no title was given, make it the file name
|
||||
if ( !$form->get('title') ) {
|
||||
my $title = $self->filename;
|
||||
|
|
@ -586,6 +601,7 @@ sub www_edit {
|
|||
$var->{ form_start }
|
||||
= WebGUI::Form::formHeader( $session, {
|
||||
action => $self->getParent->getUrl('func=editSave;assetId=new;class='.__PACKAGE__),
|
||||
extras => 'name="photoAdd"',
|
||||
})
|
||||
. WebGUI::Form::hidden( $session, {
|
||||
name => 'ownerUserId',
|
||||
|
|
@ -597,6 +613,7 @@ sub www_edit {
|
|||
$var->{ form_start }
|
||||
= WebGUI::Form::formHeader( $session, {
|
||||
action => $self->getUrl('func=editSave'),
|
||||
extras => 'name="photoEdit"',
|
||||
})
|
||||
. WebGUI::Form::hidden( $session, {
|
||||
name => 'ownerUserId',
|
||||
|
|
@ -607,7 +624,7 @@ sub www_edit {
|
|||
$var->{ form_start }
|
||||
.= WebGUI::Form::hidden( $session, {
|
||||
name => "proceed",
|
||||
value => "showConfirmation",
|
||||
value => $form->get('proceed') || "showConfirmation",
|
||||
});
|
||||
|
||||
$var->{ form_end } = WebGUI::Form::formFooter( $session );
|
||||
|
|
|
|||
|
|
@ -119,8 +119,8 @@ sub _fixReplyCount {
|
|||
isa => 'WebGUI::Asset::Post',
|
||||
orderByClause => 'assetData.revisionDate desc',
|
||||
} )->[0];
|
||||
|
||||
if (my $lastPost = WebGUI::Asset->newById( $self->session, $lastPostId ) ) {
|
||||
my $lastPost = eval { WebGUI::Asset->newById( $self->session, $lastPostId ); };
|
||||
if ( ! Exception::Class->caught() ) {
|
||||
$asset->incrementReplies( $lastPost->revisionDate, $lastPost->getId );
|
||||
}
|
||||
else {
|
||||
|
|
@ -292,23 +292,30 @@ the parent thread.
|
|||
=cut
|
||||
|
||||
override cut => sub {
|
||||
warn "post's cut";
|
||||
my $self = shift;
|
||||
|
||||
# Fetch the Thread and CS before cutting the asset.
|
||||
my $thread = $self->getThread;
|
||||
warn "got thread";
|
||||
my $cs = $thread->getParent;
|
||||
warn "got cs";
|
||||
|
||||
# Cut the asset
|
||||
my $result = super();
|
||||
warn "called super";
|
||||
|
||||
# If a post is being cut update the thread reply count first
|
||||
if ($thread->getId ne $self->getId) {
|
||||
warn "calling _fixReplyCount on thread";
|
||||
$self->_fixReplyCount( $thread );
|
||||
}
|
||||
|
||||
# Update the CS reply count. This step is also necessary when a Post is cut since the Thread's incrementReplies
|
||||
# also calls the CS's incrementReplies, possibly with the wrong last post Id.
|
||||
warn "calling _fixReplyCount on cs";
|
||||
$self->_fixReplyCount( $cs );
|
||||
warn "all should be well...?";
|
||||
|
||||
return $result;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -501,12 +501,14 @@ property of the Asset.
|
|||
=cut
|
||||
|
||||
sub getRssData {
|
||||
my $self = shift;
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $url = $session->url->getSiteURL.$self->getUrl;
|
||||
my $data = {
|
||||
title => $self->headline || $self->getTitle,
|
||||
description => $self->story,
|
||||
'link' => $self->getUrl,
|
||||
guid => $self->getUrl,
|
||||
'link' => $url,
|
||||
guid => $url,
|
||||
author => $self->byline,
|
||||
date => $self->lastModified,
|
||||
pubDate => $self->session->datetime->epochToMail($self->creationDate),
|
||||
|
|
|
|||
|
|
@ -769,7 +769,7 @@ sub getEventsIn {
|
|||
&& Event.endTime IS NULL
|
||||
&&
|
||||
!(
|
||||
Event.startDate > '$endDate'
|
||||
Event.startDate > SUBDATE('$endDate', INTERVAL 1 DAY)
|
||||
|| Event.endDate < '$startDate'
|
||||
)
|
||||
)
|
||||
|
|
@ -794,7 +794,7 @@ sub getEventsIn {
|
|||
my $orderby = join ',', @order_priority;
|
||||
|
||||
my $events
|
||||
= $self->getLineage(["descendants"], {
|
||||
= $self->getLineage(["children"], {
|
||||
returnObjects => 1,
|
||||
includeOnlyClasses => ['WebGUI::Asset::Event'],
|
||||
joinClass => 'WebGUI::Asset::Event',
|
||||
|
|
|
|||
|
|
@ -1176,7 +1176,7 @@ sub getThreadsPaginator {
|
|||
$sortBy =~ s/^\w+\.//;
|
||||
# Sort by the thread rating instead of the post rating. other places don't care about threads.
|
||||
$sortBy = $sortBy eq 'rating' ? 'threadRating' : $sortBy;
|
||||
if (! WebGUI::Utility::isIn($sortBy, qw/userDefined1 userDefined2 userDefined3 userDefined4 userDefined5 title lineage revisionDate creationDate karmaRank threadRating/)) {
|
||||
if (! WebGUI::Utility::isIn($sortBy, qw/userDefined1 userDefined2 userDefined3 userDefined4 userDefined5 title lineage revisionDate creationDate karmaRank threadRating views replies lastPostDate/)) {
|
||||
$sortBy = 'revisionDate';
|
||||
}
|
||||
if ($sortBy eq 'assetId' || $sortBy eq 'revisionDate') {
|
||||
|
|
|
|||
|
|
@ -409,17 +409,23 @@ sub view {
|
|||
my %rules;
|
||||
$rules{endingLineageLength} = $start->getLineageLength+$self->descendantEndPoint;
|
||||
$rules{assetToPedigree} = $current if (isIn("pedigree",@includedRelationships));
|
||||
$rules{ancestorLimit} = $self->ancestorEndPoint;
|
||||
$rules{orderByClause} = 'rpad(asset.lineage, 255, 9) desc' if ($self->reversePageLoop);
|
||||
my $assets = $start->getLineage(\@includedRelationships,\%rules);
|
||||
my $currentLineage = $current->lineage;
|
||||
my $assetIter = $start->getLineageIterator(\@includedRelationships,\%rules);
|
||||
my $currentLineage = $current->lineage;
|
||||
my $lineageToSkip = "noskip";
|
||||
my $absoluteDepthOfLastPage;
|
||||
my $absoluteDepthOfFirstPage; # Will set on first iteration of loop, below
|
||||
my %lastChildren;
|
||||
my $previousPageData = undef;
|
||||
my $eh = $self->session->errorHandler;
|
||||
while ( my $asset = $assets->() ) {
|
||||
while ( 1 ) {
|
||||
my $asset;
|
||||
eval { $asset = $assetIter->() };
|
||||
if ( my $x = WebGUI::Error->caught('WebGUI::Error::ObjectNotFound') ) {
|
||||
$self->session->log->error($x->full_message);
|
||||
next;
|
||||
}
|
||||
last unless $asset;
|
||||
|
||||
# skip pages we shouldn't see
|
||||
my $pageLineage = $asset->lineage;
|
||||
next if ($pageLineage =~ m/^$lineageToSkip/);
|
||||
|
|
|
|||
|
|
@ -2408,6 +2408,8 @@ sub editThingData {
|
|||
my $thingId = shift || $session->form->process('thingId');
|
||||
my $thingDataId = shift || $session->form->process('thingDataId') || "new";
|
||||
my $thingProperties = shift || $self->getThing($thingId);
|
||||
my $errors = shift;
|
||||
my $resetForm = shift;
|
||||
my $i18n = WebGUI::International->new($self->session, "Asset_Thingy");
|
||||
|
||||
my $canEditThingData = $self->canEditThingData($thingId, $thingDataId, $thingProperties);
|
||||
|
|
@ -2417,7 +2419,7 @@ sub editThingData {
|
|||
my (%thingData, $fields,@field_loop,$fieldValue, $privilegedGroup);
|
||||
my $var = $self->get;
|
||||
my $url = $self->getUrl;
|
||||
my $errors = shift;
|
||||
|
||||
$var->{error_loop} = $errors if ($errors);
|
||||
|
||||
$var->{canEditThings} = $self->canEdit;
|
||||
|
|
@ -2465,14 +2467,17 @@ sub editThingData {
|
|||
,[$self->getId,$thingId]);
|
||||
while (my %field = $fields->hash) {
|
||||
my $fieldName = 'field_'.$field{fieldId};
|
||||
if ($session->form->process("func") eq "editThingDataSave"){
|
||||
$fieldValue = $session->form->process($fieldName,$field{fieldType},$field{defaultValue});
|
||||
$fieldValue = undef;
|
||||
unless ($resetForm) {
|
||||
if ($session->form->process("func") eq "editThingDataSave"){
|
||||
$fieldValue = $session->form->process($fieldName,$field{fieldType},$field{defaultValue});
|
||||
}
|
||||
else{
|
||||
$fieldValue = $thingData{"field_".$field{fieldId}};
|
||||
}
|
||||
}
|
||||
else{
|
||||
$fieldValue = $thingData{"field_".$field{fieldId}};
|
||||
}
|
||||
$field{value} = $fieldValue || $field{defaultValue};
|
||||
my $formElement .= $self->getFormElement(\%field);
|
||||
$field{value} = $fieldValue || $field{defaultValue};
|
||||
my $formElement .= $self->getFormPlugin(\%field,($resetForm eq ""))->toHtml;
|
||||
|
||||
my $hidden = ($field{status} eq "hidden" && !$self->session->var->isAdminOn);
|
||||
my $value = $field{value};
|
||||
|
|
@ -2546,7 +2551,7 @@ sub www_editThingDataSave {
|
|||
return $self->www_viewThingData($thingId,$newThingDataId);
|
||||
}
|
||||
elsif ($thingProperties->{afterSave} eq "addThing") {
|
||||
return $self->www_editThingData($thingId,"new");
|
||||
return $self->www_editThingData($thingId,"new",undef,undef,"resetForm");
|
||||
}
|
||||
elsif ($thingProperties->{afterSave} =~ m/^searchOther_/x){
|
||||
$otherThingId = $thingProperties->{afterSave};
|
||||
|
|
@ -2556,7 +2561,7 @@ sub www_editThingDataSave {
|
|||
elsif ($thingProperties->{afterSave} =~ m/^addOther_/x){
|
||||
$otherThingId = $thingProperties->{afterSave};
|
||||
$otherThingId =~ s/^addOther_//x;
|
||||
return $self->www_editThingData($otherThingId,"new");
|
||||
return $self->www_editThingData($otherThingId,"new",undef,undef,"resetForm");
|
||||
}
|
||||
# if afterSave is thingy default or in any other case return www_view()
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -353,7 +353,7 @@ sub view {
|
|||
my $url = $self->session->url;
|
||||
my $i18n = WebGUI::International->new($self->session, "Asset_UserList");
|
||||
my (%var, @users, @profileField_loop, @profileFields);
|
||||
my ($defaultPublicProfile, $defaultPublicEmail, $user, $sth, $sql, $profileField);
|
||||
my ($user, $sth, $sql, $profileField);
|
||||
|
||||
my $currentUrlWithoutSort = $self->getUrl();
|
||||
foreach ($form->param) {
|
||||
|
|
@ -505,9 +505,6 @@ sub view {
|
|||
$sortBy = join '.', map { $self->session->db->quoteIdentifier($_) } split /\./, $sortBy;
|
||||
$sql .= " order by ".$sortBy." ".$sortOrder;
|
||||
|
||||
($defaultPublicProfile) = $self->session->db->quickArray("SELECT dataDefault FROM userProfileField WHERE fieldName='publicProfile'");
|
||||
($defaultPublicEmail) = $self->session->db->quickArray("SELECT dataDefault FROM userProfileField WHERE fieldName='publicEmail'");
|
||||
|
||||
my $paginatePage = $form->param('pn') || 1;
|
||||
my $currentUrl = $self->getUrl();
|
||||
foreach ($form->param) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue