2014-05-17 11:45:57 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
oml.ui.deleteItemsDialog = function() {
|
|
|
|
|
|
|
|
var ui = oml.user.ui,
|
|
|
|
|
2016-01-16 07:19:08 +00:00
|
|
|
items = ui.listSelection.filter(function(id) {
|
|
|
|
return oml.$ui.list.value(id, 'mediastate') == 'available';
|
|
|
|
}),
|
2014-05-17 11:45:57 +00:00
|
|
|
itemsName = Ox._(items.length == 1 ? 'Item' : 'Items'),
|
|
|
|
theseItemsName = items.length == 1
|
|
|
|
? Ox._('this item')
|
|
|
|
: Ox._('these {0} items', [Ox.formatNumber(items.length)]),
|
|
|
|
|
|
|
|
that = oml.ui.confirmDialog({
|
|
|
|
buttons: [
|
|
|
|
Ox.Button({
|
2016-01-13 08:20:03 +00:00
|
|
|
style: 'squared',
|
2014-05-17 11:45:57 +00:00
|
|
|
title: Ox._('No, Keep {0}', [itemsName])
|
|
|
|
}),
|
|
|
|
Ox.Button({
|
2016-01-13 08:20:03 +00:00
|
|
|
style: 'squared',
|
2014-05-17 11:45:57 +00:00
|
|
|
title: Ox._('Yes, Delete {0}', [itemsName])
|
|
|
|
})
|
|
|
|
],
|
2016-01-07 05:13:42 +00:00
|
|
|
content: Ox._(
|
|
|
|
'Are you sure that you want to permanently delete {0}?',
|
|
|
|
[theseItemsName]
|
|
|
|
),
|
2014-05-17 11:45:57 +00:00
|
|
|
title: Ox._('Delete {0}', [itemsName])
|
|
|
|
}, function() {
|
|
|
|
oml.api.remove({
|
|
|
|
ids: items
|
|
|
|
}, function() {
|
2016-01-16 08:17:09 +00:00
|
|
|
Ox.Request.clearCache();
|
2016-01-12 08:52:20 +00:00
|
|
|
oml.reloadLists();
|
2016-01-16 08:17:09 +00:00
|
|
|
if (ui.item) {
|
|
|
|
oml.$ui.infoView.updateElement(ui.item);
|
|
|
|
}
|
2014-05-17 11:45:57 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
return that;
|
|
|
|
|
2014-05-19 01:36:37 +00:00
|
|
|
};
|