forked from 0x2620/pandora
fix copy&paste documents to item/document via menu
This commit is contained in:
parent
2a1b4ece6b
commit
82d369e58d
2 changed files with 30 additions and 9 deletions
|
@ -1104,6 +1104,10 @@ pandora.ui.documentsPanel = function(options) {
|
||||||
}).open();
|
}).open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
that.reloadList = function() {
|
||||||
|
$list.reloadList();
|
||||||
|
};
|
||||||
|
|
||||||
that.selectSelected = function(offset) {
|
that.selectSelected = function(offset) {
|
||||||
$list.selectSelected(offset);
|
$list.selectSelected(offset);
|
||||||
return that;
|
return that;
|
||||||
|
|
|
@ -484,19 +484,34 @@ pandora.ui.mainMenu = function() {
|
||||||
clips = pandora.$ui.clipList.options('selected');
|
clips = pandora.$ui.clipList.options('selected');
|
||||||
} else if (ui.section == 'edits') {
|
} else if (ui.section == 'edits') {
|
||||||
clips = pandora.$ui.editPanel.getSelectedClips();
|
clips = pandora.$ui.editPanel.getSelectedClips();
|
||||||
|
} else if (ui.section == 'documents') {
|
||||||
|
clips = ui.collectionSelection;
|
||||||
|
type = 'document';
|
||||||
} else {
|
} else {
|
||||||
clips = ui.listSelection;
|
clips = ui.listSelection;
|
||||||
section = 'item';
|
type = 'item';
|
||||||
}
|
}
|
||||||
pandora.clipboard[action](clips, type);
|
pandora.clipboard[action](clips, type);
|
||||||
} else if (data.id == 'paste') {
|
} else if (data.id == 'paste') {
|
||||||
fromMenu = true;
|
fromMenu = true;
|
||||||
if (ui.section == 'items') {
|
if (ui.section == 'items') {
|
||||||
var items = pandora.clipboard.paste('item');
|
if (pandora.clipboard.type() == 'document') {
|
||||||
items.length && pandora.doHistory('paste', items, ui._list, function() {
|
//fixme use history
|
||||||
pandora.UI.set({listSelection: items});
|
var items = pandora.clipboard.paste('document');
|
||||||
pandora.reloadList();
|
items.length && pandora.api.addDocument({
|
||||||
});
|
item: ui.item,
|
||||||
|
ids: items
|
||||||
|
}, function(result) {
|
||||||
|
Ox.Request.clearCache('findDocuments');
|
||||||
|
pandora.$ui.documents.reloadList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
var items = pandora.clipboard.paste('item');
|
||||||
|
items.length && pandora.doHistory('paste', items, ui._list, function() {
|
||||||
|
pandora.UI.set({listSelection: items});
|
||||||
|
pandora.reloadList();
|
||||||
|
});
|
||||||
|
}
|
||||||
} else if (ui.section == 'documents') {
|
} else if (ui.section == 'documents') {
|
||||||
var items = pandora.clipboard.paste('document');
|
var items = pandora.clipboard.paste('document');
|
||||||
items.length && pandora.doHistory('paste', items, ui._collection, function() {
|
items.length && pandora.doHistory('paste', items, ui._collection, function() {
|
||||||
|
@ -1366,6 +1381,7 @@ pandora.ui.mainMenu = function() {
|
||||||
) + Ox._(
|
) + Ox._(
|
||||||
clipboardType == 'item' ? pandora.site.itemName[clipboardItems == 1 ? 'singular' : 'plural']
|
clipboardType == 'item' ? pandora.site.itemName[clipboardItems == 1 ? 'singular' : 'plural']
|
||||||
: clipboardType == 'clip' ? (clipboardItems == 1 ? 'Clip' : 'Clips')
|
: clipboardType == 'clip' ? (clipboardItems == 1 ? 'Clip' : 'Clips')
|
||||||
|
: clipboardType == 'document' ? (clipboardItems == 1 ? 'Document' : 'Documents')
|
||||||
: ''
|
: ''
|
||||||
),
|
),
|
||||||
canEdit = pandora.hasCapability('canEditMedia') || (
|
canEdit = pandora.hasCapability('canEditMedia') || (
|
||||||
|
@ -1395,10 +1411,11 @@ pandora.ui.mainMenu = function() {
|
||||||
: isVideoView ? ui.videoPoints[ui.item]['in'] != ui.videoPoints[ui.item].out
|
: isVideoView ? ui.videoPoints[ui.item]['in'] != ui.videoPoints[ui.item].out
|
||||||
: isEditView && ui.editSelection.length,
|
: isEditView && ui.editSelection.length,
|
||||||
canCut = canCopy && isEditable,
|
canCut = canCopy && isEditable,
|
||||||
canPaste = (
|
canPaste = ((
|
||||||
(isListView && clipboardType == 'item')
|
(isListView && clipboardType == 'item')
|
||||||
|| (isEditView && clipboardType == 'clip')
|
|| (isEditView && clipboardType == 'document')
|
||||||
) && isEditable,
|
) && isEditable)
|
||||||
|
|| (ui.section == 'items' && ui.itemView == 'documents' && clipboardType == 'document'), // fixme: also check if item is editable: && pandora.$ui.list.value(ui.listSelection[0], 'editable')),
|
||||||
canAdd = canCopy && clipboardItems > 0
|
canAdd = canCopy && clipboardItems > 0
|
||||||
&& ((clipboardType == 'item') == isListView),
|
&& ((clipboardType == 'item') == isListView),
|
||||||
historyItems = pandora.history.items(),
|
historyItems = pandora.history.items(),
|
||||||
|
|
Loading…
Reference in a new issue