This commit is contained in:
rolux 2014-02-03 06:12:55 +00:00
parent e2a64fe0f1
commit 831d3a68f7

View file

@ -4,8 +4,10 @@
pandora.openDocumentDialog = function(options) { pandora.openDocumentDialog = function(options) {
if (pandora.$ui.documentDialog && options.ids && options.ids.length == 1 if (
&& Ox.getObjectById(pandora.$ui.documentDialog.getItems(), options.ids[0])){ pandora.$ui.documentDialog && options.ids && options.ids.length == 1
&& Ox.getObjectById(pandora.$ui.documentDialog.getItems(), options.ids[0])
) {
pandora.UI.set({document: options.ids[0]}); pandora.UI.set({document: options.ids[0]});
} else if (options.ids) { } else if (options.ids) {
pandora.api.findDocuments({ pandora.api.findDocuments({
@ -18,7 +20,8 @@ pandora.openDocumentDialog = function(options) {
range: [0, options.ids.length], range: [0, options.ids.length],
keys: ['description', 'dimensions', 'extension', 'id', 'name'] keys: ['description', 'dimensions', 'extension', 'id', 'name']
}, function(result) { }, function(result) {
var i = 0, documents = Ox.sort(result.data.items, function(item) { var i = 0,
documents = Ox.sort(result.data.items, function(item) {
return options.ids.indexOf(item.id); return options.ids.indexOf(item.id);
}).map(function(document) { }).map(function(document) {
return Ox.extend({index: i++}, document); return Ox.extend({index: i++}, document);
@ -200,6 +203,7 @@ pandora.ui.documentDialog = function(options) {
that.getItems = function() { that.getItems = function() {
return items; return items;
}; };
that.update = function(options) { that.update = function(options) {
items = options.items; items = options.items;
item = items[options.index]; item = items[options.index];