mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
Code refactoring
This commit is contained in:
parent
31860420cb
commit
4eaef23cc7
52 changed files with 99 additions and 103 deletions
294
dev/Remote/Admin/Ajax.js
Normal file
294
dev/Remote/Admin/Ajax.js
Normal file
|
|
@ -0,0 +1,294 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
|
||||
AbstractAjaxRemote = require('Remote/AbstractAjax')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractAjaxRemote
|
||||
*/
|
||||
function RemoteAdminStorage()
|
||||
{
|
||||
AbstractAjaxRemote.call(this);
|
||||
|
||||
this.oRequests = {};
|
||||
}
|
||||
|
||||
_.extend(RemoteAdminStorage.prototype, AbstractAjaxRemote.prototype);
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sLogin
|
||||
* @param {string} sPassword
|
||||
*/
|
||||
RemoteAdminStorage.prototype.adminLogin = function (fCallback, sLogin, sPassword)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminLogin', {
|
||||
'Login': sLogin,
|
||||
'Password': sPassword
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
RemoteAdminStorage.prototype.adminLogout = function (fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminLogout');
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {?} oData
|
||||
*/
|
||||
RemoteAdminStorage.prototype.saveAdminConfig = function (fCallback, oData)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminSettingsUpdate', oData);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
RemoteAdminStorage.prototype.domainList = function (fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminDomainList');
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
RemoteAdminStorage.prototype.pluginList = function (fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminPluginList');
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
RemoteAdminStorage.prototype.packagesList = function (fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminPackagesList');
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
RemoteAdminStorage.prototype.coreData = function (fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminCoreData');
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
RemoteAdminStorage.prototype.updateCoreData = function (fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminUpdateCoreData', {}, 90000);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {Object} oPackage
|
||||
*/
|
||||
RemoteAdminStorage.prototype.packageInstall = function (fCallback, oPackage)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminPackageInstall', {
|
||||
'Id': oPackage.id,
|
||||
'Type': oPackage.type,
|
||||
'File': oPackage.file
|
||||
}, 60000);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {Object} oPackage
|
||||
*/
|
||||
RemoteAdminStorage.prototype.packageDelete = function (fCallback, oPackage)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminPackageDelete', {
|
||||
'Id': oPackage.id
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sName
|
||||
*/
|
||||
RemoteAdminStorage.prototype.domain = function (fCallback, sName)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminDomainLoad', {
|
||||
'Name': sName
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sName
|
||||
*/
|
||||
RemoteAdminStorage.prototype.plugin = function (fCallback, sName)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminPluginLoad', {
|
||||
'Name': sName
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sName
|
||||
*/
|
||||
RemoteAdminStorage.prototype.domainDelete = function (fCallback, sName)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminDomainDelete', {
|
||||
'Name': sName
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sName
|
||||
* @param {boolean} bDisabled
|
||||
*/
|
||||
RemoteAdminStorage.prototype.domainDisable = function (fCallback, sName, bDisabled)
|
||||
{
|
||||
return this.defaultRequest(fCallback, 'AdminDomainDisable', {
|
||||
'Name': sName,
|
||||
'Disabled': !!bDisabled ? '1' : '0'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {Object} oConfig
|
||||
*/
|
||||
RemoteAdminStorage.prototype.pluginSettingsUpdate = function (fCallback, oConfig)
|
||||
{
|
||||
return this.defaultRequest(fCallback, 'AdminPluginSettingsUpdate', oConfig);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {boolean} bForce
|
||||
*/
|
||||
RemoteAdminStorage.prototype.licensing = function (fCallback, bForce)
|
||||
{
|
||||
return this.defaultRequest(fCallback, 'AdminLicensing', {
|
||||
'Force' : bForce ? '1' : '0'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sDomain
|
||||
* @param {string} sKey
|
||||
*/
|
||||
RemoteAdminStorage.prototype.licensingActivate = function (fCallback, sDomain, sKey)
|
||||
{
|
||||
return this.defaultRequest(fCallback, 'AdminLicensingActivate', {
|
||||
'Domain' : sDomain,
|
||||
'Key' : sKey
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sName
|
||||
* @param {boolean} bDisabled
|
||||
*/
|
||||
RemoteAdminStorage.prototype.pluginDisable = function (fCallback, sName, bDisabled)
|
||||
{
|
||||
return this.defaultRequest(fCallback, 'AdminPluginDisable', {
|
||||
'Name': sName,
|
||||
'Disabled': !!bDisabled ? '1' : '0'
|
||||
});
|
||||
};
|
||||
|
||||
RemoteAdminStorage.prototype.createOrUpdateDomain = function (fCallback,
|
||||
bCreate, sName,
|
||||
sIncHost, iIncPort, sIncSecure, bIncShortLogin,
|
||||
bUseSieve, sSieveAllowRaw, sSieveHost, iSievePort, sSieveSecure,
|
||||
sOutHost, iOutPort, sOutSecure, bOutShortLogin, bOutAuth, bOutPhpMail,
|
||||
sWhiteList)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminDomainSave', {
|
||||
'Create': bCreate ? '1' : '0',
|
||||
'Name': sName,
|
||||
|
||||
'IncHost': sIncHost,
|
||||
'IncPort': iIncPort,
|
||||
'IncSecure': sIncSecure,
|
||||
'IncShortLogin': bIncShortLogin ? '1' : '0',
|
||||
|
||||
'UseSieve': bUseSieve ? '1' : '0',
|
||||
'SieveAllowRaw': sSieveAllowRaw ? '1' : '0',
|
||||
'SieveHost': sSieveHost,
|
||||
'SievePort': iSievePort,
|
||||
'SieveSecure': sSieveSecure,
|
||||
|
||||
'OutHost': sOutHost,
|
||||
'OutPort': iOutPort,
|
||||
'OutSecure': sOutSecure,
|
||||
'OutShortLogin': bOutShortLogin ? '1' : '0',
|
||||
'OutAuth': bOutAuth ? '1' : '0',
|
||||
'OutUsePhpMail': bOutPhpMail ? '1' : '0',
|
||||
|
||||
'WhiteList': sWhiteList
|
||||
});
|
||||
};
|
||||
|
||||
RemoteAdminStorage.prototype.testConnectionForDomain = function (fCallback, sName,
|
||||
sIncHost, iIncPort, sIncSecure,
|
||||
bUseSieve, sSieveHost, iSievePort, sSieveSecure,
|
||||
sOutHost, iOutPort, sOutSecure, bOutAuth, bOutPhpMail)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminDomainTest', {
|
||||
'Name': sName,
|
||||
'IncHost': sIncHost,
|
||||
'IncPort': iIncPort,
|
||||
'IncSecure': sIncSecure,
|
||||
'UseSieve': bUseSieve ? '1' : '0',
|
||||
'SieveHost': sSieveHost,
|
||||
'SievePort': iSievePort,
|
||||
'SieveSecure': sSieveSecure,
|
||||
'OutHost': sOutHost,
|
||||
'OutPort': iOutPort,
|
||||
'OutSecure': sOutSecure,
|
||||
'OutAuth': bOutAuth ? '1' : '0',
|
||||
'OutUsePhpMail': bOutPhpMail ? '1' : '0'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {?} oData
|
||||
*/
|
||||
RemoteAdminStorage.prototype.testContacts = function (fCallback, oData)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminContactsTest', oData);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {?} oData
|
||||
*/
|
||||
RemoteAdminStorage.prototype.saveNewAdminPassword = function (fCallback, oData)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminPasswordUpdate', oData);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
RemoteAdminStorage.prototype.adminPing = function (fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminPing');
|
||||
};
|
||||
|
||||
module.exports = new RemoteAdminStorage();
|
||||
|
||||
}());
|
||||
Loading…
Add table
Add a link
Reference in a new issue