merge of '6e077ed907974bc4e78dbdf12a128ba170de5a38'
and 'a216f87669942e793f9124b63661a5ae82105c1d' Monotone-Parent: 6e077ed907974bc4e78dbdf12a128ba170de5a38 Monotone-Parent: a216f87669942e793f9124b63661a5ae82105c1d Monotone-Revision: bdc770e039bce1273bf76acc5e48dd7006974831 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2008-02-01T16:30:00 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
commit
480dc6ff86
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2008-02-01 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
|
* UI/MailerUI/UIxMailMainFrame.m ([UIxMailMainFrame
|
||||||
|
-quotaSupport]): new json string that lists the quota support
|
||||||
|
among the user's mail accounts.
|
||||||
|
|
||||||
|
* SoObjects/Mailer/SOGoMailAccount.m ([SOGoMailAccount
|
||||||
|
-supportsQuotas]): new method that returns whether the current
|
||||||
|
account server has support for quotas.
|
||||||
|
|
||||||
2008-01-29 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
2008-01-29 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
* SoObjects/SOGo/SOGoGCSFolder.m ([SOGoGCSFolder
|
* SoObjects/SOGo/SOGoGCSFolder.m ([SOGoGCSFolder
|
||||||
|
|
|
@ -48,6 +48,8 @@
|
||||||
SOGoTrashFolder *trashFolder;
|
SOGoTrashFolder *trashFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL) supportsQuotas;
|
||||||
|
|
||||||
/* folder pathes */
|
/* folder pathes */
|
||||||
|
|
||||||
- (NSArray *) allFolderPaths;
|
- (NSArray *) allFolderPaths;
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
#import <NGExtensions/NSObject+Logs.h>
|
#import <NGExtensions/NSObject+Logs.h>
|
||||||
#import <NGExtensions/NSNull+misc.h>
|
#import <NGExtensions/NSNull+misc.h>
|
||||||
#import <NGImap4/NGImap4Connection.h>
|
#import <NGImap4/NGImap4Connection.h>
|
||||||
|
#import <NGImap4/NGImap4Client.h>
|
||||||
|
#import <NGImap4/NGImap4Context.h>
|
||||||
|
|
||||||
#import <SoObjects/SOGo/NSArray+Utilities.h>
|
#import <SoObjects/SOGo/NSArray+Utilities.h>
|
||||||
#import <SoObjects/SOGo/SOGoUser.h>
|
#import <SoObjects/SOGo/SOGoUser.h>
|
||||||
|
@ -170,6 +172,15 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
|
||||||
return folders;
|
return folders;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL) supportsQuotas
|
||||||
|
{
|
||||||
|
NGImap4Client *imapClient;
|
||||||
|
|
||||||
|
imapClient = [[self imap4Connection] client];
|
||||||
|
|
||||||
|
return [[imapClient context] canQuota];
|
||||||
|
}
|
||||||
|
|
||||||
/* hierarchy */
|
/* hierarchy */
|
||||||
|
|
||||||
- (SOGoMailAccount *) mailAccountFolder
|
- (SOGoMailAccount *) mailAccountFolder
|
||||||
|
|
|
@ -41,6 +41,8 @@
|
||||||
|
|
||||||
@interface SOGoMailAccounts : SOGoFolder
|
@interface SOGoMailAccounts : SOGoFolder
|
||||||
|
|
||||||
|
- (NSArray *) toManyRelationshipKeys;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif /* __Mailer_SOGoMailAccounts_H__ */
|
#endif /* __Mailer_SOGoMailAccounts_H__ */
|
||||||
|
|
|
@ -76,6 +76,7 @@ static NSString *AgenorShareLoginMarker = @".-.";
|
||||||
}
|
}
|
||||||
|
|
||||||
ct = [[ctClass alloc] initWithName:_key inContainer:self];
|
ct = [[ctClass alloc] initWithName:_key inContainer:self];
|
||||||
|
|
||||||
return [ct autorelease];
|
return [ct autorelease];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import <Foundation/NSUserDefaults.h>
|
#import <Foundation/NSUserDefaults.h>
|
||||||
|
#import <Foundation/NSValue.h>
|
||||||
|
|
||||||
#import <NGObjWeb/WOContext.h>
|
#import <NGObjWeb/WOContext.h>
|
||||||
#import <NGObjWeb/WORequest.h>
|
#import <NGObjWeb/WORequest.h>
|
||||||
|
@ -28,6 +29,7 @@
|
||||||
#import <NGExtensions/NSString+misc.h>
|
#import <NGExtensions/NSString+misc.h>
|
||||||
|
|
||||||
#import <SoObjects/Mailer/SOGoMailObject.h>
|
#import <SoObjects/Mailer/SOGoMailObject.h>
|
||||||
|
#import <SoObjects/Mailer/SOGoMailAccount.h>
|
||||||
#import <SoObjects/Mailer/SOGoMailAccounts.h>
|
#import <SoObjects/Mailer/SOGoMailAccounts.h>
|
||||||
#import <SoObjects/SOGo/NSDictionary+URL.h>
|
#import <SoObjects/SOGo/NSDictionary+URL.h>
|
||||||
#import <SoObjects/SOGo/NSArray+Utilities.h>
|
#import <SoObjects/SOGo/NSArray+Utilities.h>
|
||||||
|
@ -71,6 +73,29 @@
|
||||||
return [accountNames jsonRepresentation];
|
return [accountNames jsonRepresentation];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString *) quotaSupport
|
||||||
|
{
|
||||||
|
NSEnumerator *accountNames;
|
||||||
|
NSMutableArray *quotas;
|
||||||
|
NSString *currentAccount;
|
||||||
|
SOGoMailAccounts *co;
|
||||||
|
BOOL supportsQuota;
|
||||||
|
|
||||||
|
co = [self clientObject];
|
||||||
|
accountNames = [[co toManyRelationshipKeys] objectEnumerator];
|
||||||
|
|
||||||
|
quotas = [NSMutableArray array];
|
||||||
|
while ((currentAccount = [accountNames nextObject]))
|
||||||
|
{
|
||||||
|
supportsQuota = [[co lookupName: currentAccount
|
||||||
|
inContext: context
|
||||||
|
acquire: NO] supportsQuotas];
|
||||||
|
[quotas addObject: [NSNumber numberWithInt: supportsQuota]];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [quotas jsonRepresentation];
|
||||||
|
}
|
||||||
|
|
||||||
- (NSString *) pageFormURL
|
- (NSString *) pageFormURL
|
||||||
{
|
{
|
||||||
NSString *u;
|
NSString *u;
|
||||||
|
@ -127,7 +152,9 @@
|
||||||
accounts = [[context activeUser] mailAccounts];
|
accounts = [[context activeUser] mailAccounts];
|
||||||
firstAccount = [[accounts objectsForKey: @"name"] objectAtIndex: 0];
|
firstAccount = [[accounts objectsForKey: @"name"] objectAtIndex: 0];
|
||||||
formValues = [[context request] formValues];
|
formValues = [[context request] formValues];
|
||||||
parameters = [formValues count] > 0 ? [formValues asURLParameters] : @"?mailto=";
|
parameters = ([formValues count] > 0
|
||||||
|
? [formValues asURLParameters]
|
||||||
|
: @"?mailto=");
|
||||||
newLocation = [NSString stringWithFormat: @"%@/%@/compose%@",
|
newLocation = [NSString stringWithFormat: @"%@/%@/compose%@",
|
||||||
[co baseURLInContext: context],
|
[co baseURLInContext: context],
|
||||||
firstAccount,
|
firstAccount,
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
const:jsFiles="dtree.js,MailerUI+dTree.js">
|
const:jsFiles="dtree.js,MailerUI+dTree.js">
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var textMailAccounts = '<var:string value="mailAccounts" const:escapeHTML="NO"/>';
|
var textMailAccounts = '<var:string value="mailAccounts" const:escapeHTML="NO"/>';
|
||||||
|
var textQuotaSupport = '<var:string value="quotaSupport" const:escapeHTML="NO"/>';
|
||||||
</script>
|
</script>
|
||||||
<div class="menu" id="accountIconMenu">
|
<div class="menu" id="accountIconMenu">
|
||||||
<ul>
|
<ul>
|
||||||
|
|
|
@ -2,12 +2,19 @@
|
||||||
var accounts = {};
|
var accounts = {};
|
||||||
var mailboxTree;
|
var mailboxTree;
|
||||||
var mailAccounts;
|
var mailAccounts;
|
||||||
|
var quotaSupport;
|
||||||
if (typeof textMailAccounts != 'undefined') {
|
if (typeof textMailAccounts != 'undefined') {
|
||||||
if (textMailAccounts.length > 0)
|
if (textMailAccounts.length > 0)
|
||||||
mailAccounts = textMailAccounts.evalJSON(true);
|
mailAccounts = textMailAccounts.evalJSON(true);
|
||||||
else
|
else
|
||||||
mailAccounts = new Array();
|
mailAccounts = new Array();
|
||||||
}
|
}
|
||||||
|
if (typeof textQuotaSupport != 'undefined') {
|
||||||
|
if (textQuotaSupport.length > 0)
|
||||||
|
quotaSupport = textQuotaSupport.evalJSON(true);
|
||||||
|
else
|
||||||
|
quotaSupport = new Array();
|
||||||
|
}
|
||||||
|
|
||||||
var Mailer = {
|
var Mailer = {
|
||||||
currentMailbox: null,
|
currentMailbox: null,
|
||||||
|
@ -179,7 +186,6 @@ function mailListMarkMessage(event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function mailListMarkMessageCallback(http) {
|
function mailListMarkMessageCallback(http) {
|
||||||
if (http.readyState == 4)
|
|
||||||
if (isHttpStatus204(http.status)) {
|
if (isHttpStatus204(http.status)) {
|
||||||
var data = http.callbackData;
|
var data = http.callbackData;
|
||||||
markMailInWindow(data["window"], data["msguid"], data["markread"]);
|
markMailInWindow(data["window"], data["msguid"], data["markread"]);
|
||||||
|
@ -235,7 +241,6 @@ function deleteSelectedMessages(sender) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteSelectedMessagesCallback(http) {
|
function deleteSelectedMessagesCallback(http) {
|
||||||
if (http.readyState == 4) {
|
|
||||||
if (isHttpStatus204(http.status)) {
|
if (isHttpStatus204(http.status)) {
|
||||||
var data = http.callbackData;
|
var data = http.callbackData;
|
||||||
deleteCachedMessage(data["messageId"]);
|
deleteCachedMessage(data["messageId"]);
|
||||||
|
@ -263,7 +268,6 @@ function deleteSelectedMessagesCallback(http) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
log ("deleteSelectedMessagesCallback: problem during ajax request " + http.status);
|
log ("deleteSelectedMessagesCallback: problem during ajax request " + http.status);
|
||||||
}
|
}
|
||||||
|
@ -487,9 +491,11 @@ function openMailbox(mailbox, reload, idx) {
|
||||||
= triggerAjaxRequest(url, messageListCallback,
|
= triggerAjaxRequest(url, messageListCallback,
|
||||||
currentMessage);
|
currentMessage);
|
||||||
|
|
||||||
|
var account = Mailer.currentMailbox.split("/")[1];
|
||||||
|
if (accounts[account].supportsQuotas) {
|
||||||
var quotasUrl = ApplicationBaseURL + mailbox + "/quotas";
|
var quotasUrl = ApplicationBaseURL + mailbox + "/quotas";
|
||||||
document.quotasAjaxRequest
|
triggerAjaxRequest(quotasUrl, quotasCallback);
|
||||||
= triggerAjaxRequest(quotasUrl, quotasCallback);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,8 +509,7 @@ function messageListCallback(http) {
|
||||||
var div = $('mailboxContent');
|
var div = $('mailboxContent');
|
||||||
var table = $('messageList');
|
var table = $('messageList');
|
||||||
|
|
||||||
if (http.readyState == 4
|
if (http.status == 200) {
|
||||||
&& http.status == 200) {
|
|
||||||
document.messageListAjaxRequest = null;
|
document.messageListAjaxRequest = null;
|
||||||
|
|
||||||
if (table) {
|
if (table) {
|
||||||
|
@ -571,8 +576,7 @@ function messageListCallback(http) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function quotasCallback(http) {
|
function quotasCallback(http) {
|
||||||
if (http.readyState == 4
|
if (http.status == 200) {
|
||||||
&& http.status == 200) {
|
|
||||||
var hasQuotas = false;
|
var hasQuotas = false;
|
||||||
|
|
||||||
if (http.responseText.length > 0) {
|
if (http.responseText.length > 0) {
|
||||||
|
@ -822,7 +826,6 @@ function onICalendarButtonClick(event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function ICalendarButtonCallback(http) {
|
function ICalendarButtonCallback(http) {
|
||||||
if (http.readyState == 4)
|
|
||||||
if (isHttpStatus204(http.status)) {
|
if (isHttpStatus204(http.status)) {
|
||||||
var oldMsg = http.callbackData;
|
var oldMsg = http.callbackData;
|
||||||
var msg = Mailer.currentMailbox + "/" + Mailer.currentMessages[Mailer.currentMailbox];
|
var msg = Mailer.currentMailbox + "/" + Mailer.currentMessages[Mailer.currentMailbox];
|
||||||
|
@ -831,10 +834,9 @@ function ICalendarButtonCallback(http) {
|
||||||
loadMessage(Mailer.currentMessages[Mailer.currentMailbox]);
|
loadMessage(Mailer.currentMessages[Mailer.currentMailbox]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
window.alert("received code: " + http.status);
|
window.alert("received code: " + http.status);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function resizeMailContent() {
|
function resizeMailContent() {
|
||||||
var headerTable = document.getElementsByClassName('mailer_fieldtable')[0];
|
var headerTable = document.getElementsByClassName('mailer_fieldtable')[0];
|
||||||
|
@ -878,8 +880,7 @@ function onImageClick(event) {
|
||||||
function messageCallback(http) {
|
function messageCallback(http) {
|
||||||
var div = $('messageContent');
|
var div = $('messageContent');
|
||||||
|
|
||||||
if (http.readyState == 4
|
if (http.status == 200) {
|
||||||
&& http.status == 200) {
|
|
||||||
document.messageAjaxRequest = null;
|
document.messageAjaxRequest = null;
|
||||||
div.update(http.responseText);
|
div.update(http.responseText);
|
||||||
configureLinksInMessage();
|
configureLinksInMessage();
|
||||||
|
@ -1161,7 +1162,8 @@ function configureMessageListBodyEvents(table) {
|
||||||
if ($(cell).hasClassName("tbtv_navcell")) {
|
if ($(cell).hasClassName("tbtv_navcell")) {
|
||||||
var anchors = $(cell).childNodesWithTag("a");
|
var anchors = $(cell).childNodesWithTag("a");
|
||||||
for (var i = 0; i < anchors.length; i++)
|
for (var i = 0; i < anchors.length; i++)
|
||||||
Event.observe(anchors[i], "click", openMailboxAtIndex.bindAsEventListener(anchors[i]));
|
Event.observe(anchors[i], "click",
|
||||||
|
openMailboxAtIndex.bindAsEventListener(anchors[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
rows = table.tBodies[0].rows;
|
rows = table.tBodies[0].rows;
|
||||||
|
@ -1418,8 +1420,7 @@ function updateMailboxMenus() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onLoadMailboxesCallback(http) {
|
function onLoadMailboxesCallback(http) {
|
||||||
if (http.readyState == 4
|
if (http.status == 200) {
|
||||||
&& http.status == 200) {
|
|
||||||
checkAjaxRequestsState();
|
checkAjaxRequestsState();
|
||||||
if (http.responseText.length > 0) {
|
if (http.responseText.length > 0) {
|
||||||
var newAccount = buildMailboxes(http.callbackData,
|
var newAccount = buildMailboxes(http.callbackData,
|
||||||
|
@ -1456,6 +1457,10 @@ function onLoadMailboxesCallback(http) {
|
||||||
|
|
||||||
function buildMailboxes(accountName, encoded) {
|
function buildMailboxes(accountName, encoded) {
|
||||||
var account = new Mailbox("account", accountName);
|
var account = new Mailbox("account", accountName);
|
||||||
|
|
||||||
|
var accountIndex = mailAccounts.indexOf(accountName);
|
||||||
|
account.supportsQuotas = (quotaSupport[accountIndex] != 0);
|
||||||
|
|
||||||
var data = encoded.evalJSON(true);
|
var data = encoded.evalJSON(true);
|
||||||
for (var i = 0; i < data.length; i++) {
|
for (var i = 0; i < data.length; i++) {
|
||||||
var currentNode = account;
|
var currentNode = account;
|
||||||
|
@ -1489,8 +1494,7 @@ function getFoldersState() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFoldersStateCallback(http) {
|
function getFoldersStateCallback(http) {
|
||||||
if (http.readyState == 4
|
if (http.status == 200) {
|
||||||
&& http.status == 200) {
|
|
||||||
if (http.responseText.length > 0) {
|
if (http.responseText.length > 0) {
|
||||||
// The response text is a JSOn representation
|
// The response text is a JSOn representation
|
||||||
// of the folders that were left opened.
|
// of the folders that were left opened.
|
||||||
|
@ -1501,9 +1505,9 @@ function getFoldersStateCallback(http) {
|
||||||
mailboxTree.o(i);
|
mailboxTree.o(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
mailboxTree.autoSync();
|
mailboxTree.autoSync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function saveFoldersState() {
|
function saveFoldersState() {
|
||||||
if (mailAccounts.length > 0) {
|
if (mailAccounts.length > 0) {
|
||||||
|
@ -1514,8 +1518,7 @@ function saveFoldersState() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveFoldersStateCallback(http) {
|
function saveFoldersStateCallback(http) {
|
||||||
if (http.readyState == 4
|
if (isHttpStatus204(http.status)) {
|
||||||
&& isHttpStatus204(http.status)) {
|
|
||||||
log ("folders state saved");
|
log ("folders state saved");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -322,7 +322,8 @@ function displayFreeBusyForNode(input) {
|
||||||
}
|
}
|
||||||
var sd = $('startTime_date').valueAsShortDateString();
|
var sd = $('startTime_date').valueAsShortDateString();
|
||||||
var ed = $('endTime_date').valueAsShortDateString();
|
var ed = $('endTime_date').valueAsShortDateString();
|
||||||
var urlstr = ( UserFolderURL + "../" + input.uid + "/freebusy.ifb/ajaxRead?"
|
var urlstr = ( UserFolderURL + "../" + input.uid
|
||||||
|
+ "/freebusy.ifb/ajaxRead?"
|
||||||
+ "sday=" + sd + "&eday=" + ed + "&additional=" +
|
+ "sday=" + sd + "&eday=" + ed + "&additional=" +
|
||||||
additionalDays );
|
additionalDays );
|
||||||
document.contactFreeBusyAjaxRequest
|
document.contactFreeBusyAjaxRequest
|
||||||
|
@ -601,7 +602,8 @@ function prepareAttendees() {
|
||||||
$(row).addClassName(attendeesEditor.states[i]);
|
$(row).addClassName(attendeesEditor.states[i]);
|
||||||
var input = $(row).down("input");
|
var input = $(row).down("input");
|
||||||
var value = "";
|
var value = "";
|
||||||
if (attendeesEditor.names[i].length > 0 && attendeesEditor.names[i] != attendeesEditor.emails[i])
|
if (attendeesEditor.names[i].length > 0
|
||||||
|
&& attendeesEditor.names[i] != attendeesEditor.emails[i])
|
||||||
value += attendeesEditor.names[i] + " ";
|
value += attendeesEditor.names[i] + " ";
|
||||||
value += "<" + attendeesEditor.emails[i] + ">";
|
value += "<" + attendeesEditor.emails[i] + ">";
|
||||||
input.value = value;
|
input.value = value;
|
||||||
|
|
|
@ -309,39 +309,47 @@ function appendDifferentiator(url) {
|
||||||
return url_nocache;
|
return url_nocache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onAjaxRequestStateChange(http) {
|
||||||
|
try {
|
||||||
|
if (http.readyState == 4
|
||||||
|
&& activeAjaxRequests > 0) {
|
||||||
|
if (!http.aborted)
|
||||||
|
http.callback(http);
|
||||||
|
activeAjaxRequests--;
|
||||||
|
checkAjaxRequestsState();
|
||||||
|
http.onreadystatechange = Prototype.emptyFunction;
|
||||||
|
http.callback = Prototype.emptyFunction;
|
||||||
|
http.callbackData = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
activeAjaxRequests--;
|
||||||
|
checkAjaxRequestsState();
|
||||||
|
http.onreadystatechange = Prototype.emptyFunction;
|
||||||
|
http.callback = Prototype.emptyFunction;
|
||||||
|
http.callbackData = null;
|
||||||
|
log("AJAX Request, Caught Exception: " + e.name);
|
||||||
|
log(e.message);
|
||||||
|
log(backtrace());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function triggerAjaxRequest(url, callback, userdata, content, headers) {
|
function triggerAjaxRequest(url, callback, userdata, content, headers) {
|
||||||
var http = createHTTPClient();
|
var http = createHTTPClient();
|
||||||
|
|
||||||
activeAjaxRequests += 1;
|
activeAjaxRequests++;
|
||||||
document.animTimer = setTimeout("checkAjaxRequestsState();", 50);
|
document.animTimer = setTimeout("checkAjaxRequestsState();", 250);
|
||||||
//url = appendDifferentiator(url);
|
//url = appendDifferentiator(url);
|
||||||
|
|
||||||
if (http) {
|
if (http) {
|
||||||
http.open("POST", url, true);
|
http.open("POST", url, true);
|
||||||
http.url = url;
|
http.url = url;
|
||||||
http.onreadystatechange
|
http.callback = callback;
|
||||||
= function() {
|
|
||||||
// log ("state changed (" + http.readyState + "): " + url);
|
|
||||||
try {
|
|
||||||
if (http.readyState == 4
|
|
||||||
&& activeAjaxRequests > 0) {
|
|
||||||
if (!http.aborted) {
|
|
||||||
if (userdata)
|
|
||||||
http.callbackData = userdata;
|
http.callbackData = userdata;
|
||||||
callback(http);
|
http.onreadystatechange = function() { onAjaxRequestStateChange(http) };
|
||||||
}
|
// = function() {
|
||||||
activeAjaxRequests -= 1;
|
// // log ("state changed (" + http.readyState + "): " + url);
|
||||||
checkAjaxRequestsState();
|
// };
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
activeAjaxRequests -= 1;
|
|
||||||
checkAjaxRequestsState();
|
|
||||||
log("AJAX Request, Caught Exception: " + e.name);
|
|
||||||
log(e.message);
|
|
||||||
log(backtrace());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var hasContentLength = false;
|
var hasContentLength = false;
|
||||||
if (headers) {
|
if (headers) {
|
||||||
for (var i in headers) {
|
for (var i in headers) {
|
||||||
|
@ -367,36 +375,31 @@ function triggerAjaxRequest(url, callback, userdata, content, headers) {
|
||||||
|
|
||||||
function startAnimation(parent, nextNode) {
|
function startAnimation(parent, nextNode) {
|
||||||
var anim = $("progressIndicator");
|
var anim = $("progressIndicator");
|
||||||
if (anim) return anim;
|
if (!anim) {
|
||||||
|
anim = createElement("img", "progressIndicator", null,
|
||||||
anim = document.createElement("img");
|
{src: ResourcesURL + "/busy.gif"});
|
||||||
anim = $(anim);
|
|
||||||
anim.id = "progressIndicator";
|
|
||||||
anim.src = ResourcesURL + "/busy.gif";
|
|
||||||
anim.setStyle({ visibility: "hidden" });
|
anim.setStyle({ visibility: "hidden" });
|
||||||
if (nextNode)
|
if (nextNode)
|
||||||
parent.insertBefore(anim, nextNode);
|
parent.insertBefore(anim, nextNode);
|
||||||
else
|
else
|
||||||
parent.appendChild(anim);
|
parent.appendChild(anim);
|
||||||
anim.setStyle({ visibility: "visible" });
|
anim.setStyle({ visibility: "visible" });
|
||||||
|
}
|
||||||
|
|
||||||
return anim;
|
return anim;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkAjaxRequestsState() {
|
function checkAjaxRequestsState() {
|
||||||
var toolbar = document.getElementById("toolbar");
|
var progressImage = $("progressIndicator");
|
||||||
if (toolbar) {
|
|
||||||
if (activeAjaxRequests > 0
|
if (activeAjaxRequests > 0
|
||||||
&& !document.busyAnim) {
|
&& !progressImage) {
|
||||||
document.busyAnim = startAnimation(toolbar);
|
var toolbar = $("toolbar");
|
||||||
}
|
if (toolbar)
|
||||||
else if (activeAjaxRequests == 0
|
startAnimation(toolbar);
|
||||||
&& document.busyAnim
|
|
||||||
&& document.busyAnim.parentNode) {
|
|
||||||
document.busyAnim.parentNode.removeChild(document.busyAnim);
|
|
||||||
document.busyAnim = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else if (!activeAjaxRequests
|
||||||
|
&& progressImage)
|
||||||
|
progressImage.parentNode.removeChild(progressImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isSafari3() {
|
function isSafari3() {
|
||||||
|
|
Loading…
Reference in a new issue