mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-04 23:17:02 +03:00
Plugin system enhancements (Custom user's settings tabs)
This commit is contained in:
parent
a3f28b09f6
commit
9a58fd0a66
13 changed files with 398 additions and 16 deletions
73
plugins/custom-settings-tab/js/CustomUserSettings.js
Normal file
73
plugins/custom-settings-tab/js/CustomUserSettings.js
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
|
||||
(function () {
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function CustomUserSettings()
|
||||
{
|
||||
this.userSkype = ko.observable('');
|
||||
this.userFacebook = ko.observable('');
|
||||
|
||||
this.loading = ko.observable(false);
|
||||
this.saving = ko.observable(false);
|
||||
|
||||
this.savingOrLoading = ko.computed(function () {
|
||||
return this.loading() || this.saving();
|
||||
}, this);
|
||||
}
|
||||
|
||||
CustomUserSettings.prototype.customAjaxSaveData = function ()
|
||||
{
|
||||
var self = this;
|
||||
|
||||
if (this.saving())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
this.saving(true);
|
||||
|
||||
window.rl.pluginRemoteRequest(function (sResult, oData) {
|
||||
|
||||
self.saving(false);
|
||||
|
||||
if (window.rl.Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
||||
{
|
||||
// true
|
||||
}
|
||||
else
|
||||
{
|
||||
// false
|
||||
}
|
||||
|
||||
}, 'AjaxSaveCustomUserData', {
|
||||
'UserSkype': this.userSkype(),
|
||||
'UserFacebook': this.userFacebook()
|
||||
});
|
||||
};
|
||||
|
||||
CustomUserSettings.prototype.onBuild = function () // special function
|
||||
{
|
||||
var self = this;
|
||||
|
||||
this.loading(true);
|
||||
|
||||
window.rl.pluginRemoteRequest(function (sResult, oData) {
|
||||
|
||||
self.loading(false);
|
||||
|
||||
if (window.rl.Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
||||
{
|
||||
self.userSkype(oData.Result.UserSkype || '');
|
||||
self.userFacebook(oData.Result.UserFacebook || '');
|
||||
}
|
||||
|
||||
}, 'AjaxGetCustomUserData');
|
||||
|
||||
};
|
||||
|
||||
window.rl.addSettingsViewModel(CustomUserSettings, 'PluginCustomSettingsTag',
|
||||
'SETTINGS_CUSTOM_PLUGIN/TAB_NAME', 'custom');
|
||||
|
||||
}());
|
||||
Loading…
Add table
Add a link
Reference in a new issue