mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Add "custom-admin-settings-tab" plugin
This commit is contained in:
parent
613ab074d9
commit
3bcf23f8fa
11 changed files with 115 additions and 3 deletions
|
|
@ -40,6 +40,7 @@ export default (App) => {
|
||||||
window['rl']['createCommand'] = Utils.createCommand;
|
window['rl']['createCommand'] = Utils.createCommand;
|
||||||
|
|
||||||
window['rl']['addSettingsViewModel'] = _.bind(Plugins.addSettingsViewModel, Plugins);
|
window['rl']['addSettingsViewModel'] = _.bind(Plugins.addSettingsViewModel, Plugins);
|
||||||
|
window['rl']['addSettingsViewModelForAdmin'] = _.bind(Plugins.addSettingsViewModelForAdmin, Plugins);
|
||||||
|
|
||||||
window['rl']['pluginRemoteRequest'] = _.bind(Plugins.remoteRequest, Plugins);
|
window['rl']['pluginRemoteRequest'] = _.bind(Plugins.remoteRequest, Plugins);
|
||||||
window['rl']['pluginSettingsGet'] = _.bind(Plugins.settingsGet, Plugins);
|
window['rl']['pluginSettingsGet'] = _.bind(Plugins.settingsGet, Plugins);
|
||||||
|
|
|
||||||
20
plugins/custom-admin-settings-tab/LICENSE
Normal file
20
plugins/custom-admin-settings-tab/LICENSE
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2016 RainLoop Team
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
1
plugins/custom-admin-settings-tab/VERSION
Normal file
1
plugins/custom-admin-settings-tab/VERSION
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
1.0
|
||||||
29
plugins/custom-admin-settings-tab/index.php
Normal file
29
plugins/custom-admin-settings-tab/index.php
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class CustomAdminSettingsTabPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function Init()
|
||||||
|
{
|
||||||
|
$this->UseLangs(true); // start use langs folder
|
||||||
|
|
||||||
|
$this->addJs('js/CustomAdminSettings.js', true); // add js file
|
||||||
|
|
||||||
|
$this->addAjaxHook('AjaxAdminGetData', 'AjaxAdminGetData');
|
||||||
|
|
||||||
|
$this->addTemplate('templates/PluginCustomAdminSettingnTab.html', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function AjaxAdminGetData()
|
||||||
|
{
|
||||||
|
return $this->ajaxResponse(__FUNCTION__, array(
|
||||||
|
'PHP' => phpversion()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
36
plugins/custom-admin-settings-tab/js/CustomAdminSettings.js
Normal file
36
plugins/custom-admin-settings-tab/js/CustomAdminSettings.js
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
function CustomAdminSettings()
|
||||||
|
{
|
||||||
|
this.php = ko.observable('');
|
||||||
|
|
||||||
|
this.loading = ko.observable(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomAdminSettings.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.php(oData.Result.PHP || '');
|
||||||
|
}
|
||||||
|
|
||||||
|
}, 'AjaxAdminGetData');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
window.rl.addSettingsViewModelForAdmin(CustomAdminSettings, 'PluginCustomAdminSettingnTab',
|
||||||
|
'SETTINGS_CUSTOM_ADMIN_CUSTOM_TAB_PLUGIN/TAB_NAME', 'custom');
|
||||||
|
|
||||||
|
}());
|
||||||
4
plugins/custom-admin-settings-tab/langs/en.ini
Normal file
4
plugins/custom-admin-settings-tab/langs/en.ini
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
[SETTINGS_CUSTOM_ADMIN_CUSTOM_TAB_PLUGIN]
|
||||||
|
TAB_NAME = "Custom Plugin Tab"
|
||||||
|
LEGEND_CUSTOM = "Custom Plugin Tab (Example)"
|
||||||
|
LABEL_PHP_VERSION = "PHP version"
|
||||||
4
plugins/custom-admin-settings-tab/langs/ru.ini
Normal file
4
plugins/custom-admin-settings-tab/langs/ru.ini
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
[SETTINGS_CUSTOM_ADMIN_CUSTOM_TAB_PLUGIN]
|
||||||
|
TAB_NAME = "Плагин"
|
||||||
|
LEGEND_CUSTOM = "Плагин (Пример)"
|
||||||
|
LABEL_PHP_VERSION = "PHP версия"
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<div>
|
||||||
|
<div class="form-horizontal">
|
||||||
|
<div class="legend">
|
||||||
|
<span class="i18n" data-i18n="SETTINGS_CUSTOM_ADMIN_CUSTOM_TAB_PLUGIN/LEGEND_CUSTOM"></span>
|
||||||
|
|
||||||
|
<i class="icon-spinner animated" style="margin-top: 5px" data-bind="visible: loading"></i>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label">
|
||||||
|
<span class="i18n" data-i18n="SETTINGS_CUSTOM_ADMIN_CUSTOM_TAB_PLUGIN/LABEL_PHP_VERSION"></span>
|
||||||
|
</label>
|
||||||
|
<div class="controls" style="padding-top: 5px">
|
||||||
|
<b data-bind="text: php"></b>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -14,7 +14,7 @@ class CustomSettingsTabPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
$this->addAjaxHook('AjaxGetCustomUserData', 'AjaxGetCustomUserData');
|
$this->addAjaxHook('AjaxGetCustomUserData', 'AjaxGetCustomUserData');
|
||||||
$this->addAjaxHook('AjaxSaveCustomUserData', 'AjaxSaveCustomUserData');
|
$this->addAjaxHook('AjaxSaveCustomUserData', 'AjaxSaveCustomUserData');
|
||||||
|
|
||||||
$this->addTemplate('templates/PluginCustomSettingsTag.html');
|
$this->addTemplate('templates/PluginCustomSettingsTab.html');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -64,10 +64,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}, 'AjaxGetCustomUserData');
|
}, 'AjaxGetCustomUserData');
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
window.rl.addSettingsViewModel(CustomUserSettings, 'PluginCustomSettingsTag',
|
window.rl.addSettingsViewModel(CustomUserSettings, 'PluginCustomSettingsTab',
|
||||||
'SETTINGS_CUSTOM_PLUGIN/TAB_NAME', 'custom');
|
'SETTINGS_CUSTOM_PLUGIN/TAB_NAME', 'custom');
|
||||||
|
|
||||||
}());
|
}());
|
||||||
Loading…
Add table
Add a link
Reference in a new issue