2013-03-24 09:43:24 +00:00
|
|
|
'use strict';
|
|
|
|
|
2014-01-02 10:11:27 +00:00
|
|
|
pandora.ui.deleteDocumentDialog = function(files, callback) {
|
2013-03-24 09:43:24 +00:00
|
|
|
|
2014-02-14 15:23:59 +00:00
|
|
|
var string = Ox._(files.length == 1 ? 'Document' : 'Documents'),
|
2023-07-08 14:00:11 +00:00
|
|
|
$content = Ox.Element().html(
|
|
|
|
files.length == 1
|
|
|
|
? Ox._('Are you sure you want to delete the document "{0}"?', [files[0].title + '.' + files[0].extension])
|
|
|
|
: Ox._('Are you sure you want to delete {0} documents?', [files.length])
|
|
|
|
).css({
|
|
|
|
overflow: 'hidden',
|
|
|
|
}),
|
2015-04-20 08:13:56 +00:00
|
|
|
|
2014-01-07 07:53:11 +00:00
|
|
|
that = pandora.ui.iconDialog({
|
2013-03-24 09:43:24 +00:00
|
|
|
buttons: [
|
|
|
|
Ox.Button({
|
|
|
|
id: 'keep',
|
2014-02-14 15:23:59 +00:00
|
|
|
title: Ox._('Keep {0}', [string])
|
2013-03-24 09:43:24 +00:00
|
|
|
}).bindEvent({
|
|
|
|
click: function() {
|
|
|
|
that.close();
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
Ox.Button({
|
|
|
|
id: 'delete',
|
2014-02-14 15:23:59 +00:00
|
|
|
title: Ox._('Delete {0}', [string])
|
2013-03-24 09:43:24 +00:00
|
|
|
}).bindEvent({
|
|
|
|
click: function() {
|
|
|
|
that.close();
|
2013-05-27 10:13:59 +00:00
|
|
|
pandora.api.removeDocument({
|
2014-01-16 02:57:15 +00:00
|
|
|
ids: files.map(function(file) {
|
|
|
|
return file.id;
|
|
|
|
})
|
2013-04-26 09:21:22 +00:00
|
|
|
}, callback);
|
2013-03-24 09:43:24 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
],
|
2023-07-08 14:00:11 +00:00
|
|
|
content: $content,
|
2013-03-24 09:43:24 +00:00
|
|
|
keys: {enter: 'delete', escape: 'keep'},
|
2014-01-07 07:53:11 +00:00
|
|
|
title: files.length == 1
|
2014-02-14 15:23:59 +00:00
|
|
|
? Ox._('Delete {0}', [string])
|
2014-01-07 07:53:11 +00:00
|
|
|
: Ox._('Delete {0} Documents', [files.length])
|
2013-03-24 09:43:24 +00:00
|
|
|
});
|
|
|
|
return that;
|
|
|
|
|
|
|
|
};
|
|
|
|
|