diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm
index 3ca3f84a2..81986c456 100644
--- a/lib/WebGUI/Asset.pm
+++ b/lib/WebGUI/Asset.pm
@@ -1102,7 +1102,24 @@ sub getToolbar {
$toolbar .= $self->session->icon->locked('func=manageRevisions',$self->get("url")) if ($userUiLevel >= $uiLevels->{"revisions"});
}
$toolbar .= $self->session->icon->cut('func=cut',$self->get("url")) if ($userUiLevel >= $uiLevels->{"cut"});
- $toolbar .= $self->session->icon->copy('func=copy',$self->get("url")) if ($userUiLevel >= $uiLevels->{"copy"});
+
+ # if this asset has children, create a more full-featured menu for copying
+ if ($self->getChildCount) {
+ my $copy = '';
+ $toolbar .= $copy;
+ }
+ else {
+ $toolbar .= $self->session->icon->copy('func=copy',$self->get("url")) if ($userUiLevel >= $uiLevels->{"copy"});
+ }
+
$toolbar .= $self->session->icon->shortcut('func=createShortcut',$self->get("url")) if ($userUiLevel >= $uiLevels->{"shortcut"} && !($self->get("className") =~ /Shortcut/));
$self->session->style->setLink($self->session->url->extras('contextMenu/contextMenu.css'), {rel=>"stylesheet",type=>"text/css"});
$self->session->style->setScript($self->session->url->extras('contextMenu/contextMenu.js'), {type=>"text/javascript"});
diff --git a/lib/WebGUI/AssetBranch.pm b/lib/WebGUI/AssetBranch.pm
index 50d0f12ff..bfdce3545 100644
--- a/lib/WebGUI/AssetBranch.pm
+++ b/lib/WebGUI/AssetBranch.pm
@@ -45,22 +45,24 @@ Duplicates this asset and the entire subtree below it. Returns the root of the
=cut
sub duplicateBranch {
- my $self = shift;
- my $newAsset = $self->duplicate({skipAutoCommitWorkflows=>1});
- my $contentPositions = $self->get("contentPositions");
- my $assetsToHide = $self->get("assetsToHide");
+ my $self = shift;
+ my $childrenOnly = shift || 0;
- foreach my $child (@{$self->getLineage(["children"],{returnObjects=>1})}) {
- my $newChild = $child->duplicateBranch;
- $newChild->setParent($newAsset);
- my ($oldChildId, $newChildId) = ($child->getId, $newChild->getId);
- $contentPositions =~ s/\Q${oldChildId}\E/${newChildId}/g if ($contentPositions);
- $assetsToHide =~ s/\Q${oldChildId}\E/${newChildId}/g if ($assetsToHide);
- }
+ my $newAsset = $self->duplicate({skipAutoCommitWorkflows=>1});
+ my $contentPositions = $self->get("contentPositions");
+ my $assetsToHide = $self->get("assetsToHide");
- $newAsset->update({contentPositions=>$contentPositions}) if $contentPositions;
- $newAsset->update({assetsToHide=>$assetsToHide}) if $assetsToHide;
- return $newAsset;
+ foreach my $child (@{$self->getLineage(["children"],{returnObjects=>1})}) {
+ my $newChild = $childrenOnly ? $child->duplicate({skipAutoCommitWorkflows=>1}) : $child->duplicateBranch;
+ $newChild->setParent($newAsset);
+ my ($oldChildId, $newChildId) = ($child->getId, $newChild->getId);
+ $contentPositions =~ s/\Q${oldChildId}\E/${newChildId}/g if ($contentPositions);
+ $assetsToHide =~ s/\Q${oldChildId}\E/${newChildId}/g if ($assetsToHide);
+ }
+
+ $newAsset->update({contentPositions=>$contentPositions}) if $contentPositions;
+ $newAsset->update({assetsToHide=>$assetsToHide}) if $assetsToHide;
+ return $newAsset;
}
diff --git a/lib/WebGUI/AssetClipboard.pm b/lib/WebGUI/AssetClipboard.pm
index d8cdf79ad..113d3084e 100644
--- a/lib/WebGUI/AssetClipboard.pm
+++ b/lib/WebGUI/AssetClipboard.pm
@@ -185,10 +185,23 @@ Duplicates self, cuts duplicate, returns self->getContainer->www_view if canEdit
sub www_copy {
my $self = shift;
return $self->session->privilege->insufficient() unless $self->canEdit;
- my $newAsset = $self->duplicate({skipAutoCommitWorkflows => 1});
- $newAsset->update({ title=>$self->getTitle.' (copy)'});
- $newAsset->cut;
- return $self->session->asset($self->getContainer)->www_view;
+
+ # with: 'children' || 'descendants' || ''
+ my $with = $self->session->form->get('with') || '';
+
+ if ($with) {
+ my $childrenOnly = $with eq 'children';
+ my $newAsset = $self->duplicateBranch($childrenOnly);
+ $newAsset->update({ title=>$self->getTitle.' (copy)'});
+ $newAsset->cut;
+ return $self->session->asset($self->getContainer)->www_view;
+ }
+ else {
+ my $newAsset = $self->duplicate({skipAutoCommitWorkflows => 1});
+ $newAsset->update({ title=>$self->getTitle.' (copy)'});
+ $newAsset->cut;
+ return $self->session->asset($self->getContainer)->www_view;
+ }
}
#-------------------------------------------------------------------
diff --git a/lib/WebGUI/i18n/English/Asset.pm b/lib/WebGUI/i18n/English/Asset.pm
index dfc55fafc..2d0c1f096 100644
--- a/lib/WebGUI/i18n/English/Asset.pm
+++ b/lib/WebGUI/i18n/English/Asset.pm
@@ -241,6 +241,24 @@ our $I18N = {
context => q|Used in asset context menus.|
},
+ 'this asset only' => {
+ message => q|This Asset Only|,
+ lastUpdated => 0,
+ context => q|Used in the small pop-up copy menu.|
+ },
+
+ 'with children' => {
+ message => q|With Children|,
+ lastUpdated => 0,
+ context => q|Used in the small pop-up copy menu.|
+ },
+
+ 'with descendants' => {
+ message => q|With Descendants|,
+ lastUpdated => 0,
+ context => q|Used in the small pop-up copy menu.|
+ },
+
'create shortcut' => {
message => q|Create Shortcut|,
lastUpdated => 0,
diff --git a/www/extras/contextMenu/contextMenu.js b/www/extras/contextMenu/contextMenu.js
index 381fb489c..0723cdb28 100755
--- a/www/extras/contextMenu/contextMenu.js
+++ b/www/extras/contextMenu/contextMenu.js
@@ -47,10 +47,11 @@ function contextMenu_hide(){
return false;
}
-function contextMenu_createWithImage(imagePath, id, name){
+function contextMenu_createWithImage(imagePath, id, name, addContext){
contextMenu_items.push(id);
this.id = id;
this.name = name;
+ this.addContext = addContext;
this.type = "image";
this.imagePath=imagePath;
this.linkLabels = new Array();
@@ -80,7 +81,14 @@ function contextMenu_draw(){
}
output += '';
if (this.type == "image") {
- output += '';
+ if (this.addContext)
+ output += '