diff --git a/dev/bootstrap.jsx b/dev/bootstrap.jsx index c277467f5..7aae09cd2 100644 --- a/dev/bootstrap.jsx +++ b/dev/bootstrap.jsx @@ -40,6 +40,7 @@ export default (App) => { window['rl']['createCommand'] = Utils.createCommand; window['rl']['addSettingsViewModel'] = _.bind(Plugins.addSettingsViewModel, Plugins); + window['rl']['addSettingsViewModelForAdmin'] = _.bind(Plugins.addSettingsViewModelForAdmin, Plugins); window['rl']['pluginRemoteRequest'] = _.bind(Plugins.remoteRequest, Plugins); window['rl']['pluginSettingsGet'] = _.bind(Plugins.settingsGet, Plugins); diff --git a/plugins/custom-admin-settings-tab/LICENSE b/plugins/custom-admin-settings-tab/LICENSE new file mode 100644 index 000000000..f709b02e2 --- /dev/null +++ b/plugins/custom-admin-settings-tab/LICENSE @@ -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. diff --git a/plugins/custom-admin-settings-tab/VERSION b/plugins/custom-admin-settings-tab/VERSION new file mode 100644 index 000000000..9f8e9b69a --- /dev/null +++ b/plugins/custom-admin-settings-tab/VERSION @@ -0,0 +1 @@ +1.0 \ No newline at end of file diff --git a/plugins/custom-admin-settings-tab/index.php b/plugins/custom-admin-settings-tab/index.php new file mode 100644 index 000000000..ef405a7c8 --- /dev/null +++ b/plugins/custom-admin-settings-tab/index.php @@ -0,0 +1,29 @@ +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() + )); + } +} + diff --git a/plugins/custom-admin-settings-tab/js/CustomAdminSettings.js b/plugins/custom-admin-settings-tab/js/CustomAdminSettings.js new file mode 100644 index 000000000..e7ef58b5a --- /dev/null +++ b/plugins/custom-admin-settings-tab/js/CustomAdminSettings.js @@ -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'); + +}()); \ No newline at end of file diff --git a/plugins/custom-admin-settings-tab/langs/en.ini b/plugins/custom-admin-settings-tab/langs/en.ini new file mode 100644 index 000000000..7dc2831b3 --- /dev/null +++ b/plugins/custom-admin-settings-tab/langs/en.ini @@ -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" \ No newline at end of file diff --git a/plugins/custom-admin-settings-tab/langs/ru.ini b/plugins/custom-admin-settings-tab/langs/ru.ini new file mode 100644 index 000000000..71fcee232 --- /dev/null +++ b/plugins/custom-admin-settings-tab/langs/ru.ini @@ -0,0 +1,4 @@ +[SETTINGS_CUSTOM_ADMIN_CUSTOM_TAB_PLUGIN] +TAB_NAME = "Плагин" +LEGEND_CUSTOM = "Плагин (Пример)" +LABEL_PHP_VERSION = "PHP версия" \ No newline at end of file diff --git a/plugins/custom-admin-settings-tab/templates/PluginCustomAdminSettingnTab.html b/plugins/custom-admin-settings-tab/templates/PluginCustomAdminSettingnTab.html new file mode 100644 index 000000000..cab9229a7 --- /dev/null +++ b/plugins/custom-admin-settings-tab/templates/PluginCustomAdminSettingnTab.html @@ -0,0 +1,17 @@ +
+
+
+ +     + +
+
+ +
+ +
+
+
+
\ No newline at end of file diff --git a/plugins/custom-settings-tab/index.php b/plugins/custom-settings-tab/index.php index 686eb649a..67cb2332a 100644 --- a/plugins/custom-settings-tab/index.php +++ b/plugins/custom-settings-tab/index.php @@ -14,7 +14,7 @@ class CustomSettingsTabPlugin extends \RainLoop\Plugins\AbstractPlugin $this->addAjaxHook('AjaxGetCustomUserData', 'AjaxGetCustomUserData'); $this->addAjaxHook('AjaxSaveCustomUserData', 'AjaxSaveCustomUserData'); - $this->addTemplate('templates/PluginCustomSettingsTag.html'); + $this->addTemplate('templates/PluginCustomSettingsTab.html'); } /** diff --git a/plugins/custom-settings-tab/js/CustomUserSettings.js b/plugins/custom-settings-tab/js/CustomUserSettings.js index cd71c0877..ef904b51c 100644 --- a/plugins/custom-settings-tab/js/CustomUserSettings.js +++ b/plugins/custom-settings-tab/js/CustomUserSettings.js @@ -64,10 +64,10 @@ } }, 'AjaxGetCustomUserData'); - + }; - window.rl.addSettingsViewModel(CustomUserSettings, 'PluginCustomSettingsTag', + window.rl.addSettingsViewModel(CustomUserSettings, 'PluginCustomSettingsTab', 'SETTINGS_CUSTOM_PLUGIN/TAB_NAME', 'custom'); }()); \ No newline at end of file diff --git a/plugins/custom-settings-tab/templates/PluginCustomSettingsTag.html b/plugins/custom-settings-tab/templates/PluginCustomSettingsTab.html similarity index 100% rename from plugins/custom-settings-tab/templates/PluginCustomSettingsTag.html rename to plugins/custom-settings-tab/templates/PluginCustomSettingsTab.html