mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-06 05:48:50 +00:00
(fix) XSRF supprot for all contact operations
This commit is contained in:
@@ -632,6 +632,23 @@
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @function $exportCards
|
||||
* @memberof AddressBook.prototype
|
||||
* @desc Export the selected/all cards
|
||||
* @returns a promise of the HTTP operation
|
||||
*/
|
||||
AddressBook.prototype.exportCards = function(selectedOnly) {
|
||||
var selectedUIDs;
|
||||
|
||||
if (selectedOnly) {
|
||||
var selectedCards = _.filter(this.$cards, function(card) { return card.selected; });
|
||||
selectedUIDs = _.map(selectedCards, 'id');
|
||||
}
|
||||
|
||||
return AddressBook.$$resource.download(this.id, 'export', (angular.isDefined(selectedUIDs) ? {uids: selectedUIDs} : null), {type: 'application/octet-stream'});
|
||||
};
|
||||
|
||||
/**
|
||||
* @function $unwrap
|
||||
* @memberof AddressBook.prototype
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
vm.notSelectedComponent = notSelectedComponent;
|
||||
vm.unselectCards = unselectCards;
|
||||
vm.confirmDeleteSelectedCards = confirmDeleteSelectedCards;
|
||||
vm.saveSelectedCards = saveSelectedCards;
|
||||
vm.copySelectedCards = copySelectedCards;
|
||||
vm.selectAll = selectAll;
|
||||
vm.sort = sort;
|
||||
@@ -103,12 +102,6 @@
|
||||
});
|
||||
}
|
||||
|
||||
function saveSelectedCards() {
|
||||
var selectedCards = _.filter(vm.selectedFolder.$cards, function(card) { return card.selected; });
|
||||
var selectedUIDs = _.map(selectedCards, 'id');
|
||||
$window.location.href = ApplicationBaseURL + '/' + vm.selectedFolder.id + '/export?uid=' + selectedUIDs.join('&uid=');
|
||||
}
|
||||
|
||||
function copySelectedCards(folder) {
|
||||
var selectedCards = _.filter(vm.selectedFolder.$cards, function(card) { return card.selected; });
|
||||
vm.selectedFolder.$copyCards(selectedCards, folder).then(function() {
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
vm.save = save;
|
||||
vm.confirmDelete = confirmDelete;
|
||||
vm.importCards = importCards;
|
||||
vm.exportCards = exportCards;
|
||||
vm.showLinks = showLinks;
|
||||
vm.showProperties = showProperties;
|
||||
vm.share = share;
|
||||
@@ -203,10 +202,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
function exportCards() {
|
||||
$window.location.href = ApplicationBaseURL + '/' + vm.service.selectedFolder.id + '/exportFolder';
|
||||
}
|
||||
|
||||
function showLinks(addressbook) {
|
||||
$mdDialog.show({
|
||||
parent: angular.element(document.body),
|
||||
|
||||
@@ -202,6 +202,20 @@
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @function export
|
||||
* @memberof Card.prototype
|
||||
* @desc Download the current card
|
||||
* @returns a promise of the HTTP operation
|
||||
*/
|
||||
Card.prototype.export = function() {
|
||||
var selectedIDs;
|
||||
|
||||
selectedIDs = [ this.id ];
|
||||
|
||||
return Card.$$resource.download(this.pid, 'export', {uids: selectedIDs}, {type: 'application/octet-stream'});
|
||||
};
|
||||
|
||||
Card.prototype.$fullname = function() {
|
||||
var fn = this.c_cn || '', names;
|
||||
if (fn.length === 0) {
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
vm.reset = reset;
|
||||
vm.cancel = cancel;
|
||||
vm.confirmDelete = confirmDelete;
|
||||
vm.exportCard = exportCard;
|
||||
vm.toggleRawSource = toggleRawSource;
|
||||
vm.showRawSource = false;
|
||||
|
||||
@@ -133,10 +132,6 @@
|
||||
});
|
||||
}
|
||||
|
||||
function exportCard() {
|
||||
$window.location.href = ApplicationBaseURL + '/' + vm.currentFolder.id + '/export?uid=' + vm.card.id;
|
||||
}
|
||||
|
||||
function toggleRawSource($event) {
|
||||
if (!vm.showRawSource && !vm.rawSource) {
|
||||
Card.$$resource.post(vm.currentFolder.id + '/' + vm.card.id, "raw").then(function(data) {
|
||||
|
||||
Reference in New Issue
Block a user