Make version tags mandatory again.

This commit is contained in:
Colin Kuskie 2011-10-25 19:44:58 -07:00
parent d0b3be1749
commit 4bfabb9469
94 changed files with 405 additions and 489 deletions

View file

@ -72,18 +72,15 @@ sub copy {
my $tree = WebGUI::ProgressTree->new($session, [ $asset->getId ] );
$process->update(sub { $tree->json });
my $newAsset = $asset->duplicate({ state => "clipboard" });
# If we aren't committing, add to a tag
if ( !$args->{commit} ) {
$newAsset->update({
status => "pending",
tagId => WebGUI::VersionTag->getWorking( $session )->getId,
});
}
$newAsset->update({ title => $newAsset->getTitle . ' (copy)'});
$tree->success($asset->getId);
$process->update(sub { $tree->json });
my $tag = WebGUI::VersionTag->getWorking($session);
if ($tag->canAutoCommit) {
$tag->commit;
}
}
1;

View file

@ -4,6 +4,7 @@ use strict;
use Class::C3;
use base qw/WebGUI::AssetHelper::Copy/;
use Scalar::Util qw{ blessed };
use WebGUI::VersionTag;
=head1 LEGAL
@ -122,17 +123,16 @@ sub copyBranch {
$process->update(sub { $tree->json });
my $newAsset = $asset->duplicateBranch( $args->{childrenOnly} ? 1 : 0, 'clipboard' );
# If we aren't committing, add to a tag
if ( !$args->{commit} ) {
$newAsset->update({
status => "pending",
tagId => WebGUI::VersionTag->getWorking( $session )->getId,
});
}
$newAsset->update({ title => $newAsset->getTitle . ' (copy)'});
$tree->success($asset->getId);
$process->update(sub { $tree->json });
my $tag = WebGUI::VersionTag->getWorking($session);
if ($tag->canAutoCommit) {
$tag->commit;
}
}
1;

View file

@ -48,8 +48,6 @@ sub process {
my $import = WebGUI::Asset->getImportNode( $session );
my $tag = WebGUI::VersionTag->getWorking( $session );
my $child = $import->addChild({
tagId => $tag->getId,
status => 'pending',
className => 'WebGUI::Asset::Shortcut',
shortcutToAssetId => $asset->getId,
title => $asset->getTitle,

View file

@ -73,13 +73,6 @@ sub duplicate {
$process->update(sub { $tree->json });
my $newAsset = $asset->duplicate;
# If we aren't committing, add to a tag
if ( !$args->{commit} ) {
$newAsset->update({
status => "pending",
tagId => WebGUI::VersionTag->getWorking( $session )->getId,
});
}
$newAsset->update({ title => $newAsset->getTitle . ' (Duplicate)'});
$tree->success($asset->getId);

View file

@ -405,7 +405,7 @@ sub www_editBranchSave {
my $revision;
if (scalar %$newData > 0) {
$revision = $descendant->addRevision(
{ %$newData, tagId => $tag->getId, status => "pending" },
{ %$newData, },
undef,
{skipAutoCommitWorkflows => 1, skipNotification => 1},
);

View file

@ -157,8 +157,7 @@ sub www_cropSave {
return $session->privilege->locked() unless $asset->canEditIfLocked;
my $tag = WebGUI::VersionTag->getWorking( $session );
$asset = $asset->addRevision({ tagId => $tag->getId, status => "pending" });
$asset->setVersionLock;
$asset = $asset->addRevision();
delete $asset->{_storageLocation};
$asset->getStorageLocation->crop(
$asset->filename,
@ -171,7 +170,7 @@ sub www_cropSave {
WebGUI::VersionTag->autoCommitWorkingIfEnabled($session, { allowComments => 0 });
# We're in admin mode, close the dialog
my $helper = { message => 'Image croped', };
my $helper = { message => 'Image cropped', };
my $text = '<script type="text/javascript">';
if ( ref $helper eq 'HASH' ) {

View file

@ -146,8 +146,7 @@ sub www_resizeSave {
return $session->privilege->insufficient() unless $asset->canEdit;
return $session->privilege->locked() unless $asset->canEditIfLocked;
my $tag = WebGUI::VersionTag->getWorking($session);
$asset = $asset->addRevision( { tagId => $tag->getId, status => "pending" } );
$asset->setVersionLock;
$asset = $asset->addRevision();
delete $asset->{_storageLocation};
$asset->getStorageLocation->resize(
$asset->filename,

View file

@ -91,8 +91,7 @@ sub www_rotateSave {
return $session->privilege->locked() unless $asset->canEditIfLocked;
my $tag = WebGUI::VersionTag->getWorking( $session );
$asset = $asset->addRevision({ tagId => $tag->getId, status => "pending" });
$asset->setVersionLock;
$asset = $asset->addRevision();
delete $asset->{_storageLocation};
$asset->getStorageLocation->rotate($asset->filename,$session->form->process("Rotate"));
$asset->setSize($asset->getStorageLocation->getFileSize($asset->filename));

View file

@ -53,12 +53,7 @@ sub process {
return { error => sprintf $i18n->get('already locked'), $asset->getTitle};
}
my $tag = WebGUI::VersionTag->getWorking( $session );
$asset = $asset->addRevision({
tagId => $tag->getId,
status => "pending",
});
$asset->setVersionLock;
$asset->addRevision;
return {
message => sprintf($i18n->get('locked asset'), $asset->getTitle),
};