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:
@@ -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 /
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
20
data/Dockerfiles/sogo/navMailcowBtns.diff
Normal file
20
data/Dockerfiles/sogo/navMailcowBtns.diff
Normal 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>
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -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}
|
||||||
|
|||||||
Reference in New Issue
Block a user