2011-11-05 17:04:10 +00:00
|
|
|
'use strict';
|
|
|
|
|
2011-11-11 18:20:01 +00:00
|
|
|
pandora.ui.deleteListDialog = function(list) {
|
2013-03-03 05:34:44 +00:00
|
|
|
|
2013-02-16 01:20:40 +00:00
|
|
|
var ui = pandora.user.ui,
|
2016-10-04 22:00:03 +00:00
|
|
|
folderItems = pandora.getFolderItems(ui.section),
|
2013-03-03 05:34:44 +00:00
|
|
|
folderItem = folderItems.slice(0, -1),
|
|
|
|
listData = pandora.getListData(list),
|
2011-09-29 17:25:04 +00:00
|
|
|
$folderList = pandora.$ui.folderList[listData.folder],
|
2013-03-03 05:34:44 +00:00
|
|
|
|
|
|
|
that = pandora.ui.iconDialog({
|
2011-09-29 17:25:04 +00:00
|
|
|
buttons: [
|
|
|
|
Ox.Button({
|
2011-11-06 15:12:46 +00:00
|
|
|
id: 'keep',
|
2014-02-14 15:23:59 +00:00
|
|
|
title: Ox._('Keep {0}', [Ox._(folderItem)])
|
2011-09-29 17:25:04 +00:00
|
|
|
}).bindEvent({
|
|
|
|
click: function() {
|
|
|
|
that.close();
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
Ox.Button({
|
|
|
|
id: 'delete',
|
2014-02-14 15:23:59 +00:00
|
|
|
title: Ox._('Delete {0}', [Ox._(folderItem)])
|
2011-09-29 17:25:04 +00:00
|
|
|
}).bindEvent({
|
|
|
|
click: function() {
|
|
|
|
that.close();
|
2013-02-16 01:20:40 +00:00
|
|
|
pandora.api['remove' + folderItem]({
|
2011-09-29 17:25:04 +00:00
|
|
|
id: listData.id
|
|
|
|
}, function(result) {
|
2013-02-16 01:20:40 +00:00
|
|
|
Ox.Request.clearCache('find' + folderItems);
|
2011-09-29 17:25:04 +00:00
|
|
|
Ox.Request.clearCache(listData.id);
|
|
|
|
$folderList
|
|
|
|
.options({selected: []})
|
|
|
|
.bindEventOnce({
|
|
|
|
load: function() {
|
2013-02-16 01:20:40 +00:00
|
|
|
if (ui.section == 'items') {
|
2015-04-20 08:13:56 +00:00
|
|
|
pandora.UI.set(
|
|
|
|
'lists.' + listData.id, null
|
|
|
|
);
|
2013-02-16 01:20:40 +00:00
|
|
|
pandora.UI.set({
|
|
|
|
find: pandora.site.user.ui.find
|
|
|
|
});
|
2016-10-04 22:00:03 +00:00
|
|
|
} else if (ui.section == 'documents') {
|
|
|
|
pandora.UI.set(
|
|
|
|
'collections.' + listData.id, null
|
|
|
|
);
|
|
|
|
pandora.UI.set({
|
|
|
|
findDocuments: pandora.site.user.ui.findDocuments
|
|
|
|
});
|
|
|
|
|
2013-02-16 01:20:40 +00:00
|
|
|
} else {
|
2015-04-20 08:13:56 +00:00
|
|
|
pandora.UI.set(
|
|
|
|
folderItem.toLowerCase(), ''
|
|
|
|
);
|
2013-02-16 01:20:40 +00:00
|
|
|
}
|
2011-09-29 17:25:04 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.reloadList();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
})
|
|
|
|
],
|
2015-04-20 08:13:56 +00:00
|
|
|
content: Ox._(
|
|
|
|
'Are you sure you want to delete the {0} "{1}"?',
|
|
|
|
[Ox._(folderItem.toLowerCase()), listData.name]
|
|
|
|
),
|
2013-08-08 13:04:51 +00:00
|
|
|
keys: {enter: 'delete', escape: 'keep'},
|
2014-02-14 15:23:59 +00:00
|
|
|
title: Ox._('Delete {0}', [Ox._(folderItem)])
|
2011-09-29 17:25:04 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
return that;
|
|
|
|
|
2013-03-03 05:34:44 +00:00
|
|
|
};
|