Small fixes

Release commit
This commit is contained in:
RainLoop Team 2014-10-05 22:37:31 +04:00
parent 78f09856e3
commit c26ab305a1
29 changed files with 385 additions and 371 deletions

View file

@ -10,7 +10,7 @@
Globals = require('Common/Globals'),
Utils = require('Common/Utils'),
LinkBuilder = require('Common/LinkBuilder'),
Links = require('Common/Links'),
Events = require('Common/Events'),
Settings = require('Storage/Settings'),
@ -132,10 +132,18 @@
AbstractApp.prototype.redirectToAdminPanel = function ()
{
_.delay(function () {
window.location.href = './?/Admin/';
window.location.href = Links.rootAdmin();
}, 100);
};
AbstractApp.prototype.clearClientSideToken = function ()
{
if (window.__rlah_clear)
{
window.__rlah_clear();
}
};
/**
* @param {boolean=} bLogout = false
* @param {boolean=} bClose = false
@ -151,6 +159,11 @@
bLogout = Utils.isUnd(bLogout) ? false : !!bLogout;
bClose = Utils.isUnd(bClose) ? false : !!bClose;
if (bLogout)
{
this.clearClientSideToken();
}
if (bLogout && bClose && window.close)
{
window.close();
@ -173,7 +186,7 @@
else
{
kn.routeOff();
kn.setHash(LinkBuilder.root(), true);
kn.setHash(Links.root(), true);
kn.routeOff();
_.delay(function () {

View file

@ -11,7 +11,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
LinkBuilder = require('Common/LinkBuilder'),
Links = require('Common/Links'),
Settings = require('Storage/Settings'),
Data = require('Storage/Admin/Data'),
@ -241,7 +241,7 @@
if (!Settings.settingsGet('AllowAdminPanel'))
{
kn.routeOff();
kn.setHash(LinkBuilder.root(), true);
kn.setHash(Links.root(), true);
kn.routeOff();
_.defer(function () {

View file

@ -15,7 +15,7 @@
Consts = require('Common/Consts'),
Plugins = require('Common/Plugins'),
Utils = require('Common/Utils'),
LinkBuilder = require('Common/LinkBuilder'),
Links = require('Common/Links'),
Events = require('Common/Events'),
kn = require('Knoin/Knoin'),
@ -746,17 +746,17 @@
AppApp.prototype.googleConnect = function ()
{
window.open(LinkBuilder.socialGoogle(), 'Google', 'left=200,top=100,width=650,height=600,menubar=no,status=no,resizable=yes,scrollbars=yes');
window.open(Links.socialGoogle(), 'Google', 'left=200,top=100,width=650,height=600,menubar=no,status=no,resizable=yes,scrollbars=yes');
};
AppApp.prototype.twitterConnect = function ()
{
window.open(LinkBuilder.socialTwitter(), 'Twitter', 'left=200,top=100,width=650,height=350,menubar=no,status=no,resizable=yes,scrollbars=yes');
window.open(Links.socialTwitter(), 'Twitter', 'left=200,top=100,width=650,height=350,menubar=no,status=no,resizable=yes,scrollbars=yes');
};
AppApp.prototype.facebookConnect = function ()
{
window.open(LinkBuilder.socialFacebook(), 'Facebook', 'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes');
window.open(Links.socialFacebook(), 'Facebook', 'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes');
};
/**
@ -1232,7 +1232,7 @@
else
{
kn.routeOff();
kn.setHash(LinkBuilder.root(), true);
kn.setHash(Links.root(), true);
kn.routeOff();
_.defer(function () {
@ -1299,7 +1299,7 @@
{
if ($LAB && window.crypto && window.crypto.getRandomValues && Settings.capa(Enums.Capa.OpenPGP))
{
$LAB.script(window.openpgp ? '' : LinkBuilder.openPgpJs()).wait(function () {
$LAB.script(window.openpgp ? '' : Links.openPgpJs()).wait(function () {
if (window.openpgp)
{
Data.openpgp = window.openpgp;

View file

@ -10,7 +10,7 @@
/**
* @constructor
*/
function LinkBuilder()
function Links()
{
var Settings = require('Storage/Settings');
@ -25,16 +25,24 @@
/**
* @return {string}
*/
LinkBuilder.prototype.root = function ()
Links.prototype.root = function ()
{
return this.sBase;
};
/**
* @return {string}
*/
Links.prototype.rootAdmin = function ()
{
return this.sServer + '/Admin/';
};
/**
* @param {string} sDownload
* @return {string}
*/
LinkBuilder.prototype.attachmentDownload = function (sDownload)
Links.prototype.attachmentDownload = function (sDownload)
{
return this.sServer + '/Raw/' + this.sSubQuery + this.sSpecSuffix + '/Download/' + sDownload;
};
@ -43,7 +51,7 @@
* @param {string} sDownload
* @return {string}
*/
LinkBuilder.prototype.attachmentPreview = function (sDownload)
Links.prototype.attachmentPreview = function (sDownload)
{
return this.sServer + '/Raw/' + this.sSubQuery + this.sSpecSuffix + '/View/' + sDownload;
};
@ -52,7 +60,7 @@
* @param {string} sDownload
* @return {string}
*/
LinkBuilder.prototype.attachmentPreviewAsPlain = function (sDownload)
Links.prototype.attachmentPreviewAsPlain = function (sDownload)
{
return this.sServer + '/Raw/' + this.sSubQuery + this.sSpecSuffix + '/ViewAsPlain/' + sDownload;
};
@ -60,49 +68,49 @@
/**
* @return {string}
*/
LinkBuilder.prototype.upload = function ()
Links.prototype.upload = function ()
{
return this.sServer + '/Upload/' + this.sSpecSuffix + '/';
return this.sServer + '/Upload/' + this.sSubQuery + this.sSpecSuffix + '/';
};
/**
* @return {string}
*/
LinkBuilder.prototype.uploadContacts = function ()
Links.prototype.uploadContacts = function ()
{
return this.sServer + '/UploadContacts/' + this.sSpecSuffix + '/';
return this.sServer + '/UploadContacts/' + this.sSubQuery + this.sSpecSuffix + '/';
};
/**
* @return {string}
*/
LinkBuilder.prototype.uploadBackground = function ()
Links.prototype.uploadBackground = function ()
{
return this.sServer + '/UploadBackground/' + this.sSpecSuffix + '/';
return this.sServer + '/UploadBackground/' + this.sSubQuery + this.sSpecSuffix + '/';
};
/**
* @return {string}
*/
LinkBuilder.prototype.append = function ()
Links.prototype.append = function ()
{
return this.sServer + '/Append/' + this.sSpecSuffix + '/';
return this.sServer + '/Append/' + this.sSubQuery + this.sSpecSuffix + '/';
};
/**
* @param {string} sEmail
* @return {string}
*/
LinkBuilder.prototype.change = function (sEmail)
Links.prototype.change = function (sEmail)
{
return this.sServer + '/Change/' + this.sSpecSuffix + '/' + Utils.encodeURIComponent(sEmail) + '/';
return this.sServer + '/Change/' + this.sSubQuery + this.sSpecSuffix + '/' + Utils.encodeURIComponent(sEmail) + '/';
};
/**
* @param {string=} sAdd
* @return {string}
*/
LinkBuilder.prototype.ajax = function (sAdd)
Links.prototype.ajax = function (sAdd)
{
return this.sServer + '/Ajax/' + this.sSubQuery + this.sSpecSuffix + '/' + sAdd;
};
@ -111,7 +119,7 @@
* @param {string} sRequestHash
* @return {string}
*/
LinkBuilder.prototype.messageViewLink = function (sRequestHash)
Links.prototype.messageViewLink = function (sRequestHash)
{
return this.sServer + '/Raw/' + this.sSubQuery + this.sSpecSuffix + '/ViewAsPlain/' + sRequestHash;
};
@ -120,7 +128,7 @@
* @param {string} sRequestHash
* @return {string}
*/
LinkBuilder.prototype.messageDownloadLink = function (sRequestHash)
Links.prototype.messageDownloadLink = function (sRequestHash)
{
return this.sServer + '/Raw/' + this.sSubQuery + this.sSpecSuffix + '/Download/' + sRequestHash;
};
@ -129,7 +137,7 @@
* @param {string} sEmail
* @return {string}
*/
LinkBuilder.prototype.avatarLink = function (sEmail)
Links.prototype.avatarLink = function (sEmail)
{
return this.sServer + '/Raw/0/Avatar/' + Utils.encodeURIComponent(sEmail) + '/';
};
@ -137,7 +145,7 @@
/**
* @return {string}
*/
LinkBuilder.prototype.inbox = function ()
Links.prototype.inbox = function ()
{
return this.sBase + 'mailbox/Inbox';
};
@ -145,7 +153,7 @@
/**
* @return {string}
*/
LinkBuilder.prototype.messagePreview = function ()
Links.prototype.messagePreview = function ()
{
return this.sBase + 'mailbox/message-preview';
};
@ -154,7 +162,7 @@
* @param {string=} sScreenName
* @return {string}
*/
LinkBuilder.prototype.settings = function (sScreenName)
Links.prototype.settings = function (sScreenName)
{
var sResult = this.sBase + 'settings';
if (!Utils.isUnd(sScreenName) && '' !== sScreenName)
@ -168,7 +176,7 @@
/**
* @return {string}
*/
LinkBuilder.prototype.about = function ()
Links.prototype.about = function ()
{
return this.sBase + 'about';
};
@ -177,7 +185,7 @@
* @param {string} sScreenName
* @return {string}
*/
LinkBuilder.prototype.admin = function (sScreenName)
Links.prototype.admin = function (sScreenName)
{
var sResult = this.sBase;
switch (sScreenName) {
@ -201,7 +209,7 @@
* @param {string=} sSearch = ''
* @return {string}
*/
LinkBuilder.prototype.mailBox = function (sFolder, iPage, sSearch)
Links.prototype.mailBox = function (sFolder, iPage, sSearch)
{
iPage = Utils.isNormal(iPage) ? Utils.pInt(iPage) : 1;
sSearch = Utils.pString(sSearch);
@ -228,7 +236,7 @@
/**
* @return {string}
*/
LinkBuilder.prototype.phpInfo = function ()
Links.prototype.phpInfo = function ()
{
return this.sServer + 'Info';
};
@ -237,7 +245,7 @@
* @param {string} sLang
* @return {string}
*/
LinkBuilder.prototype.langLink = function (sLang)
Links.prototype.langLink = function (sLang)
{
return this.sServer + '/Lang/0/' + encodeURI(sLang) + '/' + this.sVersion + '/';
};
@ -245,23 +253,23 @@
/**
* @return {string}
*/
LinkBuilder.prototype.exportContactsVcf = function ()
Links.prototype.exportContactsVcf = function ()
{
return this.sServer + '/Raw/' + this.sSpecSuffix + '/ContactsVcf/';
return this.sServer + '/Raw/' + this.sSubQuery + this.sSpecSuffix + '/ContactsVcf/';
};
/**
* @return {string}
*/
LinkBuilder.prototype.exportContactsCsv = function ()
Links.prototype.exportContactsCsv = function ()
{
return this.sServer + '/Raw/' + this.sSpecSuffix + '/ContactsCsv/';
return this.sServer + '/Raw/' + this.sSubQuery + this.sSpecSuffix + '/ContactsCsv/';
};
/**
* @return {string}
*/
LinkBuilder.prototype.emptyContactPic = function ()
Links.prototype.emptyContactPic = function ()
{
return this.sStaticPrefix + 'css/images/empty-contact.png';
};
@ -270,7 +278,7 @@
* @param {string} sFileName
* @return {string}
*/
LinkBuilder.prototype.sound = function (sFileName)
Links.prototype.sound = function (sFileName)
{
return this.sStaticPrefix + 'sounds/' + sFileName;
};
@ -279,7 +287,7 @@
* @param {string} sTheme
* @return {string}
*/
LinkBuilder.prototype.themePreviewLink = function (sTheme)
Links.prototype.themePreviewLink = function (sTheme)
{
var sPrefix = 'rainloop/v/' + this.sVersion + '/';
if ('@custom' === sTheme.substr(-7))
@ -294,7 +302,7 @@
/**
* @return {string}
*/
LinkBuilder.prototype.notificationMailIcon = function ()
Links.prototype.notificationMailIcon = function ()
{
return this.sStaticPrefix + 'css/images/icom-message-notification.png';
};
@ -302,7 +310,7 @@
/**
* @return {string}
*/
LinkBuilder.prototype.openPgpJs = function ()
Links.prototype.openPgpJs = function ()
{
return this.sStaticPrefix + 'js/min/openpgp.js';
};
@ -310,27 +318,27 @@
/**
* @return {string}
*/
LinkBuilder.prototype.socialGoogle = function ()
Links.prototype.socialGoogle = function ()
{
return this.sServer + 'SocialGoogle' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
return this.sServer + 'SocialGoogle' + ('' !== this.sSpecSuffix ? '/' + this.sSubQuery + this.sSpecSuffix + '/' : '');
};
/**
* @return {string}
*/
LinkBuilder.prototype.socialTwitter = function ()
Links.prototype.socialTwitter = function ()
{
return this.sServer + 'SocialTwitter' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
return this.sServer + 'SocialTwitter' + ('' !== this.sSpecSuffix ? '/' + this.sSubQuery + this.sSpecSuffix + '/' : '');
};
/**
* @return {string}
*/
LinkBuilder.prototype.socialFacebook = function ()
Links.prototype.socialFacebook = function ()
{
return this.sServer + 'SocialFacebook' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
return this.sServer + 'SocialFacebook' + ('' !== this.sSpecSuffix ? '/' + this.sSubQuery + this.sSpecSuffix + '/' : '');
};
module.exports = new LinkBuilder();
module.exports = new Links();
}());

View file

@ -1935,7 +1935,7 @@
{
var iStart = Utils.microtime();
$.ajax({
'url': require('Common/LinkBuilder').langLink(sLanguage),
'url': require('Common/Links').langLink(sLanguage),
'dataType': 'script',
'cache': true
})

View file

@ -40,7 +40,7 @@
*/
AccountModel.prototype.changeAccountLink = function ()
{
return require('Common/LinkBuilder').change(this.email);
return require('Common/Links').change(this.email);
};
module.exports = AccountModel;

View file

@ -9,7 +9,7 @@
Globals = require('Common/Globals'),
Utils = require('Common/Utils'),
LinkBuilder = require('Common/LinkBuilder'),
Links = require('Common/Links'),
AbstractModel = require('Knoin/AbstractModel')
;
@ -125,7 +125,7 @@
*/
AttachmentModel.prototype.linkDownload = function ()
{
return LinkBuilder.attachmentDownload(this.download);
return Links.attachmentDownload(this.download);
};
/**
@ -133,7 +133,7 @@
*/
AttachmentModel.prototype.linkPreview = function ()
{
return LinkBuilder.attachmentPreview(this.download);
return Links.attachmentPreview(this.download);
};
/**
@ -141,7 +141,7 @@
*/
AttachmentModel.prototype.linkPreviewAsPlain = function ()
{
return LinkBuilder.attachmentPreviewAsPlain(this.download);
return Links.attachmentPreviewAsPlain(this.download);
};
/**

View file

@ -9,7 +9,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
LinkBuilder = require('Common/LinkBuilder'),
Links = require('Common/Links'),
AbstractModel = require('Knoin/AbstractModel')
;
@ -98,7 +98,7 @@
*/
ContactModel.prototype.srcAttr = function ()
{
return LinkBuilder.emptyContactPic();
return Links.emptyContactPic();
};
/**

View file

@ -13,7 +13,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Globals = require('Common/Globals'),
LinkBuilder = require('Common/LinkBuilder'),
Links = require('Common/Links'),
EmailModel = require('Model/Email'),
AttachmentModel = require('Model/Attachment'),
@ -747,7 +747,7 @@
*/
MessageModel.prototype.viewLink = function ()
{
return LinkBuilder.messageViewLink(this.requestHash);
return Links.messageViewLink(this.requestHash);
};
/**
@ -755,7 +755,7 @@
*/
MessageModel.prototype.downloadLink = function ()
{
return LinkBuilder.messageDownloadLink(this.requestHash);
return Links.messageDownloadLink(this.requestHash);
};
/**

View file

@ -10,7 +10,7 @@
Globals = require('Common/Globals'),
Utils = require('Common/Utils'),
LinkBuilder = require('Common/LinkBuilder'),
Links = require('Common/Links'),
kn = require('Knoin/Knoin'),
AbstractScreen = require('Knoin/AbstractScreen')
@ -149,7 +149,7 @@
}
else
{
kn.setHash(LinkBuilder.settings(), false, true);
kn.setHash(Links.settings(), false, true);
}
};

View file

@ -9,7 +9,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
LinkBuilder = require('Common/LinkBuilder'),
Links = require('Common/Links'),
Settings = require('Storage/Settings'),
Data = require('Storage/Admin/Data')
@ -137,7 +137,7 @@
*/
GeneralAdminSetting.prototype.phpInfoLink = function ()
{
return LinkBuilder.phpInfo();
return Links.phpInfo();
};
module.exports = GeneralAdminSetting;

View file

@ -9,7 +9,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
LinkBuilder = require('Common/LinkBuilder'),
Links = require('Common/Links'),
Settings = require('Storage/Settings'),
Data = require('Storage/Admin/Data'),
@ -128,7 +128,7 @@
*/
SecurityAdminSetting.prototype.phpInfoLink = function ()
{
return LinkBuilder.phpInfo();
return Links.phpInfo();
};
module.exports = SecurityAdminSetting;

View file

@ -10,7 +10,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
LinkBuilder = require('Common/LinkBuilder'),
Links = require('Common/Links'),
Data = require('Storage/App/Data'),
Remote = require('Storage/App/Remote')
@ -77,7 +77,7 @@
oData.Result && oData.Reload)
{
kn.routeOff();
kn.setHash(LinkBuilder.root(), true);
kn.setHash(Links.root(), true);
kn.routeOff();
_.defer(function () {

View file

@ -11,7 +11,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
LinkBuilder = require('Common/LinkBuilder'),
Links = require('Common/Links'),
Data = require('Storage/App/Data'),
Remote = require('Storage/App/Remote')
@ -122,7 +122,7 @@
'name': sTheme,
'nameDisplay': Utils.convertThemeName(sTheme),
'selected': ko.observable(sTheme === sCurrentTheme),
'themePreviewSrc': LinkBuilder.themePreviewLink(sTheme)
'themePreviewSrc': Links.themePreviewLink(sTheme)
};
}));
};

View file

@ -14,7 +14,7 @@
Globals = require('Common/Globals'),
Utils = require('Common/Utils'),
Plugins = require('Common/Plugins'),
LinkBuilder = require('Common/LinkBuilder'),
Links = require('Common/Links'),
Settings = require('Storage/Settings')
;
@ -22,290 +22,290 @@
/**
* @constructor
*/
function AbstractRemoteStorage()
{
this.oRequests = {};
}
function AbstractRemoteStorage()
{
this.oRequests = {};
}
AbstractRemoteStorage.prototype.oRequests = {};
AbstractRemoteStorage.prototype.oRequests = {};
/**
* @param {?Function} fCallback
* @param {string} sRequestAction
* @param {string} sType
* @param {?AjaxJsonDefaultResponse} oData
* @param {boolean} bCached
* @param {*=} oRequestParameters
*/
AbstractRemoteStorage.prototype.defaultResponse = function (fCallback, sRequestAction, sType, oData, bCached, oRequestParameters)
{
var
fCall = function () {
if (Enums.StorageResultType.Success !== sType && Globals.bUnload)
{
sType = Enums.StorageResultType.Unload;
}
/**
* @param {?Function} fCallback
* @param {string} sRequestAction
* @param {string} sType
* @param {?AjaxJsonDefaultResponse} oData
* @param {boolean} bCached
* @param {*=} oRequestParameters
*/
AbstractRemoteStorage.prototype.defaultResponse = function (fCallback, sRequestAction, sType, oData, bCached, oRequestParameters)
{
var
fCall = function () {
if (Enums.StorageResultType.Success !== sType && Globals.bUnload)
{
sType = Enums.StorageResultType.Unload;
}
if (Enums.StorageResultType.Success === sType && oData && !oData.Result)
{
if (oData && -1 < Utils.inArray(oData.ErrorCode, [
Enums.Notification.AuthError, Enums.Notification.AccessError,
Enums.Notification.ConnectionError, Enums.Notification.DomainNotAllowed, Enums.Notification.AccountNotAllowed,
Enums.Notification.MailServerError, Enums.Notification.UnknownNotification, Enums.Notification.UnknownError
]))
{
Globals.iAjaxErrorCount++;
}
if (Enums.StorageResultType.Success === sType && oData && !oData.Result)
{
if (oData && -1 < Utils.inArray(oData.ErrorCode, [
Enums.Notification.AuthError, Enums.Notification.AccessError,
Enums.Notification.ConnectionError, Enums.Notification.DomainNotAllowed, Enums.Notification.AccountNotAllowed,
Enums.Notification.MailServerError, Enums.Notification.UnknownNotification, Enums.Notification.UnknownError
]))
{
Globals.iAjaxErrorCount++;
}
if (oData && Enums.Notification.InvalidToken === oData.ErrorCode)
{
Globals.iTokenErrorCount++;
}
if (oData && Enums.Notification.InvalidToken === oData.ErrorCode)
{
Globals.iTokenErrorCount++;
}
if (Consts.Values.TokenErrorLimit < Globals.iTokenErrorCount)
{
if (Globals.__APP__)
{
Globals.__APP__.loginAndLogoutReload(true);
}
}
if (Consts.Values.TokenErrorLimit < Globals.iTokenErrorCount)
{
if (Globals.__APP__)
{
Globals.__APP__.loginAndLogoutReload(true);
}
}
if (oData.ClearAuth || oData.Logout || Consts.Values.AjaxErrorLimit < Globals.iAjaxErrorCount)
{
if (window.__rlah_clear)
{
window.__rlah_clear();
}
if (oData.ClearAuth || oData.Logout || Consts.Values.AjaxErrorLimit < Globals.iAjaxErrorCount)
{
if (Globals.__APP__)
{
Globals.__APP__.clearClientSideToken();
if (!oData.ClearAuth && Globals.__APP__)
{
Globals.__APP__.loginAndLogoutReload(true);
}
}
}
else if (Enums.StorageResultType.Success === sType && oData && oData.Result)
{
Globals.iAjaxErrorCount = 0;
Globals.iTokenErrorCount = 0;
}
if (!oData.ClearAuth)
{
Globals.__APP__.loginAndLogoutReload(true);
}
}
}
}
else if (Enums.StorageResultType.Success === sType && oData && oData.Result)
{
Globals.iAjaxErrorCount = 0;
Globals.iTokenErrorCount = 0;
}
if (fCallback)
{
Plugins.runHook('ajax-default-response', [sRequestAction, Enums.StorageResultType.Success === sType ? oData : null, sType, bCached, oRequestParameters]);
if (fCallback)
{
Plugins.runHook('ajax-default-response', [sRequestAction, Enums.StorageResultType.Success === sType ? oData : null, sType, bCached, oRequestParameters]);
fCallback(
sType,
Enums.StorageResultType.Success === sType ? oData : null,
bCached,
sRequestAction,
oRequestParameters
);
}
}
;
fCallback(
sType,
Enums.StorageResultType.Success === sType ? oData : null,
bCached,
sRequestAction,
oRequestParameters
);
}
}
;
switch (sType)
{
case 'success':
sType = Enums.StorageResultType.Success;
break;
case 'abort':
sType = Enums.StorageResultType.Abort;
break;
default:
sType = Enums.StorageResultType.Error;
break;
}
switch (sType)
{
case 'success':
sType = Enums.StorageResultType.Success;
break;
case 'abort':
sType = Enums.StorageResultType.Abort;
break;
default:
sType = Enums.StorageResultType.Error;
break;
}
if (Enums.StorageResultType.Error === sType)
{
_.delay(fCall, 300);
}
else
{
fCall();
}
};
if (Enums.StorageResultType.Error === sType)
{
_.delay(fCall, 300);
}
else
{
fCall();
}
};
/**
* @param {?Function} fResultCallback
* @param {Object} oParameters
* @param {?number=} iTimeOut = 20000
* @param {string=} sGetAdd = ''
* @param {Array=} aAbortActions = []
* @return {jQuery.jqXHR}
*/
AbstractRemoteStorage.prototype.ajaxRequest = function (fResultCallback, oParameters, iTimeOut, sGetAdd, aAbortActions)
{
var
self = this,
bPost = '' === sGetAdd,
oHeaders = {},
iStart = (new window.Date()).getTime(),
oDefAjax = null,
sAction = ''
;
/**
* @param {?Function} fResultCallback
* @param {Object} oParameters
* @param {?number=} iTimeOut = 20000
* @param {string=} sGetAdd = ''
* @param {Array=} aAbortActions = []
* @return {jQuery.jqXHR}
*/
AbstractRemoteStorage.prototype.ajaxRequest = function (fResultCallback, oParameters, iTimeOut, sGetAdd, aAbortActions)
{
var
self = this,
bPost = '' === sGetAdd,
oHeaders = {},
iStart = (new window.Date()).getTime(),
oDefAjax = null,
sAction = ''
;
oParameters = oParameters || {};
iTimeOut = Utils.isNormal(iTimeOut) ? iTimeOut : 20000;
sGetAdd = Utils.isUnd(sGetAdd) ? '' : Utils.pString(sGetAdd);
aAbortActions = Utils.isArray(aAbortActions) ? aAbortActions : [];
oParameters = oParameters || {};
iTimeOut = Utils.isNormal(iTimeOut) ? iTimeOut : 20000;
sGetAdd = Utils.isUnd(sGetAdd) ? '' : Utils.pString(sGetAdd);
aAbortActions = Utils.isArray(aAbortActions) ? aAbortActions : [];
sAction = oParameters.Action || '';
sAction = oParameters.Action || '';
if (sAction && 0 < aAbortActions.length)
{
_.each(aAbortActions, function (sActionToAbort) {
if (self.oRequests[sActionToAbort])
{
self.oRequests[sActionToAbort].__aborted = true;
if (self.oRequests[sActionToAbort].abort)
{
self.oRequests[sActionToAbort].abort();
}
self.oRequests[sActionToAbort] = null;
}
});
}
if (sAction && 0 < aAbortActions.length)
{
_.each(aAbortActions, function (sActionToAbort) {
if (self.oRequests[sActionToAbort])
{
self.oRequests[sActionToAbort].__aborted = true;
if (self.oRequests[sActionToAbort].abort)
{
self.oRequests[sActionToAbort].abort();
}
self.oRequests[sActionToAbort] = null;
}
});
}
if (bPost)
{
oParameters['XToken'] = Settings.settingsGet('Token');
}
if (bPost)
{
oParameters['XToken'] = Settings.settingsGet('Token');
}
oDefAjax = $.ajax({
'type': bPost ? 'POST' : 'GET',
'url': LinkBuilder.ajax(sGetAdd),
'async': true,
'dataType': 'json',
'data': bPost ? oParameters : {},
'headers': oHeaders,
'timeout': iTimeOut,
'global': true
});
oDefAjax = $.ajax({
'type': bPost ? 'POST' : 'GET',
'url': Links.ajax(sGetAdd),
'async': true,
'dataType': 'json',
'data': bPost ? oParameters : {},
'headers': oHeaders,
'timeout': iTimeOut,
'global': true
});
oDefAjax.always(function (oData, sType) {
oDefAjax.always(function (oData, sType) {
var bCached = false;
if (oData && oData['Time'])
{
bCached = Utils.pInt(oData['Time']) > (new window.Date()).getTime() - iStart;
}
var bCached = false;
if (oData && oData['Time'])
{
bCached = Utils.pInt(oData['Time']) > (new window.Date()).getTime() - iStart;
}
if (sAction && self.oRequests[sAction])
{
if (self.oRequests[sAction].__aborted)
{
sType = 'abort';
}
if (sAction && self.oRequests[sAction])
{
if (self.oRequests[sAction].__aborted)
{
sType = 'abort';
}
self.oRequests[sAction] = null;
}
self.oRequests[sAction] = null;
}
self.defaultResponse(fResultCallback, sAction, sType, oData, bCached, oParameters);
});
self.defaultResponse(fResultCallback, sAction, sType, oData, bCached, oParameters);
});
if (sAction && 0 < aAbortActions.length && -1 < Utils.inArray(sAction, aAbortActions))
{
if (this.oRequests[sAction])
{
this.oRequests[sAction].__aborted = true;
if (this.oRequests[sAction].abort)
{
this.oRequests[sAction].abort();
}
this.oRequests[sAction] = null;
}
if (sAction && 0 < aAbortActions.length && -1 < Utils.inArray(sAction, aAbortActions))
{
if (this.oRequests[sAction])
{
this.oRequests[sAction].__aborted = true;
if (this.oRequests[sAction].abort)
{
this.oRequests[sAction].abort();
}
this.oRequests[sAction] = null;
}
this.oRequests[sAction] = oDefAjax;
}
this.oRequests[sAction] = oDefAjax;
}
return oDefAjax;
};
return oDefAjax;
};
/**
* @param {?Function} fCallback
* @param {string} sAction
* @param {Object=} oParameters
* @param {?number=} iTimeout
* @param {string=} sGetAdd = ''
* @param {Array=} aAbortActions = []
*/
AbstractRemoteStorage.prototype.defaultRequest = function (fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions)
{
oParameters = oParameters || {};
oParameters.Action = sAction;
/**
* @param {?Function} fCallback
* @param {string} sAction
* @param {Object=} oParameters
* @param {?number=} iTimeout
* @param {string=} sGetAdd = ''
* @param {Array=} aAbortActions = []
*/
AbstractRemoteStorage.prototype.defaultRequest = function (fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions)
{
oParameters = oParameters || {};
oParameters.Action = sAction;
sGetAdd = Utils.pString(sGetAdd);
sGetAdd = Utils.pString(sGetAdd);
Plugins.runHook('ajax-default-request', [sAction, oParameters, sGetAdd]);
Plugins.runHook('ajax-default-request', [sAction, oParameters, sGetAdd]);
this.ajaxRequest(fCallback, oParameters,
Utils.isUnd(iTimeout) ? Consts.Defaults.DefaultAjaxTimeout : Utils.pInt(iTimeout), sGetAdd, aAbortActions);
};
this.ajaxRequest(fCallback, oParameters,
Utils.isUnd(iTimeout) ? Consts.Defaults.DefaultAjaxTimeout : Utils.pInt(iTimeout), sGetAdd, aAbortActions);
};
/**
* @param {?Function} fCallback
*/
AbstractRemoteStorage.prototype.noop = function (fCallback)
{
this.defaultRequest(fCallback, 'Noop');
};
/**
* @param {?Function} fCallback
*/
AbstractRemoteStorage.prototype.noop = function (fCallback)
{
this.defaultRequest(fCallback, 'Noop');
};
/**
* @param {?Function} fCallback
* @param {string} sMessage
* @param {string} sFileName
* @param {number} iLineNo
* @param {string} sLocation
* @param {string} sHtmlCapa
* @param {number} iTime
*/
AbstractRemoteStorage.prototype.jsError = function (fCallback, sMessage, sFileName, iLineNo, sLocation, sHtmlCapa, iTime)
{
this.defaultRequest(fCallback, 'JsError', {
'Message': sMessage,
'FileName': sFileName,
'LineNo': iLineNo,
'Location': sLocation,
'HtmlCapa': sHtmlCapa,
'TimeOnPage': iTime
});
};
/**
* @param {?Function} fCallback
* @param {string} sMessage
* @param {string} sFileName
* @param {number} iLineNo
* @param {string} sLocation
* @param {string} sHtmlCapa
* @param {number} iTime
*/
AbstractRemoteStorage.prototype.jsError = function (fCallback, sMessage, sFileName, iLineNo, sLocation, sHtmlCapa, iTime)
{
this.defaultRequest(fCallback, 'JsError', {
'Message': sMessage,
'FileName': sFileName,
'LineNo': iLineNo,
'Location': sLocation,
'HtmlCapa': sHtmlCapa,
'TimeOnPage': iTime
});
};
/**
* @param {?Function} fCallback
* @param {string} sType
* @param {Array=} mData = null
* @param {boolean=} bIsError = false
*/
AbstractRemoteStorage.prototype.jsInfo = function (fCallback, sType, mData, bIsError)
{
this.defaultRequest(fCallback, 'JsInfo', {
'Type': sType,
'Data': mData,
'IsError': (Utils.isUnd(bIsError) ? false : !!bIsError) ? '1' : '0'
});
};
/**
* @param {?Function} fCallback
* @param {string} sType
* @param {Array=} mData = null
* @param {boolean=} bIsError = false
*/
AbstractRemoteStorage.prototype.jsInfo = function (fCallback, sType, mData, bIsError)
{
this.defaultRequest(fCallback, 'JsInfo', {
'Type': sType,
'Data': mData,
'IsError': (Utils.isUnd(bIsError) ? false : !!bIsError) ? '1' : '0'
});
};
/**
* @param {?Function} fCallback
*/
AbstractRemoteStorage.prototype.getPublicKey = function (fCallback)
{
this.defaultRequest(fCallback, 'GetPublicKey');
};
/**
* @param {?Function} fCallback
*/
AbstractRemoteStorage.prototype.getPublicKey = function (fCallback)
{
this.defaultRequest(fCallback, 'GetPublicKey');
};
/**
* @param {?Function} fCallback
* @param {string} sVersion
*/
AbstractRemoteStorage.prototype.jsVersion = function (fCallback, sVersion)
{
this.defaultRequest(fCallback, 'Version', {
'Version': sVersion
});
};
/**
* @param {?Function} fCallback
* @param {string} sVersion
*/
AbstractRemoteStorage.prototype.jsVersion = function (fCallback, sVersion)
{
this.defaultRequest(fCallback, 'Version', {
'Version': sVersion
});
};
module.exports = AbstractRemoteStorage;

View file

@ -9,7 +9,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
LinkBuilder = require('Common/LinkBuilder'),
Links = require('Common/Links'),
Settings = require('Storage/Settings')
;
@ -101,7 +101,7 @@
CacheAppStorage.prototype.getUserPic = function (sEmail, fCallback)
{
sEmail = Utils.trim(sEmail);
fCallback(this.bCapaGravatar && '' !== sEmail ? LinkBuilder.avatarLink(sEmail) : '', sEmail);
fCallback(this.bCapaGravatar && '' !== sEmail ? Links.avatarLink(sEmail) : '', sEmail);
};
/**

View file

@ -15,7 +15,7 @@
Enums = require('Common/Enums'),
Globals = require('Common/Globals'),
Utils = require('Common/Utils'),
LinkBuilder = require('Common/LinkBuilder'),
Links = require('Common/Links'),
Settings = require('Storage/Settings'),
Cache = require('Storage/App/Cache'),
@ -270,7 +270,7 @@
this.mainMessageListSearch = ko.computed({
'read': this.messageListSearch,
'write': function (sValue) {
kn.setHash(LinkBuilder.mailBox(
kn.setHash(Links.mailBox(
this.currentFolderFullNameHash(), 1, Utils.trim(sValue.toString())
));
},
@ -584,7 +584,7 @@
if (3 < iLen)
{
fNotificationHelper(
LinkBuilder.notificationMailIcon(),
Links.notificationMailIcon(),
this.accountEmail(),
Utils.i18n('MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION', {
'COUNT': iLen
@ -596,7 +596,7 @@
for (; iIndex < iLen; iIndex++)
{
fNotificationHelper(
LinkBuilder.notificationMailIcon(),
Links.notificationMailIcon(),
MessageModel.emailsToLine(MessageModel.initEmailsFromJson(aNewMessages[iIndex].From), false),
aNewMessages[iIndex].Subject
);

View file

@ -4,14 +4,13 @@
'use strict';
var
window = require('window'),
_ = require('_'),
ko = require('ko'),
key = require('key'),
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
LinkBuilder = require('Common/LinkBuilder'),
Links = require('Common/Links'),
Settings = require('Storage/Settings'),
Data = require('Storage/App/Data'),
@ -34,7 +33,7 @@
this.accountMenuDropdownTrigger = ko.observable(false);
this.capaAdditionalAccounts = Settings.capa(Enums.Capa.AdditionalAccounts);
this.capaAdditionalAccounts = ko.observable(Settings.capa(Enums.Capa.AdditionalAccounts));
this.loading = ko.computed(function () {
return this.accountsLoading();
@ -66,7 +65,7 @@
AbstractSystemDropDownAppView.prototype.settingsClick = function ()
{
require('Knoin/Knoin').setHash(LinkBuilder.settings());
require('Knoin/Knoin').setHash(Links.settings());
};
AbstractSystemDropDownAppView.prototype.settingsHelp = function ()
@ -76,7 +75,7 @@
AbstractSystemDropDownAppView.prototype.addAccountClick = function ()
{
if (this.capaAdditionalAccounts)
if (this.capaAdditionalAccounts())
{
require('Knoin/Knoin').showScreenPopup(require('View/Popup/AddAccount'));
}
@ -85,11 +84,6 @@
AbstractSystemDropDownAppView.prototype.logoutClick = function ()
{
Remote.logout(function () {
if (window.__rlah_clear)
{
window.__rlah_clear();
}
require('App/App').loginAndLogoutReload(true,
Settings.settingsGet('ParentEmail') && 0 < Settings.settingsGet('ParentEmail').length);
});

View file

@ -11,7 +11,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
LinkBuilder = require('Common/LinkBuilder'),
Links = require('Common/Links'),
Settings = require('Storage/Settings'),
Data = require('Storage/App/Data'),
@ -187,7 +187,7 @@
this.facebookCommand = Utils.createCommand(this, function () {
window.open(LinkBuilder.socialFacebook(), 'Facebook',
window.open(Links.socialFacebook(), 'Facebook',
'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes');
return true;
@ -199,7 +199,7 @@
this.googleCommand = Utils.createCommand(this, function () {
window.open(LinkBuilder.socialGoogle(), 'Google',
window.open(Links.socialGoogle(), 'Google',
'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes');
return true;
@ -211,7 +211,7 @@
this.twitterCommand = Utils.createCommand(this, function () {
window.open(LinkBuilder.socialTwitter(), 'Twitter',
window.open(Links.socialTwitter(), 'Twitter',
'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes');
return true;

View file

@ -13,7 +13,7 @@
Utils = require('Common/Utils'),
Enums = require('Common/Enums'),
Globals = require('Common/Globals'),
LinkBuilder = require('Common/LinkBuilder'),
Links = require('Common/Links'),
Settings = require('Storage/Settings'),
Cache = require('Storage/App/Cache'),
@ -96,7 +96,7 @@
Cache.setFolderHash(oFolder.fullNameRaw, '');
}
kn.setHash(LinkBuilder.mailBox(oFolder.fullNameHash));
kn.setHash(Links.mailBox(oFolder.fullNameHash));
}
})
;
@ -258,7 +258,7 @@
FolderListMailBoxAppView.prototype.configureFolders = function ()
{
kn.setHash(LinkBuilder.settings('folders'));
kn.setHash(Links.settings('folders'));
};
FolderListMailBoxAppView.prototype.contactsClick = function ()

View file

@ -15,7 +15,7 @@
Consts = require('Common/Consts'),
Globals = require('Common/Globals'),
Utils = require('Common/Utils'),
LinkBuilder = require('Common/LinkBuilder'),
Links = require('Common/Links'),
Events = require('Common/Events'),
Selector = require('Common/Selector'),
@ -229,7 +229,7 @@
if (Enums.Layout.NoPreview === Data.layout())
{
kn.setHash(LinkBuilder.messagePreview(), true);
kn.setHash(Links.messagePreview(), true);
Data.message.focused(true);
}
}
@ -672,7 +672,7 @@
var oPage = ko.dataFor(this);
if (oPage)
{
kn.setHash(LinkBuilder.mailBox(
kn.setHash(Links.mailBox(
Data.currentFolderFullNameHash(),
oPage.value,
Data.messageListSearch()
@ -885,7 +885,7 @@
var
oJua = new Jua({
'action': LinkBuilder.append(),
'action': Links.append(),
'name': 'AppendFile',
'queueSize': 1,
'multipleSizeLimit': 1,

View file

@ -7,7 +7,7 @@
_ = require('_'),
Globals = require('Common/Globals'),
LinkBuilder = require('Common/LinkBuilder'),
Links = require('Common/Links'),
kn = require('Knoin/Knoin'),
AbstractView = require('Knoin/AbstractView')
@ -35,12 +35,12 @@
MenuSettingsAppView.prototype.link = function (sRoute)
{
return LinkBuilder.settings(sRoute);
return Links.settings(sRoute);
};
MenuSettingsAppView.prototype.backToMailBoxClick = function ()
{
kn.setHash(LinkBuilder.inbox());
kn.setHash(Links.inbox());
};
module.exports = MenuSettingsAppView;

View file

@ -8,7 +8,7 @@
key = require('key'),
Enums = require('Common/Enums'),
LinkBuilder = require('Common/LinkBuilder'),
Links = require('Common/Links'),
Data = require('Storage/App/Data'),
@ -45,7 +45,7 @@
PaneSettingsAppView.prototype.backToMailBoxClick = function ()
{
kn.setHash(LinkBuilder.inbox());
kn.setHash(Links.inbox());
};
module.exports = PaneSettingsAppView;

View file

@ -17,7 +17,7 @@
Utils = require('Common/Utils'),
Globals = require('Common/Globals'),
Events = require('Common/Events'),
LinkBuilder = require('Common/LinkBuilder'),
Links = require('Common/Links'),
HtmlEditor = require('Common/HtmlEditor'),
Settings = require('Storage/Settings'),
@ -1288,7 +1288,7 @@
oUploadCache = {},
iAttachmentSizeLimit = Utils.pInt(Settings.settingsGet('AttachmentLimit')),
oJua = new Jua({
'action': LinkBuilder.upload(),
'action': Links.upload(),
'name': 'uploader',
'queueSize': 2,
'multipleSizeLimit': 50,

View file

@ -15,7 +15,7 @@
Globals = require('Common/Globals'),
Utils = require('Common/Utils'),
Selector = require('Common/Selector'),
LinkBuilder = require('Common/LinkBuilder'),
Links = require('Common/Links'),
Data = require('Storage/App/Data'),
Remote = require('Storage/App/Remote'),
@ -447,12 +447,12 @@
ContactsPopupView.prototype.exportVcf = function ()
{
require('App/App').download(LinkBuilder.exportContactsVcf());
require('App/App').download(Links.exportContactsVcf());
};
ContactsPopupView.prototype.exportCsv = function ()
{
require('App/App').download(LinkBuilder.exportContactsCsv());
require('App/App').download(Links.exportContactsCsv());
};
ContactsPopupView.prototype.initUploader = function ()
@ -461,7 +461,7 @@
{
var
oJua = new Jua({
'action': LinkBuilder.uploadContacts(),
'action': Links.uploadContacts(),
'name': 'uploader',
'queueSize': 1,
'multipleSizeLimit': 1,

View file

@ -31,7 +31,7 @@
KeyboardShortcutsHelpPopupView.prototype.onBuild = function (oDom)
{
key('tab, shift+tab, left, right', Enums.KeyState.PopupKeyboardShortcutsHelp, _.bind(function (event, handler) {
key('tab, shift+tab, left, right', Enums.KeyState.PopupKeyboardShortcutsHelp, _.throttle(_.bind(function (event, handler) {
if (event && handler)
{
var
@ -56,7 +56,7 @@
$tabs.eq(iIndex).find('a[data-toggle="tab"]').tab('show');
return false;
}
}, this));
}, this), 100));
};
module.exports = KeyboardShortcutsHelpPopupView;

View file

@ -1,8 +1,8 @@
{
"name": "RainLoop",
"title": "RainLoop Webmail",
"version": "1.6.9",
"release": "170",
"version": "1.6.10",
"release": "180",
"description": "Simple, modern & fast web-based email client",
"homepage": "http://rainloop.net",
"main": "gulpfile.js",

View file

@ -711,7 +711,6 @@ class Http
@\header('ETag: '.$sEtag, true);
@\header('Last-Modified: '.\gmdate('D, d M Y H:i:s', $iLastModified).' UTC', true);
@\header('Expires: '.\gmdate('D, j M Y H:i:s', $iExpires).' UTC', true);
@\header('Connection: close');
@\header('X-RainLoop-Cache: yes');
}
}

View file

@ -6631,7 +6631,7 @@ class Actions
{
$oAccount = $this->getAccountFromToken();
\header('Content-Type: text/directory; charset=UTF-8');
\header('Content-Type: text/x-vcard; charset=UTF-8');
\header('Content-Disposition: attachment; filename="contacts.vcf"', true);
\header('Accept-Ranges: none', true);
\header('Content-Transfer-Encoding: binary');
@ -6649,7 +6649,7 @@ class Actions
{
$oAccount = $this->getAccountFromToken();
\header('Content-Type: ext/csv; charset=UTF-8');
\header('Content-Type: text/csv; charset=UTF-8');
\header('Content-Disposition: attachment; filename="contacts.csv"', true);
\header('Accept-Ranges: none', true);
\header('Content-Transfer-Encoding: binary');