From eb61563db4879deb64a46c9061779ae8289499e6 Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Tue, 31 May 2022 10:47:14 +0200 Subject: [PATCH] Merge all example plugins --- plugins/change-smtp-ehlo-message/index.php | 19 ++-- .../ContactsExampleSuggestions.php | 21 ----- plugins/contacts-suggestions-example/LICENSE | 20 ----- .../contacts-suggestions-example/index.php | 35 -------- plugins/custom-admin-settings-tab/index.php | 34 -------- .../js/CustomAdminSettings.js | 44 ---------- .../custom-admin-settings-tab/langs/en.ini | 4 - .../custom-admin-settings-tab/langs/ru.ini | 4 - plugins/custom-auth-example/LICENSE | 20 ----- plugins/custom-auth-example/index.php | 44 ---------- plugins/custom-settings-tab/LICENSE | 20 ----- plugins/custom-settings-tab/index.php | 62 ------------- .../js/CustomUserSettings.js | 81 ----------------- plugins/custom-settings-tab/langs/en.ini | 6 -- plugins/custom-settings-tab/langs/ru.ini | 6 -- .../LICENSE | 0 plugins/example/index.php | 87 +++++++++++++++++++ plugins/example/js/ExampleAdminSettings.js | 37 ++++++++ plugins/example/js/ExampleUserSettings.js | 68 +++++++++++++++ plugins/example/langs/en.json | 15 ++++ .../templates/ExampleAdminSettingsTab.html} | 6 +- .../templates/ExampleUserSettingsTab.html} | 10 +-- .../0.0.0/app/templates/Views/User/Login.html | 12 +-- 23 files changed, 230 insertions(+), 425 deletions(-) delete mode 100644 plugins/contacts-suggestions-example/ContactsExampleSuggestions.php delete mode 100644 plugins/contacts-suggestions-example/LICENSE delete mode 100644 plugins/contacts-suggestions-example/index.php delete mode 100644 plugins/custom-admin-settings-tab/index.php delete mode 100644 plugins/custom-admin-settings-tab/js/CustomAdminSettings.js delete mode 100644 plugins/custom-admin-settings-tab/langs/en.ini delete mode 100644 plugins/custom-admin-settings-tab/langs/ru.ini delete mode 100644 plugins/custom-auth-example/LICENSE delete mode 100644 plugins/custom-auth-example/index.php delete mode 100644 plugins/custom-settings-tab/LICENSE delete mode 100644 plugins/custom-settings-tab/index.php delete mode 100644 plugins/custom-settings-tab/js/CustomUserSettings.js delete mode 100644 plugins/custom-settings-tab/langs/en.ini delete mode 100644 plugins/custom-settings-tab/langs/ru.ini rename plugins/{custom-admin-settings-tab => example}/LICENSE (100%) create mode 100644 plugins/example/js/ExampleAdminSettings.js create mode 100644 plugins/example/js/ExampleUserSettings.js create mode 100644 plugins/example/langs/en.json rename plugins/{custom-admin-settings-tab/templates/PluginCustomAdminSettingsTab.html => example/templates/ExampleAdminSettingsTab.html} (64%) rename plugins/{custom-settings-tab/templates/PluginCustomSettingsTab.html => example/templates/ExampleUserSettingsTab.html} (66%) diff --git a/plugins/change-smtp-ehlo-message/index.php b/plugins/change-smtp-ehlo-message/index.php index af9fd2964..093566d6c 100644 --- a/plugins/change-smtp-ehlo-message/index.php +++ b/plugins/change-smtp-ehlo-message/index.php @@ -9,22 +9,21 @@ class ChangeSmtpEhloMessagePlugin extends \RainLoop\Plugins\AbstractPlugin public function Init() : void { - $this->addHook('smtp.credentials', 'FilterSmtpCredentials'); + $this->addHook('smtp.before-connect', 'FilterSmtpCredentials'); } /** * @param \RainLoop\Model\Account $oAccount * @param array $aSmtpCredentials */ - public function FilterSmtpCredentials($oAccount, &$aSmtpCredentials) + public function FilterSmtpCredentials(\RainLoop\Model\Account $oAccount, + \MailSo\Smtp\SmtpClient $oSmtpClient, + array &$aSmtpCredentials) { - if ($oAccount instanceof \RainLoop\Model\Account && \is_array($aSmtpCredentials)) - { - // Default: - // $aSmtpCredentials['Ehlo'] = \MailSo\Smtp\SmtpClient::EhloHelper(); - // - // or write your custom php - $aSmtpCredentials['Ehlo'] = 'localhost'; - } + // Default: + // $aSmtpCredentials['Ehlo'] = \MailSo\Smtp\SmtpClient::EhloHelper(); + // + // or write your custom php + $aSmtpCredentials['Ehlo'] = 'localhost'; } } diff --git a/plugins/contacts-suggestions-example/ContactsExampleSuggestions.php b/plugins/contacts-suggestions-example/ContactsExampleSuggestions.php deleted file mode 100644 index c87ed2f61..000000000 --- a/plugins/contacts-suggestions-example/ContactsExampleSuggestions.php +++ /dev/null @@ -1,21 +0,0 @@ -Email(), ''), - array('email@domain.com', 'name') - ); - - return $aResult; - } -} diff --git a/plugins/contacts-suggestions-example/LICENSE b/plugins/contacts-suggestions-example/LICENSE deleted file mode 100644 index 4aed64b3a..000000000 --- a/plugins/contacts-suggestions-example/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 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/contacts-suggestions-example/index.php b/plugins/contacts-suggestions-example/index.php deleted file mode 100644 index 3e505c455..000000000 --- a/plugins/contacts-suggestions-example/index.php +++ /dev/null @@ -1,35 +0,0 @@ -addHook('main.fabrica', 'MainFabrica'); - } - - /** - * @param string $sName - * @param mixed $mResult - */ - public function MainFabrica($sName, &$mResult) - { - switch ($sName) - { - case 'suggestions': - - if (!\is_array($mResult)) - { - $mResult = array(); - } - - include_once __DIR__.'/ContactsExampleSuggestions.php'; - $mResult[] = new ContactsExampleSuggestions(); - break; - } - } -} diff --git a/plugins/custom-admin-settings-tab/index.php b/plugins/custom-admin-settings-tab/index.php deleted file mode 100644 index 306db50fa..000000000 --- a/plugins/custom-admin-settings-tab/index.php +++ /dev/null @@ -1,34 +0,0 @@ -UseLangs(true); // start use langs folder - - $this->addJs('js/CustomAdminSettings.js', true); // add js file - - $this->addJsonHook('JsonAdminGetData', 'JsonAdminGetData'); - - $this->addTemplate('templates/PluginCustomAdminSettingsTab.html', true); - } - - /** - * @return array - */ - public function JsonAdminGetData() - { - return $this->jsonResponse(__FUNCTION__, array( - 'PHP' => phpversion() - )); - } -} - diff --git a/plugins/custom-admin-settings-tab/js/CustomAdminSettings.js b/plugins/custom-admin-settings-tab/js/CustomAdminSettings.js deleted file mode 100644 index 20bd0d6f5..000000000 --- a/plugins/custom-admin-settings-tab/js/CustomAdminSettings.js +++ /dev/null @@ -1,44 +0,0 @@ - -(function () { - - if (!window.rl) - { - return; - } - - /** - * @constructor - */ - function CustomAdminSettings() - { - this.php = ko.observable(''); - - this.loading = ko.observable(false); - } - - CustomAdminSettings.prototype.onBuild = function () // special function - { - var self = this; - - this.loading(true); - - rl.pluginRemoteRequest((iError, oData) => { - - self.loading(false); - - if (!iError) { - self.php(oData.Result.PHP || ''); - } - - if (rl.Enums.StorageResultType.Abort === iError) { - // show abort - } - - }, 'JsonAdminGetData'); - - }; - - rl.addSettingsViewModelForAdmin(CustomAdminSettings, 'PluginCustomAdminSettingsTab', - 'SETTINGS_CUSTOM_ADMIN_CUSTOM_TAB_PLUGIN/TAB_NAME', 'custom'); - -}()); diff --git a/plugins/custom-admin-settings-tab/langs/en.ini b/plugins/custom-admin-settings-tab/langs/en.ini deleted file mode 100644 index 3d81ab706..000000000 --- a/plugins/custom-admin-settings-tab/langs/en.ini +++ /dev/null @@ -1,4 +0,0 @@ -[SETTINGS_CUSTOM_ADMIN_CUSTOM_TAB_PLUGIN] -TAB_NAME = "Custom Extension Tab" -LEGEND_CUSTOM = "Custom Extension Tab (Example)" -LABEL_PHP_VERSION = "PHP version" diff --git a/plugins/custom-admin-settings-tab/langs/ru.ini b/plugins/custom-admin-settings-tab/langs/ru.ini deleted file mode 100644 index 71fcee232..000000000 --- a/plugins/custom-admin-settings-tab/langs/ru.ini +++ /dev/null @@ -1,4 +0,0 @@ -[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-auth-example/LICENSE b/plugins/custom-auth-example/LICENSE deleted file mode 100644 index 271342337..000000000 --- a/plugins/custom-auth-example/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 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-auth-example/index.php b/plugins/custom-auth-example/index.php deleted file mode 100644 index 242443500..000000000 --- a/plugins/custom-auth-example/index.php +++ /dev/null @@ -1,44 +0,0 @@ -addHook('login.credentials', 'FilterLoginCredentials'); - } - - /** - * @param string $sEmail - * @param string $sLogin - * @param string $sPassword - * - * @throws \RainLoop\Exceptions\ClientException - */ - public function FilterLoginCredentials(&$sEmail, &$sLogin, &$sPassword) - { - // Your custom php logic - // You may change login credentials - if ('demo@snappymail.eu' === $sEmail) - { - $sEmail = 'user@snappymail.eu'; - $sLogin = 'user@snappymail.eu'; - $sPassword = 'super-puper-password'; - } - else - { - // or throw auth exeption - throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError); - // or - throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AccountNotAllowed); - // or - throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::DomainNotAllowed); - } - } -} diff --git a/plugins/custom-settings-tab/LICENSE b/plugins/custom-settings-tab/LICENSE deleted file mode 100644 index 4aed64b3a..000000000 --- a/plugins/custom-settings-tab/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 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-settings-tab/index.php b/plugins/custom-settings-tab/index.php deleted file mode 100644 index cee8ecf12..000000000 --- a/plugins/custom-settings-tab/index.php +++ /dev/null @@ -1,62 +0,0 @@ -UseLangs(true); // start use langs folder - - $this->addJs('js/CustomUserSettings.js'); // add js file - - $this->addJsonHook('JsonGetCustomUserData', 'JsonGetCustomUserData'); - $this->addJsonHook('JsonSaveCustomUserData', 'JsonSaveCustomUserData'); - - $this->addTemplate('templates/PluginCustomSettingsTab.html'); - } - - /** - * @return array - */ - public function JsonGetCustomUserData() - { - $aSettings = $this->getUserSettings(); - - $sUserFacebook = isset($aSettings['UserFacebook']) ? $aSettings['UserFacebook'] : ''; - $sUserSkype = isset($aSettings['UserSkype']) ? $aSettings['UserSkype'] : ''; - - // or get user's data from your custom storage ( DB / LDAP / ... ). - - \sleep(1); - return $this->jsonResponse(__FUNCTION__, array( - 'UserFacebook' => $sUserFacebook, - 'UserSkype' => $sUserSkype - )); - } - - /** - * @return array - */ - public function JsonSaveCustomUserData() - { - $sUserFacebook = $this->jsonParam('UserFacebook'); - $sUserSkype = $this->jsonParam('UserSkype'); - - // or put user's data to your custom storage ( DB / LDAP / ... ). - - \sleep(1); - return $this->jsonResponse(__FUNCTION__, $this->saveUserSettings(array( - 'UserFacebook' => $sUserFacebook, - 'UserSkype' => $sUserSkype - ))); - } - -} - diff --git a/plugins/custom-settings-tab/js/CustomUserSettings.js b/plugins/custom-settings-tab/js/CustomUserSettings.js deleted file mode 100644 index 85b7f5241..000000000 --- a/plugins/custom-settings-tab/js/CustomUserSettings.js +++ /dev/null @@ -1,81 +0,0 @@ - -(function () { - - if (!window.rl) - { - return; - } - - /** - * @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.customJsonSaveData = function () - { - var self = this; - - if (this.saving()) - { - return false; - } - - this.saving(true); - - rl.pluginRemoteRequest((iError, oData) => { - - self.saving(false); - - if (!iError) - { - // true - } - else if (rl.Enums.StorageResultType.Abort === iError) { - // show abort - } - else - { - // false - } - - }, 'JsonSaveCustomUserData', { - 'UserSkype': this.userSkype(), - 'UserFacebook': this.userFacebook() - }); - }; - - CustomUserSettings.prototype.onBuild = function () // special function - { - var self = this; - - this.loading(true); - - rl.pluginRemoteRequest((iError, oData) => { - - self.loading(false); - - if (!iError) - { - self.userSkype(oData.Result.UserSkype || ''); - self.userFacebook(oData.Result.UserFacebook || ''); - } - - }, 'JsonGetCustomUserData'); - - }; - - rl.addSettingsViewModel(CustomUserSettings, 'PluginCustomSettingsTab', - 'SETTINGS_CUSTOM_PLUGIN/TAB_NAME', 'custom'); - -}()); diff --git a/plugins/custom-settings-tab/langs/en.ini b/plugins/custom-settings-tab/langs/en.ini deleted file mode 100644 index cb517b757..000000000 --- a/plugins/custom-settings-tab/langs/en.ini +++ /dev/null @@ -1,6 +0,0 @@ -[SETTINGS_CUSTOM_PLUGIN] -TAB_NAME = "Custom Extension" -LEGEND_CUSTOM = "Custom Extension (Example)" -LABEL_SKYPE = "Skype" -LABEL_FACEBOOK = "Facebook" -BUTTON_SAVE = "Save" diff --git a/plugins/custom-settings-tab/langs/ru.ini b/plugins/custom-settings-tab/langs/ru.ini deleted file mode 100644 index 6b275600c..000000000 --- a/plugins/custom-settings-tab/langs/ru.ini +++ /dev/null @@ -1,6 +0,0 @@ -[SETTINGS_CUSTOM_PLUGIN] -TAB_NAME = "Плагин" -LEGEND_CUSTOM = "Плагин (Пример)" -LABEL_SKYPE = "Skype" -LABEL_FACEBOOK = "Facebook" -BUTTON_SAVE = "Сохранить" \ No newline at end of file diff --git a/plugins/custom-admin-settings-tab/LICENSE b/plugins/example/LICENSE similarity index 100% rename from plugins/custom-admin-settings-tab/LICENSE rename to plugins/example/LICENSE diff --git a/plugins/example/index.php b/plugins/example/index.php index 40741b9cc..7bb6a2b68 100644 --- a/plugins/example/index.php +++ b/plugins/example/index.php @@ -31,6 +31,22 @@ class ExamplePlugin extends \RainLoop\Plugins\AbstractPlugin $this->addTemplate(string $sFile, bool $bAdminScope = false); $this->addTemplateHook(string $sName, string $sPlace, string $sLocalTemplateName, bool $bPrepend = false); */ + +// $this->addHook('login.credentials', 'FilterLoginCredentials'); + + + $this->UseLangs(true); // start use langs folder + + // User Settings tab + $this->addJs('js/ExampleUserSettings.js'); // add js file + $this->addJsonHook('JsonGetExampleUserData', 'JsonGetExampleUserData'); + $this->addJsonHook('JsonSaveExampleUserData', 'JsonSaveExampleUserData'); + $this->addTemplate('templates/ExampleUserSettingsTab.html'); + + // Admin Settings tab + $this->addJs('js/ExampleAdminSettings.js', true); // add js file + $this->addJsonHook('JsonAdminGetData', 'JsonAdminGetData'); + $this->addTemplate('templates/ExampleAdminSettingsTab.html', true); } /** @@ -61,6 +77,77 @@ class ExamplePlugin extends \RainLoop\Plugins\AbstractPlugin } } + public function JsonAdminGetData() + { + return $this->jsonResponse(__FUNCTION__, array( + 'PHP' => \phpversion() + )); + } + + /** + * @param string $sEmail + * @param string $sLogin + * @param string $sPassword + * + * @throws \RainLoop\Exceptions\ClientException + */ + public function FilterLoginCredentials(&$sEmail, &$sLogin, &$sPassword) + { + // Your custom php logic + // You may change login credentials + if ('demo@snappymail.eu' === $sEmail) + { + $sEmail = 'user@snappymail.eu'; + $sLogin = 'user@snappymail.eu'; + $sPassword = 'super-duper-password'; + } + else + { + // or throw auth exeption + throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError); + // or + throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AccountNotAllowed); + // or + throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::DomainNotAllowed); + } + } + + /** + * @return array + */ + public function JsonGetExampleUserData() + { + $aSettings = $this->getUserSettings(); + + $sUserFacebook = isset($aSettings['UserFacebook']) ? $aSettings['UserFacebook'] : ''; + $sUserSkype = isset($aSettings['UserSkype']) ? $aSettings['UserSkype'] : ''; + + // or get user's data from your custom storage ( DB / LDAP / ... ). + + \sleep(1); + return $this->jsonResponse(__FUNCTION__, array( + 'UserFacebook' => $sUserFacebook, + 'UserSkype' => $sUserSkype + )); + } + + /** + * @return array + */ + public function JsonSaveExampleUserData() + { + $sUserFacebook = $this->jsonParam('UserFacebook'); + $sUserSkype = $this->jsonParam('UserSkype'); + + // or put user's data to your custom storage ( DB / LDAP / ... ). + + \sleep(1); + return $this->jsonResponse(__FUNCTION__, $this->saveUserSettings(array( + 'UserFacebook' => $sUserFacebook, + 'UserSkype' => $sUserSkype + ))); + } + /* public function Config() : \RainLoop\Config\Plugin public function Description() : string diff --git a/plugins/example/js/ExampleAdminSettings.js b/plugins/example/js/ExampleAdminSettings.js new file mode 100644 index 000000000..5a52ecfda --- /dev/null +++ b/plugins/example/js/ExampleAdminSettings.js @@ -0,0 +1,37 @@ + +(rl => { if (rl) { + + class ExampleAdminSettings + { + constructor() + { + this.php = ko.observable(''); + this.loading = ko.observable(false); + } + + onBuild() + { + this.loading(true); + + rl.pluginRemoteRequest((iError, oData) => { + + this.loading(false); + + if (iError) { + console.error({ + iError: iError, + oData: oData + }); + } else { + this.php(oData.Result.PHP || ''); + } + + }, 'JsonAdminGetData'); + + } + } + + rl.addSettingsViewModelForAdmin(ExampleAdminSettings, 'ExampleAdminSettingsTab', + 'SETTINGS_EXAMPLE_ADMIN_EXAMPLE_TAB_PLUGIN/TAB_NAME', 'Example'); + +}})(window.rl); diff --git a/plugins/example/js/ExampleUserSettings.js b/plugins/example/js/ExampleUserSettings.js new file mode 100644 index 000000000..839e9e84a --- /dev/null +++ b/plugins/example/js/ExampleUserSettings.js @@ -0,0 +1,68 @@ + +(rl => { if (rl) { + + class ExampleUserSettings + { + constructor() + { + this.userSkype = ko.observable(''); + this.userFacebook = ko.observable(''); + + this.loading = ko.observable(false); + this.saving = ko.observable(false); + + this.savingOrLoading = ko.computed(() => { + return this.loading() || this.saving(); + }); + } + + exampleJsonSaveData() + { + if (!this.saving()) { + this.saving(true); + + rl.pluginRemoteRequest((iError, oData) => { + + this.saving(false); + + if (iError) { + console.error({ + iError: iError, + oData: oData + }); + } else { + console.dir({ + iError: iError, + oData: oData + }); + } + + }, 'JsonSaveExampleUserData', { + 'UserSkype': this.userSkype(), + 'UserFacebook': this.userFacebook() + }); + } + } + + onBuild() + { + this.loading(true); + + rl.pluginRemoteRequest((iError, oData) => { + + this.loading(false); + + if (!iError) { + self.userSkype(oData.Result.UserSkype || ''); + self.userFacebook(oData.Result.UserFacebook || ''); + } + + }, 'JsonGetExampleUserData'); + + } + } + + rl.addSettingsViewModel(ExampleUserSettings, 'ExampleUserSettingsTab', + 'SETTINGS_EXAMPLE_PLUGIN/TAB_NAME', 'Example'); + +}})(window.rl); diff --git a/plugins/example/langs/en.json b/plugins/example/langs/en.json new file mode 100644 index 000000000..9c5f0c84c --- /dev/null +++ b/plugins/example/langs/en.json @@ -0,0 +1,15 @@ +{ + "SETTINGS_EXAMPLE_ADMIN_EXAMPLE_TAB_PLUGIN": { + "TAB_NAME": "Example Extension Tab", + "LEGEND_EXAMPLE": "Example Extension Tab (Example)", + "LABEL_PHP_VERSION": "PHP version" + }, + "SETTINGS_EXAMPLE_PLUGIN": { + "TAB_NAME": "Example Extension", + "LEGEND_EXAMPLE": "Example Extension (Example)", + "LABEL_PHP_VERSION": "PHP version", + "LABEL_SKYPE": "Skype", + "LABEL_FACEBOOK": "Facebook", + "BUTTON_SAVE": "Save" + } +} diff --git a/plugins/custom-admin-settings-tab/templates/PluginCustomAdminSettingsTab.html b/plugins/example/templates/ExampleAdminSettingsTab.html similarity index 64% rename from plugins/custom-admin-settings-tab/templates/PluginCustomAdminSettingsTab.html rename to plugins/example/templates/ExampleAdminSettingsTab.html index cab9229a7..8fc98c5fc 100644 --- a/plugins/custom-admin-settings-tab/templates/PluginCustomAdminSettingsTab.html +++ b/plugins/example/templates/ExampleAdminSettingsTab.html @@ -1,17 +1,17 @@