mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Nextcloud rename Ajax to Fetch and added Nextcloud theme for #96
This commit is contained in:
parent
63ef2cc724
commit
47c1071f3f
7 changed files with 84 additions and 57 deletions
Binary file not shown.
|
After Width: | Height: | Size: 160 B |
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
@ -18,13 +18,13 @@ return [
|
||||||
'verb' => 'POST'
|
'verb' => 'POST'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'ajax#setPersonal',
|
'name' => 'fetch#setPersonal',
|
||||||
'url' => '/ajax/personal.php',
|
'url' => '/fetch/personal.php',
|
||||||
'verb' => 'POST'
|
'verb' => 'POST'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'ajax#setAdmin',
|
'name' => 'fetch#setAdmin',
|
||||||
'url' => '/ajax/admin.php',
|
'url' => '/fetch/admin.php',
|
||||||
'verb' => 'POST'
|
'verb' => 'POST'
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Do the following things once the document is fully loaded.
|
// Do the following things once the document is fully loaded.
|
||||||
document.onreadystatechange = function () {
|
document.onreadystatechange = () => {
|
||||||
if (document.readyState === 'complete') {
|
(document.readyState === 'complete') && watchIFrameTitle();
|
||||||
watchIFrameTitle();
|
};
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The SnappyMail application is already configured to modify the <title> element
|
// The SnappyMail application is already configured to modify the <title> element
|
||||||
// of its root document with the number of unread messages in the inbox.
|
// of its root document with the number of unread messages in the inbox.
|
||||||
|
|
@ -31,7 +29,7 @@ function watchIFrameTitle() {
|
||||||
childList: true,
|
childList: true,
|
||||||
subtree: true
|
subtree: true
|
||||||
};
|
};
|
||||||
let observer = new MutationObserver(function(mutations) {
|
let observer = new MutationObserver(mutations => {
|
||||||
let title = mutations[0].target.innerText;
|
let title = mutations[0].target.innerText;
|
||||||
if (title) {
|
if (title) {
|
||||||
let matches = title.match(/\(([0-9]+)\)/);
|
let matches = title.match(/\(([0-9]+)\)/);
|
||||||
|
|
@ -45,7 +43,7 @@ function watchIFrameTitle() {
|
||||||
observer.observe(target, config);
|
observer.observe(target, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
function SnappyMailFormHelper(sID, sAjaxFile, fCallback)
|
function SnappyMailFormHelper(sID, sFetchFile, fCallback)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -56,49 +54,33 @@ function SnappyMailFormHelper(sID, sAjaxFile, fCallback)
|
||||||
oDesc = oForm.querySelector('.snappymail-result-desc')
|
oDesc = oForm.querySelector('.snappymail-result-desc')
|
||||||
;
|
;
|
||||||
|
|
||||||
oForm.addEventListener('submit', (...args) => {
|
oForm.addEventListener('submit', oEvent => {
|
||||||
console.dir({args:args});
|
|
||||||
return false
|
|
||||||
});
|
|
||||||
|
|
||||||
oSubmit.onclick = oEvent => {
|
|
||||||
|
|
||||||
oEvent.preventDefault();
|
oEvent.preventDefault();
|
||||||
|
|
||||||
oForm.classList.add('snappymail-ajax')
|
oForm.classList.add('snappymail-fetch')
|
||||||
oForm.classList.remove('snappymail-error')
|
oForm.classList.remove('snappymail-error')
|
||||||
oForm.classList.remove('snappymail-success')
|
oForm.classList.remove('snappymail-success')
|
||||||
|
|
||||||
oDesc.textContent = '';
|
oDesc.textContent = '';
|
||||||
oSubmit.textContent = '...';
|
oSubmit.textContent = '...';
|
||||||
|
|
||||||
fetch(OC.filePath('snappymail', 'ajax', sAjaxFile), {
|
fetch(OC.filePath('snappymail', 'fetch', sFetchFile), {
|
||||||
mode: 'same-origin',
|
mode: 'same-origin',
|
||||||
cache: 'no-cache',
|
cache: 'no-cache',
|
||||||
redirect: 'error',
|
redirect: 'error',
|
||||||
referrerPolicy: 'no-referrer',
|
referrerPolicy: 'no-referrer',
|
||||||
credentials: 'same-origin',
|
credentials: 'same-origin',
|
||||||
method: 'POST',
|
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: {},
|
headers: {},
|
||||||
body: new FormData(oForm)
|
body: new FormData(oForm)
|
||||||
})
|
})
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(oData => {
|
.then(oData => {
|
||||||
let bResult = false;
|
let bResult = 'success' === oData?.status;
|
||||||
oForm.classList.remove('snappymail-ajax');
|
oForm.classList.remove('snappymail-fetch');
|
||||||
oSubmit.textContent = sSubmitValue;
|
oSubmit.textContent = sSubmitValue;
|
||||||
if (oData) {
|
if (oData?.Message) {
|
||||||
bResult = 'success' === oData.status;
|
oDesc.textContent = t('snappymail', oData.Message);
|
||||||
if (oData.Message) {
|
|
||||||
oDesc.textContent = t('snappymail', oData.Message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (bResult) {
|
if (bResult) {
|
||||||
oForm.classList.add('snappymail-success');
|
oForm.classList.add('snappymail-success');
|
||||||
|
|
@ -108,13 +90,11 @@ function SnappyMailFormHelper(sID, sAjaxFile, fCallback)
|
||||||
oDesc.textContent = t('snappymail', 'Error');
|
oDesc.textContent = t('snappymail', 'Error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fCallback) {
|
fCallback?.(bResult, oData);
|
||||||
fCallback(bResult, oData);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
namespace OCA\SnappyMail\AppInfo;
|
namespace OCA\SnappyMail\AppInfo;
|
||||||
|
|
||||||
use OCA\SnappyMail\Util\SnappyMailHelper;
|
use OCA\SnappyMail\Util\SnappyMailHelper;
|
||||||
use OCA\SnappyMail\Controller\AjaxController;
|
use OCA\SnappyMail\Controller\FetchController;
|
||||||
use OCA\SnappyMail\Controller\PageController;
|
use OCA\SnappyMail\Controller\PageController;
|
||||||
|
|
||||||
use OCP\AppFramework\App;
|
use OCP\AppFramework\App;
|
||||||
|
|
@ -47,8 +47,8 @@ class Application extends App implements IBootstrap
|
||||||
);
|
);
|
||||||
|
|
||||||
$container->registerService(
|
$container->registerService(
|
||||||
'AjaxController', function($c) {
|
'FetchController', function($c) {
|
||||||
return new AjaxController(
|
return new FetchController(
|
||||||
$c->query('AppName'),
|
$c->query('AppName'),
|
||||||
$c->query('Request'),
|
$c->query('Request'),
|
||||||
$c->getServer()->getAppManager(),
|
$c->getServer()->getAppManager(),
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ use OCP\IConfig;
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
|
|
||||||
class AjaxController extends Controller {
|
class FetchController extends Controller {
|
||||||
private $config;
|
private $config;
|
||||||
private $appManager;
|
private $appManager;
|
||||||
|
|
||||||
|
|
@ -9,32 +9,28 @@ class PersonalSettings implements ISettings
|
||||||
{
|
{
|
||||||
private $config;
|
private $config;
|
||||||
|
|
||||||
public function __construct(IConfig $config) {
|
public function __construct(IConfig $config)
|
||||||
|
{
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getForm() {
|
public function getForm()
|
||||||
|
{
|
||||||
$uid = \OC::$server->getUserSession()->getUser()->getUID();
|
$uid = \OC::$server->getUserSession()->getUser()->getUID();
|
||||||
|
$parameters = [
|
||||||
$keys = [
|
'snappymail-email' => $this->config->getUserValue($uid, 'snappymail', 'snappymail-email'),
|
||||||
'snappymail-email',
|
'snappymail-password' => $this->config->getUserValue($uid, 'snappymail', 'snappymail-password') ? '******' : ''
|
||||||
'snappymail-password'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
$parameters = [];
|
|
||||||
foreach ($keys as $k) {
|
|
||||||
$v = $this->config->getUserValue($uid, 'snappymail', $k);
|
|
||||||
$parameters[$k] = $v;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new TemplateResponse('snappymail', 'personal_settings', $parameters, '');
|
return new TemplateResponse('snappymail', 'personal_settings', $parameters, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSection() {
|
public function getSection()
|
||||||
|
{
|
||||||
return 'additional';
|
return 'additional';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPriority() {
|
public function getPriority()
|
||||||
|
{
|
||||||
return 50;
|
return 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue