Use a POST to copy/move contacts

By submitting the ajax request as a post, we avoid reaching the web
server url length limit.
Fixes #1887
This commit is contained in:
Francis Lachapelle 2012-09-26 20:25:23 -04:00
parent d77f6be450
commit a51fb9e28b

View file

@ -257,14 +257,16 @@ function _onContactMenuAction(folderItem, action, refresh) {
}
}
var url = ApplicationBaseURL + selectedFolderId + "/" + action
+ "?folder=" + folderId + "&uid="
+ contactIds.join("&uid=");
var url = ApplicationBaseURL + selectedFolderId + "/" + action;
if (refresh)
triggerAjaxRequest(url, actionContactCallback, selectedFolderId);
triggerAjaxRequest(url, actionContactCallback, selectedFolderId,
('folder='+ folderId + '&uid=' + contactIds.join('&uid=')),
{ "Content-type": "application/x-www-form-urlencoded" });
else
triggerAjaxRequest(url, actionContactCallback);
triggerAjaxRequest(url, actionContactCallback, null,
('folder='+ folderId + '&uid=' + contactIds.join('&uid=')),
{ "Content-type": "application/x-www-form-urlencoded" });
}
}
@ -313,7 +315,7 @@ function actionContactCallback(http) {
if (parseInt(http.status) == 403)
showAlertDialog(_("You don't have the required privileges to perform the operation."));
else if (error)
showAlertDialog(labels[error]);
showAlertDialog(_(error));
refreshCurrentFolder();
}
}
@ -1579,11 +1581,11 @@ function dropSelectedContacts(action, toId) {
var fromId = $(selectedFolders[0]).id;
if ((!currentFolderIsRemote() || action != "move")
&& fromId.substring(1) != toId) {
var url = ApplicationBaseURL + fromId + "/" + action
+ "?folder=" + toId + "&uid="
+ contactIds.join("&uid=");
triggerAjaxRequest(url, actionContactCallback, fromId);
var url = ApplicationBaseURL + fromId + "/" + action;
triggerAjaxRequest(url, actionContactCallback, fromId,
('folder='+ toId + '&uid=' + contactIds.join('&uid=')),
{ "Content-type": "application/x-www-form-urlencoded" });
}
}
}