mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-06-23 19:04:18 +00:00
Monotone-Parent: 52439c7fd2ebfde87dfb2f89481c0d8425a07ca4
Monotone-Revision: 0821c01300e63c1e0fa4909e334a07e27cde4167 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-10-11T20:09:57 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
2010-10-11 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* UI/WebServerResources/generic.js: (triggerAjaxRequest): added an
|
||||
optional "attempt" argument that enables counting the number of
|
||||
invocations for an ajax request.
|
||||
(onCASRecoveryIFrameLoaded): don't repeat a failed request more
|
||||
than once.
|
||||
|
||||
* UI/WebServerResources/HTMLElement.js:
|
||||
(Element.getSelectedNodesId): if the element has not
|
||||
"selectedIds", set "selArray" to an empty array before checking
|
||||
|
||||
@@ -245,7 +245,7 @@ function createHTTPClient() {
|
||||
return new XMLHttpRequest();
|
||||
}
|
||||
|
||||
function createCASRecoveryIFrame(http) {
|
||||
function createCASRecoveryIFrame(request) {
|
||||
var urlstr = UserFolderURL;
|
||||
if (!urlstr.endsWith('/'))
|
||||
urlstr += '/';
|
||||
@@ -253,7 +253,7 @@ function createCASRecoveryIFrame(http) {
|
||||
|
||||
var newIFrame = createElement("iframe", null, "hidden",
|
||||
{ src: urlstr });
|
||||
newIFrame.request = http;
|
||||
newIFrame.request = request;
|
||||
newIFrame.observe("load", onCASRecoverIFrameLoaded);
|
||||
document.body.appendChild(newIFrame);
|
||||
}
|
||||
@@ -261,10 +261,13 @@ function createCASRecoveryIFrame(http) {
|
||||
function onCASRecoverIFrameLoaded(event) {
|
||||
if (this.request) {
|
||||
var request = this.request;
|
||||
triggerAjaxRequest(request.url,
|
||||
request.callback,
|
||||
request.callbackData,
|
||||
request.paramHeaders);
|
||||
if (request.attempt == 0) {
|
||||
triggerAjaxRequest(request.url,
|
||||
request.callback,
|
||||
request.callbackData,
|
||||
request.paramHeaders,
|
||||
1);
|
||||
}
|
||||
this.request = null;
|
||||
}
|
||||
this.parentNode.removeChild(this);
|
||||
@@ -323,7 +326,7 @@ function getContrastingTextColor(bgColor) {
|
||||
return ((brightness < 144) ? "white" : "black");
|
||||
}
|
||||
|
||||
function triggerAjaxRequest(url, callback, userdata, content, headers) {
|
||||
function triggerAjaxRequest(url, callback, userdata, content, headers, attempt) {
|
||||
var http = createHTTPClient();
|
||||
if (http) {
|
||||
activeAjaxRequests++;
|
||||
@@ -335,14 +338,16 @@ function triggerAjaxRequest(url, callback, userdata, content, headers) {
|
||||
http.callback = callback;
|
||||
http.callbackData = userdata;
|
||||
http.onreadystatechange = function() { onAjaxRequestStateChange(http); };
|
||||
|
||||
if (typeof(attempt) == "undefined") {
|
||||
attempt = 0;
|
||||
}
|
||||
http.attempt = attempt;
|
||||
// = function() {
|
||||
// // log ("state changed (" + http.readyState + "): " + url);
|
||||
// };
|
||||
var hasContentLength = false;
|
||||
if (headers) {
|
||||
for (var i in headers) {
|
||||
if (i.toLowerCase() == "content-length")
|
||||
hasContentLength = true;
|
||||
http.setRequestHeader(i, headers[i]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user