1
0
mirror of https://github.com/mailcow/mailcow-dockerized.git synced 2025-12-20 21:31:32 +00:00

[SOGo] Add mailcow Buttons to SOGo navbar

This commit is contained in:
FreddleSpl0it
2025-01-15 16:15:25 +01:00
parent 8048e0a53c
commit 1e70a20188
5 changed files with 26 additions and 43 deletions

View File

@@ -48,6 +48,7 @@ COPY syslog-ng.conf /etc/syslog-ng/syslog-ng.conf
COPY syslog-ng-redis_slave.conf /etc/syslog-ng/syslog-ng-redis_slave.conf COPY syslog-ng-redis_slave.conf /etc/syslog-ng/syslog-ng-redis_slave.conf
COPY supervisord.conf /etc/supervisor/supervisord.conf COPY supervisord.conf /etc/supervisor/supervisord.conf
COPY acl.diff /acl.diff COPY acl.diff /acl.diff
COPY navMailcowBtns.diff /navMailcowBtns.diff
COPY stop-supervisor.sh /usr/local/sbin/stop-supervisor.sh COPY stop-supervisor.sh /usr/local/sbin/stop-supervisor.sh
COPY docker-entrypoint.sh / COPY docker-entrypoint.sh /

View File

@@ -136,6 +136,10 @@ chmod 600 /var/lib/sogo/GNUstep/Defaults/sogod.plist
# fi # fi
#fi #fi
if patch -R -sfN --dry-run /usr/lib/GNUstep/SOGo/Templates/UIxTopnavToolbar.wox < /navMailcowBtns.diff > /dev/null; then
patch -R /usr/lib/GNUstep/SOGo/Templates/UIxTopnavToolbar.wox < /navMailcowBtns.diff;
fi
# Copy logo, if any # Copy logo, if any
[[ -f /etc/sogo/sogo-full.svg ]] && cp /etc/sogo/sogo-full.svg /usr/lib/GNUstep/SOGo/WebServerResources/img/sogo-full.svg [[ -f /etc/sogo/sogo-full.svg ]] && cp /etc/sogo/sogo-full.svg /usr/lib/GNUstep/SOGo/WebServerResources/img/sogo-full.svg

View File

@@ -0,0 +1,20 @@
59,65d58
< ng-show="::!activeUser.isSuperUser"
< var:ng-click="navButtonClick"
< ng-href="/user">
< <md-icon>build</md-icon>
< <md-tooltip><var:string label:value="mailcow"/></md-tooltip>
< </md-button>
< <md-button class="md-icon-button"
83c76
< onclick="document.getElementById('mc_logout').setAttribute('action', '/'); document.getElementById('mc_logout').submit();"
---
> ng-show="::activeUser.path.logoff.length"
85c78
< ng-href="#">
---
> ng-href="{{::activeUser.path.logoff}}">
89,91d81
< <form method="POST" id="mc_logout" action="user">
< <input type="hidden" name="logout" value="1">
< </form>

View File

@@ -4,48 +4,6 @@ document.addEventListener('DOMContentLoaded', function () {
if (loginForm) { if (loginForm) {
window.location.href = '/user'; window.location.href = '/user';
} }
angularReady = false;
function observe() {
angularReady = toolbarExists();
if (angularReady && !mcElementsExists()) addMCElements();
const observer = new MutationObserver(function(mutations) {
if (!angularReady) {
mutations.forEach(function(mutation) {
if (mutation.addedNodes.length > 0) angularReady = toolbarExists();
});
} else if (angularReady && !mcElementsExists()) {
addMCElements();
}
});
const targetNode = document.body;
const config = { childList: true, subtree: true };
observer.observe(targetNode, config);
}
function toolbarExists() {
const toolbarElement = document.body.querySelector('md-toolbar');
if (toolbarElement)
return true;
else
return false;
}
function mcElementsExists() {
if (document.getElementById("mc_backlink"))
return true;
else
return false;
}
function addMCElements() {
const toolbarElement = document.body.querySelector('.md-toolbar-tools.sg-toolbar-group-last.layout-align-end-center.layout-row');
var htmlCode = '<a id="mc_backlink" class="md-icon-button md-button md-ink-ripple" aria-label="mailcow" href="/user" aria-hidden="false" tabindex="-1">' +
'<md-icon class="material-icons" role="img" aria-label="build">build</md-icon>' +
'</a>';
toolbarElement.insertAdjacentHTML('beforeend', htmlCode);
}
observe();
}); });
// Custom SOGo JS // Custom SOGo JS

View File

@@ -198,7 +198,7 @@ services:
- phpfpm - phpfpm
sogo-mailcow: sogo-mailcow:
image: mailcow/sogo:nightly-20241205 image: mailcow/sogo:nightly-20250115
environment: environment:
- DBNAME=${DBNAME} - DBNAME=${DBNAME}
- DBUSER=${DBUSER} - DBUSER=${DBUSER}