diff --git a/integrations/nextcloud/snappymail/app/themes/Nextcloud/images/preview.png b/integrations/nextcloud/snappymail/app/themes/Nextcloud/images/preview.png
new file mode 100644
index 000000000..4e633cc1f
Binary files /dev/null and b/integrations/nextcloud/snappymail/app/themes/Nextcloud/images/preview.png differ
diff --git a/integrations/nextcloud/snappymail/app/themes/Nextcloud/styles.css b/integrations/nextcloud/snappymail/app/themes/Nextcloud/styles.css
new file mode 100644
index 000000000..ed11cba1f
--- /dev/null
+++ b/integrations/nextcloud/snappymail/app/themes/Nextcloud/styles.css
@@ -0,0 +1,51 @@
+
+:root {
+ /* MAIN */
+ --main-color: #333;
+ --main-bg-color: transparent;
+ --main-bg-image: none;
+
+ /* LOADING */
+ --loading-color: #000;
+
+ /* LOGIN */
+ --login-color: #eee;
+ --login-bg-color: rgba(0,0,0,0.5);
+ --login-box-shadow: none;
+ --login-border: none;
+ --login-border-radius: 7px;
+
+ /* MENU */
+ --dropdown-menu-color: #333;
+ --dropdown-menu-bg-color: #fff;
+ --dropdown-menu-hover-bg-color: #757575;
+ --dropdown-menu-hover-color: #eee;
+ --dropdown-menu-disable-color: #999;
+
+ /* FOLDERS */
+ --folders-color: #333;
+ --folders-disabled-color: #999;
+ --folders-selected-color: #eee;
+ --folders-selected-bg-color: rgba(0,0,0,0.5);
+ --folders-focused-color: #eee;
+ --folders-focused-bg-color: rgba(0,0,0,0.7);
+ --folders-hover-color: #eee;
+ --folders-hover-bg-color: rgba(0,0,0,0.5);
+ --folders-drop-color: #eee;
+ --folders-drop-bg-color: rgba(0,0,0,0.5);
+
+ /* SETTINGS */
+ --settings-menu-color: #333;
+ --settings-menu-selected-color: #eee;
+ --settings-menu-selected-bg-color: rgba(0,0,0,0.5);
+ --settings-menu-hover-color: #eee;
+ --settings-menu-hover-bg-color: rgba(0,0,0,0.5);
+
+ /* MESSAGE LIST */
+ --message-list-toolbar-bg-color: #eee;
+}
+
+.thm-message-list-top-toolbar, .thm-message-list-bottom-toolbar {
+ background-image: linear-gradient(to bottom, #f4f4f4, #dfdfdf) !important;
+ background-repeat: repeat-x !important;
+}
diff --git a/integrations/nextcloud/snappymail/appinfo/routes.php b/integrations/nextcloud/snappymail/appinfo/routes.php
index a19b5a4f3..a502b39e9 100755
--- a/integrations/nextcloud/snappymail/appinfo/routes.php
+++ b/integrations/nextcloud/snappymail/appinfo/routes.php
@@ -18,13 +18,13 @@ return [
'verb' => 'POST'
],
[
- 'name' => 'ajax#setPersonal',
- 'url' => '/ajax/personal.php',
+ 'name' => 'fetch#setPersonal',
+ 'url' => '/fetch/personal.php',
'verb' => 'POST'
],
[
- 'name' => 'ajax#setAdmin',
- 'url' => '/ajax/admin.php',
+ 'name' => 'fetch#setAdmin',
+ 'url' => '/fetch/admin.php',
'verb' => 'POST'
]
]
diff --git a/integrations/nextcloud/snappymail/js/snappymail.js b/integrations/nextcloud/snappymail/js/snappymail.js
index b811ec868..52603eae1 100644
--- a/integrations/nextcloud/snappymail/js/snappymail.js
+++ b/integrations/nextcloud/snappymail/js/snappymail.js
@@ -7,11 +7,9 @@
*/
// Do the following things once the document is fully loaded.
-document.onreadystatechange = function () {
- if (document.readyState === 'complete') {
- watchIFrameTitle();
- }
-}
+document.onreadystatechange = () => {
+ (document.readyState === 'complete') && watchIFrameTitle();
+};
// The SnappyMail application is already configured to modify the
element
// of its root document with the number of unread messages in the inbox.
@@ -31,7 +29,7 @@ function watchIFrameTitle() {
childList: true,
subtree: true
};
- let observer = new MutationObserver(function(mutations) {
+ let observer = new MutationObserver(mutations => {
let title = mutations[0].target.innerText;
if (title) {
let matches = title.match(/\(([0-9]+)\)/);
@@ -45,7 +43,7 @@ function watchIFrameTitle() {
observer.observe(target, config);
}
-function SnappyMailFormHelper(sID, sAjaxFile, fCallback)
+function SnappyMailFormHelper(sID, sFetchFile, fCallback)
{
try
{
@@ -56,49 +54,33 @@ function SnappyMailFormHelper(sID, sAjaxFile, fCallback)
oDesc = oForm.querySelector('.snappymail-result-desc')
;
- oForm.addEventListener('submit', (...args) => {
- console.dir({args:args});
- return false
- });
-
- oSubmit.onclick = oEvent => {
-
+ oForm.addEventListener('submit', oEvent => {
oEvent.preventDefault();
- oForm.classList.add('snappymail-ajax')
+ oForm.classList.add('snappymail-fetch')
oForm.classList.remove('snappymail-error')
oForm.classList.remove('snappymail-success')
oDesc.textContent = '';
oSubmit.textContent = '...';
- fetch(OC.filePath('snappymail', 'ajax', sAjaxFile), {
+ fetch(OC.filePath('snappymail', 'fetch', sFetchFile), {
mode: 'same-origin',
cache: 'no-cache',
redirect: 'error',
referrerPolicy: 'no-referrer',
credentials: 'same-origin',
method: 'POST',
-/*
- headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({
- 'snappymail-email': document.getElementById('snappymail-email').value,
- 'snappymail-password': document.getElementById('snappymail-password').value
- })
-*/
headers: {},
body: new FormData(oForm)
})
.then(response => response.json())
.then(oData => {
- let bResult = false;
- oForm.classList.remove('snappymail-ajax');
+ let bResult = 'success' === oData?.status;
+ oForm.classList.remove('snappymail-fetch');
oSubmit.textContent = sSubmitValue;
- if (oData) {
- bResult = 'success' === oData.status;
- if (oData.Message) {
- oDesc.textContent = t('snappymail', oData.Message);
- }
+ if (oData?.Message) {
+ oDesc.textContent = t('snappymail', oData.Message);
}
if (bResult) {
oForm.classList.add('snappymail-success');
@@ -108,13 +90,11 @@ function SnappyMailFormHelper(sID, sAjaxFile, fCallback)
oDesc.textContent = t('snappymail', 'Error');
}
}
- if (fCallback) {
- fCallback(bResult, oData);
- }
+ fCallback?.(bResult, oData);
});
return false;
- };
+ });
}
catch(e) {
console.error(e);
diff --git a/integrations/nextcloud/snappymail/lib/AppInfo/Application.php b/integrations/nextcloud/snappymail/lib/AppInfo/Application.php
index d137e2ef8..a45a2fbdd 100644
--- a/integrations/nextcloud/snappymail/lib/AppInfo/Application.php
+++ b/integrations/nextcloud/snappymail/lib/AppInfo/Application.php
@@ -3,7 +3,7 @@
namespace OCA\SnappyMail\AppInfo;
use OCA\SnappyMail\Util\SnappyMailHelper;
-use OCA\SnappyMail\Controller\AjaxController;
+use OCA\SnappyMail\Controller\FetchController;
use OCA\SnappyMail\Controller\PageController;
use OCP\AppFramework\App;
@@ -47,8 +47,8 @@ class Application extends App implements IBootstrap
);
$container->registerService(
- 'AjaxController', function($c) {
- return new AjaxController(
+ 'FetchController', function($c) {
+ return new FetchController(
$c->query('AppName'),
$c->query('Request'),
$c->getServer()->getAppManager(),
diff --git a/integrations/nextcloud/snappymail/lib/Controller/AjaxController.php b/integrations/nextcloud/snappymail/lib/Controller/FetchController.php
similarity index 98%
rename from integrations/nextcloud/snappymail/lib/Controller/AjaxController.php
rename to integrations/nextcloud/snappymail/lib/Controller/FetchController.php
index d350e1f3c..9c3216bd6 100644
--- a/integrations/nextcloud/snappymail/lib/Controller/AjaxController.php
+++ b/integrations/nextcloud/snappymail/lib/Controller/FetchController.php
@@ -11,7 +11,7 @@ use OCP\IConfig;
use OCP\IL10N;
use OCP\IRequest;
-class AjaxController extends Controller {
+class FetchController extends Controller {
private $config;
private $appManager;
diff --git a/integrations/nextcloud/snappymail/lib/Settings/PersonalSettings.php b/integrations/nextcloud/snappymail/lib/Settings/PersonalSettings.php
index 318c0befa..0cf07befa 100644
--- a/integrations/nextcloud/snappymail/lib/Settings/PersonalSettings.php
+++ b/integrations/nextcloud/snappymail/lib/Settings/PersonalSettings.php
@@ -9,32 +9,28 @@ class PersonalSettings implements ISettings
{
private $config;
- public function __construct(IConfig $config) {
+ public function __construct(IConfig $config)
+ {
$this->config = $config;
}
- public function getForm() {
+ public function getForm()
+ {
$uid = \OC::$server->getUserSession()->getUser()->getUID();
-
- $keys = [
- 'snappymail-email',
- 'snappymail-password'
+ $parameters = [
+ 'snappymail-email' => $this->config->getUserValue($uid, 'snappymail', 'snappymail-email'),
+ 'snappymail-password' => $this->config->getUserValue($uid, 'snappymail', 'snappymail-password') ? '******' : ''
];
-
- $parameters = [];
- foreach ($keys as $k) {
- $v = $this->config->getUserValue($uid, 'snappymail', $k);
- $parameters[$k] = $v;
- }
-
return new TemplateResponse('snappymail', 'personal_settings', $parameters, '');
}
- public function getSection() {
+ public function getSection()
+ {
return 'additional';
}
- public function getPriority() {
+ public function getPriority()
+ {
return 50;
}