From 0a46a1e727942d188b5a98c38b04f08a507d6b88 Mon Sep 17 00:00:00 2001 From: Babu Vincent Date: Tue, 4 Nov 2014 13:58:41 +0530 Subject: [PATCH] Delegating Calendar #38:managing server delay in respomnse --- chrome/content/delegateCalendar.js | 127 +++++++++++++++----------- chrome/content/delegateCalendar.xul | 2 +- components/erRemoveDelegateRequest.js | 6 +- 3 files changed, 78 insertions(+), 57 deletions(-) diff --git a/chrome/content/delegateCalendar.js b/chrome/content/delegateCalendar.js index 279cbda5..ddf67fb5 100644 --- a/chrome/content/delegateCalendar.js +++ b/chrome/content/delegateCalendar.js @@ -31,12 +31,14 @@ function exchDelegateCalendarSettings(aDocument, aWindow) .getService(Ci.mivFunctions); this.loadBalancer = Cc["@1st-setup.nl/exchange/loadbalancer;1"] .getService(Ci.mivExchangeLoadBalancer); - this.delegatesList=null; + this.delegatesList=[]; } exchDelegateCalendarSettings.prototype = { onLoad:function _onLoad() { - this._window.sizeToContent() ; + this.refresh(); + this.getDelegator(); + this._window.sizeToContent() ; }, getDetails : function _getDetails() { @@ -345,19 +347,13 @@ exchDelegateCalendarSettings.prototype = { }, refresh: function _refresh() { - this.getDelegate(); - var listBox = this._document.getElementById("delegatee"); - var myListBox = listId; - var countrow = myListBox.itemCount; - var countList=this.delegatesList; - if ( countList != countrow ) - { - this.delayRefresh(); - } + this.getDelegate(); + this.updateDelegateView(); }, delayRefresh: function _delayRefresh() { setTimeout( this.getDelegate(),5000); + setTimeout( this.updateDelegateView(),7000); }, listSelectEvent :function _listSelectEvent() { @@ -400,34 +396,64 @@ exchDelegateCalendarSettings.prototype = { erGetDelegateRequestOK : function _erGetDelegateRequestOK(aGetDelegateRequest, aResp) { - if ( aResp.length > 0 ) + if ( aResp.length > 0 ) + { + for( index=0;index 0 ) { - var listBox = this._document.getElementById("delegatee"); - for( index=0;index 0 ) @@ -649,12 +672,8 @@ exchDelegateCalendarSettings.prototype = { //dump("\n "+ index + " Resp 4: " + aResp[index].DelegatePermissions ); //dump("\n "+ index + " Resp 5: " + aResp[index].ReceiveCopiesOfMeetingMessages ); //dump("\n "+ index + " Resp 6: " + aResp[index].ViewPrivateItems ); - var row = this._document.createElement("listitem"); - var cell = this._document.createElement("listcell"); - cell.setAttribute("label", aResp[index].DisplayName+" ("+aResp[index].PrimarySmtpAddress+")"); - cell.setAttribute("value", aResp[index].PrimarySmtpAddress); - row.appendChild(cell); - listBox.appendChild(row); + this.removeDelegateCache(aResp[index].PrimarySmtpAddress); + this.addDelegateCache(aResp[index]); } } this.delayRefresh(); @@ -662,7 +681,7 @@ exchDelegateCalendarSettings.prototype = { erUpdateDelegateRequestError : function _erUpdateDelegateRequestError(aUpdateDelegateRequest, aCode, aMsg) { - this.globalFunctions.LOG( "erUpdateDelegateRequestError "+ aCode+":"+aMsg); + this._window.alert( "erUpdateDelegateRequestError "+ aCode+":"+aMsg); }, emptyRow :function emptyRow(listId,email) diff --git a/chrome/content/delegateCalendar.xul b/chrome/content/delegateCalendar.xul index 48e9d5b4..8a8c7803 100644 --- a/chrome/content/delegateCalendar.xul +++ b/chrome/content/delegateCalendar.xul @@ -19,7 +19,7 @@ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml" buttons="cancel" ondialogcancel="window.close();" - onload="tmpDelegateCalendarSettings.onLoad();tmpDelegateCalendarSettings.getDelegator();return tmpDelegateCalendarSettings.getDelegate()"> + onload="tmpDelegateCalendarSettings.onLoad();">