Merge commit 'v7.10.15' into 8
Conflicts: docs/gotcha.txt docs/previousVersion.sql docs/templates.txt lib/WebGUI.pm lib/WebGUI/Asset.pm lib/WebGUI/Asset/Event.pm lib/WebGUI/Asset/File.pm lib/WebGUI/Asset/MapPoint.pm lib/WebGUI/Asset/RichEdit.pm lib/WebGUI/Asset/Sku/Product.pm lib/WebGUI/Asset/Snippet.pm lib/WebGUI/Asset/Story.pm lib/WebGUI/Asset/Template.pm lib/WebGUI/Asset/Template/TemplateToolkit.pm lib/WebGUI/Asset/Wobject/Calendar.pm lib/WebGUI/Asset/Wobject/Carousel.pm lib/WebGUI/Asset/Wobject/Collaboration.pm lib/WebGUI/Asset/Wobject/Dashboard.pm lib/WebGUI/Asset/Wobject/DataForm.pm lib/WebGUI/Asset/Wobject/Folder.pm lib/WebGUI/Asset/Wobject/Map.pm lib/WebGUI/Asset/Wobject/Search.pm lib/WebGUI/Asset/Wobject/Shelf.pm lib/WebGUI/Asset/Wobject/StockData.pm lib/WebGUI/Asset/Wobject/StoryTopic.pm lib/WebGUI/Asset/Wobject/SyndicatedContent.pm lib/WebGUI/Asset/Wobject/Thingy.pm lib/WebGUI/Asset/Wobject/WeatherData.pm lib/WebGUI/AssetClipboard.pm lib/WebGUI/AssetCollateral/DataForm/Entry.pm lib/WebGUI/AssetExportHtml.pm lib/WebGUI/AssetLineage.pm lib/WebGUI/AssetMetaData.pm lib/WebGUI/AssetTrash.pm lib/WebGUI/AssetVersioning.pm lib/WebGUI/Auth.pm lib/WebGUI/Cache/CHI.pm lib/WebGUI/Content/AssetManager.pm lib/WebGUI/Fork/ProgressBar.pm lib/WebGUI/Form/JsonTable.pm lib/WebGUI/Form/TimeField.pm lib/WebGUI/Form/Zipcode.pm lib/WebGUI/Group.pm lib/WebGUI/International.pm lib/WebGUI/Macro/AssetProxy.pm lib/WebGUI/Macro/FileUrl.pm lib/WebGUI/Operation/SSO.pm lib/WebGUI/Operation/User.pm lib/WebGUI/Role/Asset/Subscribable.pm lib/WebGUI/Shop/Cart.pm lib/WebGUI/Shop/Transaction.pm lib/WebGUI/Shop/TransactionItem.pm lib/WebGUI/Test.pm lib/WebGUI/URL/Content.pm lib/WebGUI/URL/Uploads.pm lib/WebGUI/User.pm lib/WebGUI/Workflow/Activity/ExtendCalendarRecurrences.pm lib/WebGUI/Workflow/Activity/SendNewsletters.pm lib/WebGUI/i18n/English/Asset.pm lib/WebGUI/i18n/English/WebGUI.pm sbin/installClass.pl sbin/rebuildLineage.pl sbin/search.pl sbin/testEnvironment.pl t/Asset/Asset.t t/Asset/AssetClipboard.t t/Asset/AssetLineage.t t/Asset/AssetMetaData.t t/Asset/Event.t t/Asset/File.t t/Asset/File/Image.t t/Asset/Post/notification.t t/Asset/Sku.t t/Asset/Story.t t/Asset/Template.t t/Asset/Wobject/Collaboration/templateVariables.t t/Asset/Wobject/Collaboration/unarchiveAll.t t/Asset/Wobject/Shelf.t t/Auth.t t/Macro/EditableToggle.t t/Macro/FilePump.t t/Shop/Cart.t t/Shop/Transaction.t t/Storage.t t/User.t t/Workflow.t
This commit is contained in:
commit
277faae8a1
783 changed files with 32041 additions and 25495 deletions
|
|
@ -207,6 +207,26 @@ sub exportAssetData {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 exportGetRelatedAssetIds
|
||||
|
||||
Overriden to include any topics in which this story would appear.
|
||||
|
||||
=cut
|
||||
|
||||
sub exportGetRelatedAssetIds {
|
||||
my $self = shift;
|
||||
my $rel = $self->SUPER::exportGetRelatedAssetIds(@_);
|
||||
push @$rel, @{
|
||||
WebGUI::Keyword->new($self->session)->getMatchingAssets({
|
||||
keywords => WebGUI::Keyword::string2list($self->get('keywords')),
|
||||
isa => 'WebGUI::Asset::Wobject::StoryTopic',
|
||||
})
|
||||
};
|
||||
return $rel;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 formatDuration ( $lastUpdated )
|
||||
|
||||
Format the time since this story was last updated. If it is longer than 1 week, then
|
||||
|
|
@ -396,6 +416,9 @@ sub getEditForm {
|
|||
value => $i18n->get('save and add another photo'),
|
||||
}),
|
||||
};
|
||||
if ($session->setting->get('metaDataEnabled')) {
|
||||
$var->{metadata} = $self->getMetaDataAsFormFields;
|
||||
}
|
||||
$var->{ photo_form_loop } = [];
|
||||
##Provide forms for the existing photos, if any
|
||||
##Existing photos get a delete Yes/No.
|
||||
|
|
@ -405,12 +428,16 @@ sub getEditForm {
|
|||
foreach my $photoIndex (1..$numberOfPhotos) {
|
||||
my $photo = $photoData->[$photoIndex-1];
|
||||
my $storage = WebGUI::Storage->get($session, $photo->{storageId});
|
||||
my $filename = $storage->getFiles->[0];
|
||||
my $filename = $storage && $storage->getFiles->[0];
|
||||
push @{ $var->{ photo_form_loop } }, {
|
||||
hasPhoto => $filename ? 1 : 0,
|
||||
imgThumb => $filename ? $storage->getThumbnailUrl($filename) : '',
|
||||
imgUrl => $filename ? $storage->getUrl($filename) : '',
|
||||
imgFilename => $filename ? $filename : '',
|
||||
imgRemoteUrlForm => WebGUI::Form::text($session, {
|
||||
name => 'imgRemoteUrl'.$photoIndex,
|
||||
value => $photo->{remoteUrl},
|
||||
}),
|
||||
newUploadForm => WebGUI::Form::file($session, {
|
||||
name => 'newPhoto' . $photoIndex,
|
||||
maxAttachments => 1,
|
||||
|
|
@ -442,6 +469,9 @@ sub getEditForm {
|
|||
};
|
||||
}
|
||||
push @{ $var->{ photo_form_loop } }, {
|
||||
imgRemoteUrlForm => WebGUI::Form::text($session, {
|
||||
name => 'imgRemoteUrl',
|
||||
}),
|
||||
newUploadForm => WebGUI::Form::image($session, {
|
||||
name => 'newPhoto',
|
||||
maxAttachments => 1,
|
||||
|
|
@ -580,16 +610,20 @@ sub processEditForm {
|
|||
PHOTO: foreach my $photoIndex (1..$numberOfPhotos) {
|
||||
##TODO: Deletion check and storage cleanup
|
||||
my $storageId = $photoData->[$photoIndex-1]->{storageId};
|
||||
my $storage = $storageId && WebGUI::Storage->get($session, $storageId);
|
||||
my $remote = $form->process("imgRemoteUrl$photoIndex");
|
||||
if ($form->process('deletePhoto'.$photoIndex, 'yesNo')) {
|
||||
my $storage = WebGUI::Storage->get($session, $storageId);
|
||||
$storage->delete if $storage;
|
||||
splice @{ $photoData }, $photoIndex-1, 1;
|
||||
next PHOTO;
|
||||
}
|
||||
##Process photos with urls that replace existing photos
|
||||
if ($remote) {
|
||||
$storage->delete() if $storage;
|
||||
}
|
||||
##Process uploads that replace existing photos
|
||||
if (my $uploadId = $form->process('newPhoto'.$photoIndex,'File')) {
|
||||
elsif (my $uploadId = $form->process('newPhoto'.$photoIndex,'File')) {
|
||||
my $upload = WebGUI::Storage->get($session, $uploadId);
|
||||
my $storage = WebGUI::Storage->get($session, $storageId);
|
||||
$storage->clear;
|
||||
my $filename = $upload->getFiles->[0];
|
||||
$storage->addFileFromFilesystem($upload->getPath($filename));
|
||||
|
|
@ -600,31 +634,43 @@ sub processEditForm {
|
|||
$upload->delete;
|
||||
}
|
||||
my $newPhoto = {
|
||||
storageId => $storageId,
|
||||
caption => $form->process('imgCaption'.$photoIndex, 'text'),
|
||||
alt => $form->process('imgAlt' .$photoIndex, 'text'),
|
||||
title => $form->process('imgTitle' .$photoIndex, 'text'),
|
||||
byLine => $form->process('imgByline' .$photoIndex, 'text'),
|
||||
url => $form->process('imgUrl' .$photoIndex, 'url' ),
|
||||
};
|
||||
if ($remote) {
|
||||
$newPhoto->{remoteUrl} = $remote;
|
||||
}
|
||||
else {
|
||||
$newPhoto->{storageId} = $storageId;
|
||||
}
|
||||
splice @{ $photoData }, $photoIndex-1, 1, $newPhoto;
|
||||
}
|
||||
my $newStorageId = $form->process('newPhoto', 'image');
|
||||
if ($newStorageId) {
|
||||
my $newStorage = WebGUI::Storage->get($session, $newStorageId);
|
||||
my $photoName = $newStorage->getFiles->[0];
|
||||
my ($width, $height) = $newStorage->getSizeInPixels($photoName);
|
||||
if ($width > $self->getArchive->photoWidth) {
|
||||
$newStorage->resize($photoName, $self->getArchive->photoWidth);
|
||||
}
|
||||
push @{ $photoData }, {
|
||||
my $newRemote = $form->process('imgRemoteUrl');
|
||||
if ($newStorageId || $newRemote) {
|
||||
my $newPhoto = {
|
||||
caption => $form->process('newImgCaption', 'text'),
|
||||
alt => $form->process('newImgAlt', 'text'),
|
||||
title => $form->process('newImgTitle', 'text'),
|
||||
byLine => $form->process('newImgByline', 'text'),
|
||||
url => $form->process('newImgUrl', 'url'),
|
||||
storageId => $newStorageId,
|
||||
};
|
||||
if ($newRemote) {
|
||||
$newPhoto->{remoteUrl} = $newRemote;
|
||||
}
|
||||
else {
|
||||
my $newStorage = WebGUI::Storage->get($session, $newStorageId);
|
||||
my $photoName = $newStorage->getFiles->[0];
|
||||
my ($width, $height) = $newStorage->getSizeInPixels($photoName);
|
||||
if ($width > $self->getArchive->get('photoWidth')) {
|
||||
$newStorage->resize($photoName, $self->getArchive->get('photoWidth'));
|
||||
}
|
||||
$newPhoto->{storageId} = $newStorageId;
|
||||
}
|
||||
push @{ $photoData }, $newPhoto;
|
||||
}
|
||||
$self->setPhotoData($photoData);
|
||||
$self->{_parent} = $archive; ##Restore archive, for URL and other calculations
|
||||
|
|
@ -666,8 +712,9 @@ Remove the storage locations for this revision of the Asset.
|
|||
override purgeRevision => sub {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
foreach my $photo ( @{ $self->getPhotoData} ) {
|
||||
my $storage = WebGUI::Storage->get($session, $self-$photo->{storageId});
|
||||
PHOTO: foreach my $photo ( @{ $self->getPhotoData} ) {
|
||||
my $id = $photo->{storageId} or next PHOTO;
|
||||
my $storage = WebGUI::Storage->get($session, $id);
|
||||
$storage->delete if $storage;
|
||||
}
|
||||
return super();
|
||||
|
|
@ -832,13 +879,23 @@ sub viewTemplateVariables {
|
|||
}
|
||||
}
|
||||
|
||||
my $key = WebGUI::Keyword->new($session);
|
||||
my $keywords = $key->getKeywordsForAsset( { asArrayRef => 1, asset => $self });
|
||||
my $isExporting = $session->scratch->get('isExporting');
|
||||
my $key = WebGUI::Keyword->new($session);
|
||||
my $keywords = $key->getKeywordsForAsset( { asArrayRef => 1, asset => $self });
|
||||
$var->{keyword_loop} = [];
|
||||
my $parent = $self->getParent;
|
||||
my $upwards = $parent->isa('WebGUI::Asset::Wobject::StoryArchive')
|
||||
? '' #In parallel with the Keywords files
|
||||
: '../' #Keywords files are one level up
|
||||
;
|
||||
foreach my $keyword (@{ $keywords }) {
|
||||
my $keyword_url = $isExporting
|
||||
? $upwards . $archive->getKeywordFilename($keyword)
|
||||
: $archive->getUrl("func=view;keyword=".$session->url->escape($keyword))
|
||||
;
|
||||
push @{ $var->{keyword_loop} }, {
|
||||
keyword => $keyword,
|
||||
url => $archive->getUrl("func=view;keyword=".$session->url->escape($keyword)),
|
||||
url => $keyword_url,
|
||||
};
|
||||
}
|
||||
$var->{updatedTime} = $self->formatDuration();
|
||||
|
|
@ -849,11 +906,19 @@ sub viewTemplateVariables {
|
|||
$var->{photo_loop} = [];
|
||||
my $photoCounter = 0;
|
||||
PHOTO: foreach my $photo (@{ $photoData }) {
|
||||
next PHOTO unless $photo->{storageId};
|
||||
my $storage = WebGUI::Storage->get($session, $photo->{storageId});
|
||||
my $file = $storage->getFiles->[0];
|
||||
next PHOTO unless $file;
|
||||
my $imageUrl = $storage->getUrl($file);
|
||||
my $imageUrl;
|
||||
if (my $remote = $photo->{remoteUrl}) {
|
||||
$imageUrl = $remote;
|
||||
}
|
||||
elsif (my $id = $photo->{storageId}) {
|
||||
my $storage = WebGUI::Storage->get($session, $photo->{storageId});
|
||||
my $file = $storage->getFiles->[0];
|
||||
next PHOTO unless $file;
|
||||
$imageUrl = $storage->getUrl($file);
|
||||
}
|
||||
else {
|
||||
next PHOTO;
|
||||
}
|
||||
push @{ $var->{photo_loop} }, {
|
||||
imageUrl => $imageUrl,
|
||||
imageCaption => $photo->{caption},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue