mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Google Drive (second look)
This commit is contained in:
parent
eea55d4e0a
commit
7107104e1a
18 changed files with 507 additions and 233 deletions
|
|
@ -10,10 +10,8 @@ function AdminSocial()
|
||||||
this.googleEnable = oData.googleEnable;
|
this.googleEnable = oData.googleEnable;
|
||||||
this.googleClientID = oData.googleClientID;
|
this.googleClientID = oData.googleClientID;
|
||||||
this.googleClientSecret = oData.googleClientSecret;
|
this.googleClientSecret = oData.googleClientSecret;
|
||||||
this.googleApiKey = oData.googleApiKey;
|
|
||||||
this.googleTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
|
this.googleTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||||
this.googleTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
|
this.googleTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||||
this.googleTrigger3 = ko.observable(Enums.SaveSettingsStep.Idle);
|
|
||||||
|
|
||||||
this.facebookSupported = oData.facebookSupported;
|
this.facebookSupported = oData.facebookSupported;
|
||||||
this.facebookEnable = oData.facebookEnable;
|
this.facebookEnable = oData.facebookEnable;
|
||||||
|
|
@ -47,7 +45,6 @@ AdminSocial.prototype.onBuild = function ()
|
||||||
f4 = Utils.settingsSaveHelperSimpleFunction(self.twitterTrigger2, self),
|
f4 = Utils.settingsSaveHelperSimpleFunction(self.twitterTrigger2, self),
|
||||||
f5 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger1, self),
|
f5 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger1, self),
|
||||||
f6 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger2, self),
|
f6 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger2, self),
|
||||||
f7 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger3, self),
|
|
||||||
f8 = Utils.settingsSaveHelperSimpleFunction(self.dropboxTrigger1, self)
|
f8 = Utils.settingsSaveHelperSimpleFunction(self.dropboxTrigger1, self)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
@ -114,12 +111,6 @@ AdminSocial.prototype.onBuild = function ()
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
self.googleApiKey.subscribe(function (sValue) {
|
|
||||||
RL.remote().saveAdminConfig(f7, {
|
|
||||||
'GoogleApiKey': Utils.trim(sValue)
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
self.dropboxEnable.subscribe(function (bValue) {
|
self.dropboxEnable.subscribe(function (bValue) {
|
||||||
RL.remote().saveAdminConfig(Utils.emptyFunction, {
|
RL.remote().saveAdminConfig(Utils.emptyFunction, {
|
||||||
'DropboxEnable': bValue ? '1' : '0'
|
'DropboxEnable': bValue ? '1' : '0'
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,11 @@ Globals.bAllowPdfPreview = !Globals.bMobileDevice;
|
||||||
*/
|
*/
|
||||||
Globals.bAnimationSupported = !Globals.bMobileDevice && $html.hasClass('csstransitions');
|
Globals.bAnimationSupported = !Globals.bMobileDevice && $html.hasClass('csstransitions');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
Globals.bXMLHttpRequestSupported = !!window.XMLHttpRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1118,7 +1118,6 @@ Utils.initDataConstructorBySettings = function (oData)
|
||||||
oData.googleEnable = ko.observable(false);
|
oData.googleEnable = ko.observable(false);
|
||||||
oData.googleClientID = ko.observable('');
|
oData.googleClientID = ko.observable('');
|
||||||
oData.googleClientSecret = ko.observable('');
|
oData.googleClientSecret = ko.observable('');
|
||||||
oData.googleApiKey = ko.observable('');
|
|
||||||
|
|
||||||
oData.dropboxEnable = ko.observable(false);
|
oData.dropboxEnable = ko.observable(false);
|
||||||
oData.dropboxApiKey = ko.observable('');
|
oData.dropboxApiKey = ko.observable('');
|
||||||
|
|
@ -2016,3 +2015,21 @@ Utils.detectDropdownVisibility = _.debounce(function () {
|
||||||
return oItem.hasClass('open');
|
return oItem.hasClass('open');
|
||||||
}));
|
}));
|
||||||
}, 50);
|
}, 50);
|
||||||
|
|
||||||
|
Utils.triggerAutocompleteInputChange = function (bDelay) {
|
||||||
|
|
||||||
|
var fFunc = function () {
|
||||||
|
$('.checkAutocomplete').trigger('change');
|
||||||
|
};
|
||||||
|
|
||||||
|
if (bDelay)
|
||||||
|
{
|
||||||
|
_.delay(fFunc, 100);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fFunc();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,6 @@ AbstractData.prototype.populateDataOnStart = function()
|
||||||
this.googleEnable(!!RL.settingsGet('AllowGoogleSocial'));
|
this.googleEnable(!!RL.settingsGet('AllowGoogleSocial'));
|
||||||
this.googleClientID(RL.settingsGet('GoogleClientID'));
|
this.googleClientID(RL.settingsGet('GoogleClientID'));
|
||||||
this.googleClientSecret(RL.settingsGet('GoogleClientSecret'));
|
this.googleClientSecret(RL.settingsGet('GoogleClientSecret'));
|
||||||
this.googleApiKey(RL.settingsGet('GoogleApiKey'));
|
|
||||||
|
|
||||||
this.dropboxEnable(!!RL.settingsGet('AllowDropboxSocial'));
|
this.dropboxEnable(!!RL.settingsGet('AllowDropboxSocial'));
|
||||||
this.dropboxApiKey(RL.settingsGet('DropboxApiKey'));
|
this.dropboxApiKey(RL.settingsGet('DropboxApiKey'));
|
||||||
|
|
|
||||||
|
|
@ -302,6 +302,18 @@ WebMailAjaxRemoteStorage.prototype.composeUploadExternals = function (fCallback,
|
||||||
}, 999000);
|
}, 999000);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {?Function} fCallback
|
||||||
|
* @param {Array} aExternals
|
||||||
|
*/
|
||||||
|
WebMailAjaxRemoteStorage.prototype.composeUploadDrive = function (fCallback, sUrl, sAccessToken)
|
||||||
|
{
|
||||||
|
this.defaultRequest(fCallback, 'ComposeUploadDrive', {
|
||||||
|
'AccessToken': sAccessToken,
|
||||||
|
'Url': sUrl
|
||||||
|
}, 999000);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {?Function} fCallback
|
* @param {?Function} fCallback
|
||||||
* @param {string} sFolder
|
* @param {string} sFolder
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,8 @@ function AdminLoginViewModel()
|
||||||
|
|
||||||
this.submitCommand = Utils.createCommand(this, function () {
|
this.submitCommand = Utils.createCommand(this, function () {
|
||||||
|
|
||||||
|
Utils.triggerAutocompleteInputChange();
|
||||||
|
|
||||||
this.loginError('' === Utils.trim(this.login()));
|
this.loginError('' === Utils.trim(this.login()));
|
||||||
this.passwordError('' === Utils.trim(this.password()));
|
this.passwordError('' === Utils.trim(this.password()));
|
||||||
|
|
||||||
|
|
@ -89,9 +91,7 @@ AdminLoginViewModel.prototype.onHide = function ()
|
||||||
|
|
||||||
AdminLoginViewModel.prototype.onBuild = function ()
|
AdminLoginViewModel.prototype.onBuild = function ()
|
||||||
{
|
{
|
||||||
_.delay(function () {
|
Utils.triggerAutocompleteInputChange(true);
|
||||||
$('.checkAutocomplete').trigger('change');
|
|
||||||
}, 100);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
AdminLoginViewModel.prototype.submitForm = function ()
|
AdminLoginViewModel.prototype.submitForm = function ()
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,8 @@ function LoginViewModel()
|
||||||
|
|
||||||
this.submitCommand = Utils.createCommand(this, function () {
|
this.submitCommand = Utils.createCommand(this, function () {
|
||||||
|
|
||||||
|
Utils.triggerAutocompleteInputChange();
|
||||||
|
|
||||||
this.emailError('' === Utils.trim(this.email()));
|
this.emailError('' === Utils.trim(this.email()));
|
||||||
this.passwordError('' === Utils.trim(this.password()));
|
this.passwordError('' === Utils.trim(this.password()));
|
||||||
|
|
||||||
|
|
@ -326,9 +328,7 @@ LoginViewModel.prototype.onBuild = function ()
|
||||||
});
|
});
|
||||||
}, 50);
|
}, 50);
|
||||||
|
|
||||||
_.delay(function () {
|
Utils.triggerAutocompleteInputChange(true);
|
||||||
$('.checkAutocomplete').trigger('change');
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -347,7 +347,7 @@ function PopupsComposeViewModel()
|
||||||
return this.dropboxEnabled();
|
return this.dropboxEnabled();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.driveEnabled = ko.observable(!!RL.settingsGet('GoogleApiKey') && !!RL.settingsGet('GoogleClientID'));
|
this.driveEnabled = ko.observable(false && Globals.bXMLHttpRequestSupported && !!RL.settingsGet('GoogleClientID'));
|
||||||
this.driveVisible = ko.observable(false);
|
this.driveVisible = ko.observable(false);
|
||||||
|
|
||||||
this.driveCommand = Utils.createCommand(this, function () {
|
this.driveCommand = Utils.createCommand(this, function () {
|
||||||
|
|
@ -992,13 +992,40 @@ PopupsComposeViewModel.prototype.onBuild = function ()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PopupsComposeViewModel.prototype.driveCallback = function (oData)
|
PopupsComposeViewModel.prototype.driveCallback = function (sAccessToken, oData)
|
||||||
{
|
{
|
||||||
if (oData && window.google && oData[window.google.picker.Response.ACTION] === window.google.picker.Action.PICKED &&
|
if (oData && window.google && oData[window.google.picker.Response.ACTION] === window.google.picker.Action.PICKED &&
|
||||||
oData[window.google.picker.Response.DOCUMENTS] && oData[window.google.picker.Response.DOCUMENTS][0] &&
|
oData[window.google.picker.Response.DOCUMENTS] && oData[window.google.picker.Response.DOCUMENTS][0] &&
|
||||||
oData[window.google.picker.Response.DOCUMENTS][0]['url'])
|
oData[window.google.picker.Response.DOCUMENTS][0]['id'])
|
||||||
{
|
{
|
||||||
this.addDriveAttachment(oData[window.google.picker.Response.DOCUMENTS][0]);
|
var
|
||||||
|
self = this,
|
||||||
|
oRequest = new window.XMLHttpRequest()
|
||||||
|
;
|
||||||
|
|
||||||
|
oRequest.open('GET', 'https://www.googleapis.com/drive/v2/files/' + oData[window.google.picker.Response.DOCUMENTS][0]['id']);
|
||||||
|
oRequest.setRequestHeader('Authorization', 'Bearer ' + sAccessToken);
|
||||||
|
oRequest.addEventListener('load', function() {
|
||||||
|
if (oRequest && oRequest.responseText)
|
||||||
|
{
|
||||||
|
var oItem = JSON.parse(oRequest.responseText);
|
||||||
|
if (oItem && oItem['downloadUrl'])
|
||||||
|
{
|
||||||
|
window.console.log(oItem['downloadUrl']);
|
||||||
|
var oSubRequest = new window.XMLHttpRequest();
|
||||||
|
oSubRequest.open('GET', oItem['downloadUrl']);
|
||||||
|
oSubRequest.setRequestHeader('Authorization', 'Bearer ' + sAccessToken);
|
||||||
|
oSubRequest.addEventListener('load', function() {
|
||||||
|
window.console.log(oSubRequest);
|
||||||
|
});
|
||||||
|
|
||||||
|
oSubRequest.send();
|
||||||
|
// self.addDriveAttachment(oItem, sAccessToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
oRequest.send();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1018,9 +1045,8 @@ PopupsComposeViewModel.prototype.driveCreatePiker = function (oOauthToken)
|
||||||
.setIncludeFolders(true)
|
.setIncludeFolders(true)
|
||||||
)
|
)
|
||||||
.setAppId(RL.settingsGet('GoogleClientID'))
|
.setAppId(RL.settingsGet('GoogleClientID'))
|
||||||
.setDeveloperKey(RL.settingsGet('GoogleApiKey'))
|
|
||||||
.setOAuthToken(oOauthToken.access_token)
|
.setOAuthToken(oOauthToken.access_token)
|
||||||
.setCallback(_.bind(self.driveCallback, self))
|
.setCallback(_.bind(self.driveCallback, self, oOauthToken.access_token))
|
||||||
.enableFeature(window.google.picker.Feature.NAV_HIDDEN)
|
.enableFeature(window.google.picker.Feature.NAV_HIDDEN)
|
||||||
.build()
|
.build()
|
||||||
;
|
;
|
||||||
|
|
@ -1044,7 +1070,9 @@ PopupsComposeViewModel.prototype.driveOpenPopup = function ()
|
||||||
{
|
{
|
||||||
window.gapi.auth.authorize({
|
window.gapi.auth.authorize({
|
||||||
'client_id': RL.settingsGet('GoogleClientID'),
|
'client_id': RL.settingsGet('GoogleClientID'),
|
||||||
'scope': 'https://www.googleapis.com/auth/drive.readonly',
|
'scope': [
|
||||||
|
'https://www.googleapis.com/auth/drive.readonly'
|
||||||
|
].join(' '),
|
||||||
'immediate': false
|
'immediate': false
|
||||||
}, function (oAuthResult) {
|
}, function (oAuthResult) {
|
||||||
if (oAuthResult && !oAuthResult.error)
|
if (oAuthResult && !oAuthResult.error)
|
||||||
|
|
@ -1390,12 +1418,64 @@ PopupsComposeViewModel.prototype.addDropboxAttachment = function (oDropboxFile)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Object} oDriveFile
|
* @param {Object} oDriveFile
|
||||||
|
* @param {string} sAccessToken
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
PopupsComposeViewModel.prototype.addDriveAttachment = function (oDriveFile)
|
PopupsComposeViewModel.prototype.addDriveAttachment = function (oDriveFile, sAccessToken)
|
||||||
{
|
{
|
||||||
window.console.log(oDriveFile);
|
var
|
||||||
|
self = this,
|
||||||
|
fCancelFunc = function (sId) {
|
||||||
|
return function () {
|
||||||
|
self.attachments.remove(function (oItem) {
|
||||||
|
return oItem && oItem.id === sId;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
},
|
||||||
|
iAttachmentSizeLimit = Utils.pInt(RL.settingsGet('AttachmentLimit')),
|
||||||
|
oAttachment = null,
|
||||||
|
mSize = Utils.pInt(oDriveFile['fileSize'])
|
||||||
|
;
|
||||||
|
|
||||||
|
oAttachment = new ComposeAttachmentModel(
|
||||||
|
oDriveFile['downloadUrl'], oDriveFile['originalFilename'], mSize
|
||||||
|
);
|
||||||
|
|
||||||
|
oAttachment.fromMessage = false;
|
||||||
|
oAttachment.cancel = fCancelFunc(oDriveFile['downloadUrl']);
|
||||||
|
oAttachment.waiting(false).uploading(true);
|
||||||
|
|
||||||
|
this.attachments.push(oAttachment);
|
||||||
|
|
||||||
|
if (0 < mSize && 0 < iAttachmentSizeLimit && iAttachmentSizeLimit < mSize)
|
||||||
|
{
|
||||||
|
oAttachment.uploading(false);
|
||||||
|
oAttachment.error(Utils.i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG'));
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
RL.remote().composeUploadDrive(function (sResult, oData) {
|
||||||
|
|
||||||
|
var bResult = false;
|
||||||
|
oAttachment.uploading(false);
|
||||||
|
|
||||||
|
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
||||||
|
{
|
||||||
|
if (oData.Result[oAttachment.id])
|
||||||
|
{
|
||||||
|
bResult = true;
|
||||||
|
oAttachment.tempName(oData.Result[oAttachment.id]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bResult)
|
||||||
|
{
|
||||||
|
oAttachment.error(Utils.getUploadErrorDescByCode(Enums.UploadErrorCode.FileNoUploaded));
|
||||||
|
}
|
||||||
|
|
||||||
|
}, oDriveFile['downloadUrl'], sAccessToken);
|
||||||
|
|
||||||
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -450,7 +450,7 @@ class Http
|
||||||
|
|
||||||
$oCurl = \curl_init($sUrl);
|
$oCurl = \curl_init($sUrl);
|
||||||
|
|
||||||
\curl_setopt_array($oCurl, array(
|
$aAddOptions = array(
|
||||||
CURLOPT_URL => $sUrl,
|
CURLOPT_URL => $sUrl,
|
||||||
CURLOPT_HEADER => true,
|
CURLOPT_HEADER => true,
|
||||||
CURLOPT_NOBODY => true,
|
CURLOPT_NOBODY => true,
|
||||||
|
|
@ -460,7 +460,14 @@ class Http
|
||||||
CURLOPT_FORBID_REUSE => false,
|
CURLOPT_FORBID_REUSE => false,
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
CURLOPT_TIMEOUT => 5
|
CURLOPT_TIMEOUT => 5
|
||||||
));
|
);
|
||||||
|
|
||||||
|
if (isset($aOptions[CURLOPT_HTTPHEADER]) && \is_array($aOptions[CURLOPT_HTTPHEADER]) && 0 < \count($aOptions[CURLOPT_HTTPHEADER]))
|
||||||
|
{
|
||||||
|
$aAddOptions[CURLOPT_HTTPHEADER] = $aOptions[CURLOPT_HTTPHEADER];
|
||||||
|
}
|
||||||
|
|
||||||
|
\curl_setopt_array($oCurl, $aAddOptions);
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
@ -514,11 +521,12 @@ class Http
|
||||||
* @param int $iTimeout = 10
|
* @param int $iTimeout = 10
|
||||||
* @param string $sProxy = ''
|
* @param string $sProxy = ''
|
||||||
* @param string $sProxyAuth = ''
|
* @param string $sProxyAuth = ''
|
||||||
|
* @param string $sAuthorization = ''
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function SaveUrlToFile($sUrl, $rFile, $sCustomUserAgent = 'MailSo Http User Agent (v1)', &$sContentType = '', &$iCode = 0,
|
public function SaveUrlToFile($sUrl, $rFile, $sCustomUserAgent = 'MailSo Http User Agent (v1)', &$sContentType = '', &$iCode = 0,
|
||||||
$oLogger = null, $iTimeout = 10, $sProxy = '', $sProxyAuth = '')
|
$oLogger = null, $iTimeout = 10, $sProxy = '', $sProxyAuth = '', $sAuthorization = '')
|
||||||
{
|
{
|
||||||
if (!is_resource($rFile))
|
if (!is_resource($rFile))
|
||||||
{
|
{
|
||||||
|
|
@ -530,6 +538,8 @@ class Http
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$aHeaders = array();
|
||||||
|
|
||||||
$aOptions = array(
|
$aOptions = array(
|
||||||
CURLOPT_URL => $sUrl,
|
CURLOPT_URL => $sUrl,
|
||||||
CURLOPT_HEADER => false,
|
CURLOPT_HEADER => false,
|
||||||
|
|
@ -547,6 +557,11 @@ class Http
|
||||||
$aOptions[CURLOPT_USERAGENT] = $sCustomUserAgent;
|
$aOptions[CURLOPT_USERAGENT] = $sCustomUserAgent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (0 < \strlen($sAuthorization))
|
||||||
|
{
|
||||||
|
$aHeaders[] = 'Authorization '.$sAuthorization;
|
||||||
|
}
|
||||||
|
|
||||||
if (0 < \strlen($sProxy))
|
if (0 < \strlen($sProxy))
|
||||||
{
|
{
|
||||||
$aOptions[CURLOPT_PROXY] = $sProxy;
|
$aOptions[CURLOPT_PROXY] = $sProxy;
|
||||||
|
|
@ -556,6 +571,11 @@ class Http
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (0 < \count($aHeaders))
|
||||||
|
{
|
||||||
|
$aOptions[CURLOPT_HTTPHEADER] = $aHeaders;
|
||||||
|
}
|
||||||
|
|
||||||
if ($oLogger)
|
if ($oLogger)
|
||||||
{
|
{
|
||||||
$oLogger->Write('cUrl: URL: '.$sUrl);
|
$oLogger->Write('cUrl: URL: '.$sUrl);
|
||||||
|
|
|
||||||
|
|
@ -1130,13 +1130,11 @@ class Actions
|
||||||
|
|
||||||
$aResult['AllowGoogleSocial'] = (bool) $oConfig->Get('social', 'google_enable', false);
|
$aResult['AllowGoogleSocial'] = (bool) $oConfig->Get('social', 'google_enable', false);
|
||||||
$aResult['GoogleClientID'] = \trim($oConfig->Get('social', 'google_client_id', ''));
|
$aResult['GoogleClientID'] = \trim($oConfig->Get('social', 'google_client_id', ''));
|
||||||
$aResult['GoogleApiKey'] = \trim($oConfig->Get('social', 'google_api_key', ''));
|
|
||||||
if ($aResult['AllowGoogleSocial'] && (
|
if ($aResult['AllowGoogleSocial'] && (
|
||||||
'' === \trim($oConfig->Get('social', 'google_client_id', '')) || '' === \trim($oConfig->Get('social', 'google_client_secret', ''))))
|
'' === \trim($oConfig->Get('social', 'google_client_id', '')) || '' === \trim($oConfig->Get('social', 'google_client_secret', ''))))
|
||||||
{
|
{
|
||||||
$aResult['AllowGoogleSocial'] = false;
|
$aResult['AllowGoogleSocial'] = false;
|
||||||
$aResult['GoogleClientID'] = '';
|
$aResult['GoogleClientID'] = '';
|
||||||
$aResult['GoogleApiKey'] = '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$aResult['AllowFacebookSocial'] = (bool) $oConfig->Get('social', 'fb_enable', false);
|
$aResult['AllowFacebookSocial'] = (bool) $oConfig->Get('social', 'fb_enable', false);
|
||||||
|
|
@ -1193,7 +1191,6 @@ class Actions
|
||||||
$aResult['AllowGoogleSocial'] = (bool) $oConfig->Get('social', 'google_enable', false);
|
$aResult['AllowGoogleSocial'] = (bool) $oConfig->Get('social', 'google_enable', false);
|
||||||
$aResult['GoogleClientID'] = (string) $oConfig->Get('social', 'google_client_id', '');
|
$aResult['GoogleClientID'] = (string) $oConfig->Get('social', 'google_client_id', '');
|
||||||
$aResult['GoogleClientSecret'] = (string) $oConfig->Get('social', 'google_client_secret', '');
|
$aResult['GoogleClientSecret'] = (string) $oConfig->Get('social', 'google_client_secret', '');
|
||||||
$aResult['GoogleApiKey'] = (string) $oConfig->Get('social', 'google_api_key', '');
|
|
||||||
|
|
||||||
$aResult['AllowFacebookSocial'] = (bool) $oConfig->Get('social', 'fb_enable', false);
|
$aResult['AllowFacebookSocial'] = (bool) $oConfig->Get('social', 'fb_enable', false);
|
||||||
$aResult['FacebookAppID'] = (string) $oConfig->Get('social', 'fb_app_id', '');
|
$aResult['FacebookAppID'] = (string) $oConfig->Get('social', 'fb_app_id', '');
|
||||||
|
|
@ -2399,7 +2396,6 @@ class Actions
|
||||||
$this->setConfigFromParams($oConfig, 'GoogleEnable', 'social', 'google_enable', 'bool');
|
$this->setConfigFromParams($oConfig, 'GoogleEnable', 'social', 'google_enable', 'bool');
|
||||||
$this->setConfigFromParams($oConfig, 'GoogleClientID', 'social', 'google_client_id', 'string');
|
$this->setConfigFromParams($oConfig, 'GoogleClientID', 'social', 'google_client_id', 'string');
|
||||||
$this->setConfigFromParams($oConfig, 'GoogleClientSecret', 'social', 'google_client_secret', 'string');
|
$this->setConfigFromParams($oConfig, 'GoogleClientSecret', 'social', 'google_client_secret', 'string');
|
||||||
$this->setConfigFromParams($oConfig, 'GoogleApiKey', 'social', 'google_api_key', 'string');
|
|
||||||
|
|
||||||
$this->setConfigFromParams($oConfig, 'FacebookEnable', 'social', 'fb_enable', 'bool');
|
$this->setConfigFromParams($oConfig, 'FacebookEnable', 'social', 'fb_enable', 'bool');
|
||||||
$this->setConfigFromParams($oConfig, 'FacebookAppID', 'social', 'fb_app_id', 'string');
|
$this->setConfigFromParams($oConfig, 'FacebookAppID', 'social', 'fb_app_id', 'string');
|
||||||
|
|
@ -5828,6 +5824,45 @@ class Actions
|
||||||
return $this->DefaultResponse(__FUNCTION__, $mResult);
|
return $this->DefaultResponse(__FUNCTION__, $mResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function DoComposeUploadDrive()
|
||||||
|
{
|
||||||
|
$oAccount = $this->getAccountFromToken();
|
||||||
|
|
||||||
|
$mResult = false;
|
||||||
|
$sUrl = $this->GetActionParam('Url', '');
|
||||||
|
$sAccessToken = $this->GetActionParam('AccessToken', '');
|
||||||
|
|
||||||
|
if (0 < \strlen($sUrl) && 0 < \strlen($sAccessToken))
|
||||||
|
{
|
||||||
|
$oHttp = \MailSo\Base\Http::SingletonInstance();
|
||||||
|
|
||||||
|
$mResult[$sUrl] = '';
|
||||||
|
|
||||||
|
$sTempName = \md5($sUrl);
|
||||||
|
|
||||||
|
$iCode = 0;
|
||||||
|
$sContentType = '';
|
||||||
|
|
||||||
|
$rFile = $this->FilesProvider()->GetFile($oAccount, $sTempName, 'wb+');
|
||||||
|
if ($rFile && $oHttp->SaveUrlToFile($sUrl, $rFile, '', $sContentType, $iCode, $this->Logger(), 60,
|
||||||
|
$this->Config()->Get('labs', 'curl_proxy', ''), $this->Config()->Get('labs', 'curl_proxy_auth', ''),
|
||||||
|
'Authorization: Bearer '.$sAccessToken))
|
||||||
|
{
|
||||||
|
$mResult[$sUrl] = $sTempName;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (\is_resource($rFile))
|
||||||
|
{
|
||||||
|
@\fclose($rFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->DefaultResponse(__FUNCTION__, $mResult);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -37,16 +37,6 @@
|
||||||
<div data-bind="saveTrigger: googleTrigger2"></div>
|
<div data-bind="saveTrigger: googleTrigger2"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label">
|
|
||||||
Client Api Key
|
|
||||||
</label>
|
|
||||||
<div class="controls">
|
|
||||||
<input type="text" class="span5" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
|
|
||||||
data-bind="value: googleApiKey, saveTrigger: googleTrigger3" />
|
|
||||||
<div data-bind="saveTrigger: googleTrigger3"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="legend">
|
<div class="legend">
|
||||||
Facebook
|
Facebook
|
||||||
<span style="color: #ccc; font-size: 14px;" data-bind="visible: !facebookSupported()">(requires PHP 5.4 or greater)</span>
|
<span style="color: #ccc; font-size: 14px;" data-bind="visible: !facebookSupported()">(requires PHP 5.4 or greater)</span>
|
||||||
|
|
|
||||||
|
|
@ -170,6 +170,11 @@ Globals.bAllowPdfPreview = !Globals.bMobileDevice;
|
||||||
*/
|
*/
|
||||||
Globals.bAnimationSupported = !Globals.bMobileDevice && $html.hasClass('csstransitions');
|
Globals.bAnimationSupported = !Globals.bMobileDevice && $html.hasClass('csstransitions');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
Globals.bXMLHttpRequestSupported = !!window.XMLHttpRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
|
|
@ -1915,7 +1920,6 @@ Utils.initDataConstructorBySettings = function (oData)
|
||||||
oData.googleEnable = ko.observable(false);
|
oData.googleEnable = ko.observable(false);
|
||||||
oData.googleClientID = ko.observable('');
|
oData.googleClientID = ko.observable('');
|
||||||
oData.googleClientSecret = ko.observable('');
|
oData.googleClientSecret = ko.observable('');
|
||||||
oData.googleApiKey = ko.observable('');
|
|
||||||
|
|
||||||
oData.dropboxEnable = ko.observable(false);
|
oData.dropboxEnable = ko.observable(false);
|
||||||
oData.dropboxApiKey = ko.observable('');
|
oData.dropboxApiKey = ko.observable('');
|
||||||
|
|
@ -2814,6 +2818,24 @@ Utils.detectDropdownVisibility = _.debounce(function () {
|
||||||
}));
|
}));
|
||||||
}, 50);
|
}, 50);
|
||||||
|
|
||||||
|
Utils.triggerAutocompleteInputChange = function (bDelay) {
|
||||||
|
|
||||||
|
var fFunc = function () {
|
||||||
|
$('.checkAutocomplete').trigger('change');
|
||||||
|
};
|
||||||
|
|
||||||
|
if (bDelay)
|
||||||
|
{
|
||||||
|
_.delay(fFunc, 100);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fFunc();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*jslint bitwise: true*/
|
/*jslint bitwise: true*/
|
||||||
// Base64 encode / decode
|
// Base64 encode / decode
|
||||||
// http://www.webtoolkit.info/
|
// http://www.webtoolkit.info/
|
||||||
|
|
@ -6198,6 +6220,8 @@ function AdminLoginViewModel()
|
||||||
|
|
||||||
this.submitCommand = Utils.createCommand(this, function () {
|
this.submitCommand = Utils.createCommand(this, function () {
|
||||||
|
|
||||||
|
Utils.triggerAutocompleteInputChange();
|
||||||
|
|
||||||
this.loginError('' === Utils.trim(this.login()));
|
this.loginError('' === Utils.trim(this.login()));
|
||||||
this.passwordError('' === Utils.trim(this.password()));
|
this.passwordError('' === Utils.trim(this.password()));
|
||||||
|
|
||||||
|
|
@ -6258,9 +6282,7 @@ AdminLoginViewModel.prototype.onHide = function ()
|
||||||
|
|
||||||
AdminLoginViewModel.prototype.onBuild = function ()
|
AdminLoginViewModel.prototype.onBuild = function ()
|
||||||
{
|
{
|
||||||
_.delay(function () {
|
Utils.triggerAutocompleteInputChange(true);
|
||||||
$('.checkAutocomplete').trigger('change');
|
|
||||||
}, 100);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
AdminLoginViewModel.prototype.submitForm = function ()
|
AdminLoginViewModel.prototype.submitForm = function ()
|
||||||
|
|
@ -7013,10 +7035,8 @@ function AdminSocial()
|
||||||
this.googleEnable = oData.googleEnable;
|
this.googleEnable = oData.googleEnable;
|
||||||
this.googleClientID = oData.googleClientID;
|
this.googleClientID = oData.googleClientID;
|
||||||
this.googleClientSecret = oData.googleClientSecret;
|
this.googleClientSecret = oData.googleClientSecret;
|
||||||
this.googleApiKey = oData.googleApiKey;
|
|
||||||
this.googleTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
|
this.googleTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||||
this.googleTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
|
this.googleTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||||
this.googleTrigger3 = ko.observable(Enums.SaveSettingsStep.Idle);
|
|
||||||
|
|
||||||
this.facebookSupported = oData.facebookSupported;
|
this.facebookSupported = oData.facebookSupported;
|
||||||
this.facebookEnable = oData.facebookEnable;
|
this.facebookEnable = oData.facebookEnable;
|
||||||
|
|
@ -7050,7 +7070,6 @@ AdminSocial.prototype.onBuild = function ()
|
||||||
f4 = Utils.settingsSaveHelperSimpleFunction(self.twitterTrigger2, self),
|
f4 = Utils.settingsSaveHelperSimpleFunction(self.twitterTrigger2, self),
|
||||||
f5 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger1, self),
|
f5 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger1, self),
|
||||||
f6 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger2, self),
|
f6 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger2, self),
|
||||||
f7 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger3, self),
|
|
||||||
f8 = Utils.settingsSaveHelperSimpleFunction(self.dropboxTrigger1, self)
|
f8 = Utils.settingsSaveHelperSimpleFunction(self.dropboxTrigger1, self)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
@ -7117,12 +7136,6 @@ AdminSocial.prototype.onBuild = function ()
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
self.googleApiKey.subscribe(function (sValue) {
|
|
||||||
RL.remote().saveAdminConfig(f7, {
|
|
||||||
'GoogleApiKey': Utils.trim(sValue)
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
self.dropboxEnable.subscribe(function (bValue) {
|
self.dropboxEnable.subscribe(function (bValue) {
|
||||||
RL.remote().saveAdminConfig(Utils.emptyFunction, {
|
RL.remote().saveAdminConfig(Utils.emptyFunction, {
|
||||||
'DropboxEnable': bValue ? '1' : '0'
|
'DropboxEnable': bValue ? '1' : '0'
|
||||||
|
|
@ -7598,7 +7611,6 @@ AbstractData.prototype.populateDataOnStart = function()
|
||||||
this.googleEnable(!!RL.settingsGet('AllowGoogleSocial'));
|
this.googleEnable(!!RL.settingsGet('AllowGoogleSocial'));
|
||||||
this.googleClientID(RL.settingsGet('GoogleClientID'));
|
this.googleClientID(RL.settingsGet('GoogleClientID'));
|
||||||
this.googleClientSecret(RL.settingsGet('GoogleClientSecret'));
|
this.googleClientSecret(RL.settingsGet('GoogleClientSecret'));
|
||||||
this.googleApiKey(RL.settingsGet('GoogleApiKey'));
|
|
||||||
|
|
||||||
this.dropboxEnable(!!RL.settingsGet('AllowDropboxSocial'));
|
this.dropboxEnable(!!RL.settingsGet('AllowDropboxSocial'));
|
||||||
this.dropboxApiKey(RL.settingsGet('DropboxApiKey'));
|
this.dropboxApiKey(RL.settingsGet('DropboxApiKey'));
|
||||||
|
|
|
||||||
8
rainloop/v/0.0.0/static/js/admin.min.js
vendored
8
rainloop/v/0.0.0/static/js/admin.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -173,6 +173,11 @@ Globals.bAllowPdfPreview = !Globals.bMobileDevice;
|
||||||
*/
|
*/
|
||||||
Globals.bAnimationSupported = !Globals.bMobileDevice && $html.hasClass('csstransitions');
|
Globals.bAnimationSupported = !Globals.bMobileDevice && $html.hasClass('csstransitions');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
Globals.bXMLHttpRequestSupported = !!window.XMLHttpRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
|
|
@ -1918,7 +1923,6 @@ Utils.initDataConstructorBySettings = function (oData)
|
||||||
oData.googleEnable = ko.observable(false);
|
oData.googleEnable = ko.observable(false);
|
||||||
oData.googleClientID = ko.observable('');
|
oData.googleClientID = ko.observable('');
|
||||||
oData.googleClientSecret = ko.observable('');
|
oData.googleClientSecret = ko.observable('');
|
||||||
oData.googleApiKey = ko.observable('');
|
|
||||||
|
|
||||||
oData.dropboxEnable = ko.observable(false);
|
oData.dropboxEnable = ko.observable(false);
|
||||||
oData.dropboxApiKey = ko.observable('');
|
oData.dropboxApiKey = ko.observable('');
|
||||||
|
|
@ -2817,6 +2821,24 @@ Utils.detectDropdownVisibility = _.debounce(function () {
|
||||||
}));
|
}));
|
||||||
}, 50);
|
}, 50);
|
||||||
|
|
||||||
|
Utils.triggerAutocompleteInputChange = function (bDelay) {
|
||||||
|
|
||||||
|
var fFunc = function () {
|
||||||
|
$('.checkAutocomplete').trigger('change');
|
||||||
|
};
|
||||||
|
|
||||||
|
if (bDelay)
|
||||||
|
{
|
||||||
|
_.delay(fFunc, 100);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fFunc();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*jslint bitwise: true*/
|
/*jslint bitwise: true*/
|
||||||
// Base64 encode / decode
|
// Base64 encode / decode
|
||||||
// http://www.webtoolkit.info/
|
// http://www.webtoolkit.info/
|
||||||
|
|
@ -9331,7 +9353,7 @@ function PopupsComposeViewModel()
|
||||||
return this.dropboxEnabled();
|
return this.dropboxEnabled();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.driveEnabled = ko.observable(!!RL.settingsGet('GoogleApiKey') && !!RL.settingsGet('GoogleClientID'));
|
this.driveEnabled = ko.observable(false && Globals.bXMLHttpRequestSupported && !!RL.settingsGet('GoogleClientID'));
|
||||||
this.driveVisible = ko.observable(false);
|
this.driveVisible = ko.observable(false);
|
||||||
|
|
||||||
this.driveCommand = Utils.createCommand(this, function () {
|
this.driveCommand = Utils.createCommand(this, function () {
|
||||||
|
|
@ -9976,13 +9998,40 @@ PopupsComposeViewModel.prototype.onBuild = function ()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PopupsComposeViewModel.prototype.driveCallback = function (oData)
|
PopupsComposeViewModel.prototype.driveCallback = function (sAccessToken, oData)
|
||||||
{
|
{
|
||||||
if (oData && window.google && oData[window.google.picker.Response.ACTION] === window.google.picker.Action.PICKED &&
|
if (oData && window.google && oData[window.google.picker.Response.ACTION] === window.google.picker.Action.PICKED &&
|
||||||
oData[window.google.picker.Response.DOCUMENTS] && oData[window.google.picker.Response.DOCUMENTS][0] &&
|
oData[window.google.picker.Response.DOCUMENTS] && oData[window.google.picker.Response.DOCUMENTS][0] &&
|
||||||
oData[window.google.picker.Response.DOCUMENTS][0]['url'])
|
oData[window.google.picker.Response.DOCUMENTS][0]['id'])
|
||||||
{
|
{
|
||||||
this.addDriveAttachment(oData[window.google.picker.Response.DOCUMENTS][0]);
|
var
|
||||||
|
self = this,
|
||||||
|
oRequest = new window.XMLHttpRequest()
|
||||||
|
;
|
||||||
|
|
||||||
|
oRequest.open('GET', 'https://www.googleapis.com/drive/v2/files/' + oData[window.google.picker.Response.DOCUMENTS][0]['id']);
|
||||||
|
oRequest.setRequestHeader('Authorization', 'Bearer ' + sAccessToken);
|
||||||
|
oRequest.addEventListener('load', function() {
|
||||||
|
if (oRequest && oRequest.responseText)
|
||||||
|
{
|
||||||
|
var oItem = JSON.parse(oRequest.responseText);
|
||||||
|
if (oItem && oItem['downloadUrl'])
|
||||||
|
{
|
||||||
|
window.console.log(oItem['downloadUrl']);
|
||||||
|
var oSubRequest = new window.XMLHttpRequest();
|
||||||
|
oSubRequest.open('GET', oItem['downloadUrl']);
|
||||||
|
oSubRequest.setRequestHeader('Authorization', 'Bearer ' + sAccessToken);
|
||||||
|
oSubRequest.addEventListener('load', function() {
|
||||||
|
window.console.log(oSubRequest);
|
||||||
|
});
|
||||||
|
|
||||||
|
oSubRequest.send();
|
||||||
|
// self.addDriveAttachment(oItem, sAccessToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
oRequest.send();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -10002,9 +10051,8 @@ PopupsComposeViewModel.prototype.driveCreatePiker = function (oOauthToken)
|
||||||
.setIncludeFolders(true)
|
.setIncludeFolders(true)
|
||||||
)
|
)
|
||||||
.setAppId(RL.settingsGet('GoogleClientID'))
|
.setAppId(RL.settingsGet('GoogleClientID'))
|
||||||
.setDeveloperKey(RL.settingsGet('GoogleApiKey'))
|
|
||||||
.setOAuthToken(oOauthToken.access_token)
|
.setOAuthToken(oOauthToken.access_token)
|
||||||
.setCallback(_.bind(self.driveCallback, self))
|
.setCallback(_.bind(self.driveCallback, self, oOauthToken.access_token))
|
||||||
.enableFeature(window.google.picker.Feature.NAV_HIDDEN)
|
.enableFeature(window.google.picker.Feature.NAV_HIDDEN)
|
||||||
.build()
|
.build()
|
||||||
;
|
;
|
||||||
|
|
@ -10028,7 +10076,9 @@ PopupsComposeViewModel.prototype.driveOpenPopup = function ()
|
||||||
{
|
{
|
||||||
window.gapi.auth.authorize({
|
window.gapi.auth.authorize({
|
||||||
'client_id': RL.settingsGet('GoogleClientID'),
|
'client_id': RL.settingsGet('GoogleClientID'),
|
||||||
'scope': 'https://www.googleapis.com/auth/drive.readonly',
|
'scope': [
|
||||||
|
'https://www.googleapis.com/auth/drive.readonly'
|
||||||
|
].join(' '),
|
||||||
'immediate': false
|
'immediate': false
|
||||||
}, function (oAuthResult) {
|
}, function (oAuthResult) {
|
||||||
if (oAuthResult && !oAuthResult.error)
|
if (oAuthResult && !oAuthResult.error)
|
||||||
|
|
@ -10374,12 +10424,64 @@ PopupsComposeViewModel.prototype.addDropboxAttachment = function (oDropboxFile)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Object} oDriveFile
|
* @param {Object} oDriveFile
|
||||||
|
* @param {string} sAccessToken
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
PopupsComposeViewModel.prototype.addDriveAttachment = function (oDriveFile)
|
PopupsComposeViewModel.prototype.addDriveAttachment = function (oDriveFile, sAccessToken)
|
||||||
{
|
{
|
||||||
window.console.log(oDriveFile);
|
var
|
||||||
|
self = this,
|
||||||
|
fCancelFunc = function (sId) {
|
||||||
|
return function () {
|
||||||
|
self.attachments.remove(function (oItem) {
|
||||||
|
return oItem && oItem.id === sId;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
},
|
||||||
|
iAttachmentSizeLimit = Utils.pInt(RL.settingsGet('AttachmentLimit')),
|
||||||
|
oAttachment = null,
|
||||||
|
mSize = Utils.pInt(oDriveFile['fileSize'])
|
||||||
|
;
|
||||||
|
|
||||||
|
oAttachment = new ComposeAttachmentModel(
|
||||||
|
oDriveFile['downloadUrl'], oDriveFile['originalFilename'], mSize
|
||||||
|
);
|
||||||
|
|
||||||
|
oAttachment.fromMessage = false;
|
||||||
|
oAttachment.cancel = fCancelFunc(oDriveFile['downloadUrl']);
|
||||||
|
oAttachment.waiting(false).uploading(true);
|
||||||
|
|
||||||
|
this.attachments.push(oAttachment);
|
||||||
|
|
||||||
|
if (0 < mSize && 0 < iAttachmentSizeLimit && iAttachmentSizeLimit < mSize)
|
||||||
|
{
|
||||||
|
oAttachment.uploading(false);
|
||||||
|
oAttachment.error(Utils.i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG'));
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
RL.remote().composeUploadDrive(function (sResult, oData) {
|
||||||
|
|
||||||
|
var bResult = false;
|
||||||
|
oAttachment.uploading(false);
|
||||||
|
|
||||||
|
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
||||||
|
{
|
||||||
|
if (oData.Result[oAttachment.id])
|
||||||
|
{
|
||||||
|
bResult = true;
|
||||||
|
oAttachment.tempName(oData.Result[oAttachment.id]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bResult)
|
||||||
|
{
|
||||||
|
oAttachment.error(Utils.getUploadErrorDescByCode(Enums.UploadErrorCode.FileNoUploaded));
|
||||||
|
}
|
||||||
|
|
||||||
|
}, oDriveFile['downloadUrl'], sAccessToken);
|
||||||
|
|
||||||
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -12501,6 +12603,8 @@ function LoginViewModel()
|
||||||
|
|
||||||
this.submitCommand = Utils.createCommand(this, function () {
|
this.submitCommand = Utils.createCommand(this, function () {
|
||||||
|
|
||||||
|
Utils.triggerAutocompleteInputChange();
|
||||||
|
|
||||||
this.emailError('' === Utils.trim(this.email()));
|
this.emailError('' === Utils.trim(this.email()));
|
||||||
this.passwordError('' === Utils.trim(this.password()));
|
this.passwordError('' === Utils.trim(this.password()));
|
||||||
|
|
||||||
|
|
@ -12754,9 +12858,7 @@ LoginViewModel.prototype.onBuild = function ()
|
||||||
});
|
});
|
||||||
}, 50);
|
}, 50);
|
||||||
|
|
||||||
_.delay(function () {
|
Utils.triggerAutocompleteInputChange(true);
|
||||||
$('.checkAutocomplete').trigger('change');
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -16291,7 +16393,6 @@ AbstractData.prototype.populateDataOnStart = function()
|
||||||
this.googleEnable(!!RL.settingsGet('AllowGoogleSocial'));
|
this.googleEnable(!!RL.settingsGet('AllowGoogleSocial'));
|
||||||
this.googleClientID(RL.settingsGet('GoogleClientID'));
|
this.googleClientID(RL.settingsGet('GoogleClientID'));
|
||||||
this.googleClientSecret(RL.settingsGet('GoogleClientSecret'));
|
this.googleClientSecret(RL.settingsGet('GoogleClientSecret'));
|
||||||
this.googleApiKey(RL.settingsGet('GoogleApiKey'));
|
|
||||||
|
|
||||||
this.dropboxEnable(!!RL.settingsGet('AllowDropboxSocial'));
|
this.dropboxEnable(!!RL.settingsGet('AllowDropboxSocial'));
|
||||||
this.dropboxApiKey(RL.settingsGet('DropboxApiKey'));
|
this.dropboxApiKey(RL.settingsGet('DropboxApiKey'));
|
||||||
|
|
@ -18144,6 +18245,18 @@ WebMailAjaxRemoteStorage.prototype.composeUploadExternals = function (fCallback,
|
||||||
}, 999000);
|
}, 999000);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {?Function} fCallback
|
||||||
|
* @param {Array} aExternals
|
||||||
|
*/
|
||||||
|
WebMailAjaxRemoteStorage.prototype.composeUploadDrive = function (fCallback, sUrl, sAccessToken)
|
||||||
|
{
|
||||||
|
this.defaultRequest(fCallback, 'ComposeUploadDrive', {
|
||||||
|
'AccessToken': sAccessToken,
|
||||||
|
'Url': sUrl
|
||||||
|
}, 999000);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {?Function} fCallback
|
* @param {?Function} fCallback
|
||||||
* @param {string} sFolder
|
* @param {string} sFolder
|
||||||
|
|
|
||||||
18
rainloop/v/0.0.0/static/js/app.min.js
vendored
18
rainloop/v/0.0.0/static/js/app.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue