diff --git a/integrations/nextcloud/snappymail/app/themes/Nextcloud/styles.css b/integrations/nextcloud/snappymail/app/themes/Nextcloud/styles.css index 151e8ce8b..6bc593886 100644 --- a/integrations/nextcloud/snappymail/app/themes/Nextcloud/styles.css +++ b/integrations/nextcloud/snappymail/app/themes/Nextcloud/styles.css @@ -94,15 +94,15 @@ background-image: linear-gradient(to bottom, #f4f4f4, #dfdfdf) !important; background-repeat: repeat-x !important; } -#V-AdminPane > .b-toolbar, +#V-AdminPane > .b-toolbar { + color: var(--main-color); + text-shadow: none; +} #V-PopupsCompose header { background-color: #0082c9; background-image: linear-gradient(40deg, #0082c9 0%, #30b6ff 100%); color: #fff; } -#V-AdminPane > .b-toolbar h4::before { - content: 'Nextcloud: '; -} .messageList, .messageView { border-color: var(--color-border); diff --git a/integrations/nextcloud/snappymail/css/embed.css b/integrations/nextcloud/snappymail/css/embed.css index dda1874ef..912d02b37 100644 --- a/integrations/nextcloud/snappymail/css/embed.css +++ b/integrations/nextcloud/snappymail/css/embed.css @@ -1,6 +1,9 @@ /* This stylesheet is used when SnappyMail runs in embed mode. */ +#content.app-snappymail { + max-height: 100%; +} #content #rl-app { position: relative; min-width: 100%; @@ -28,7 +31,8 @@ This stylesheet is used when SnappyMail runs in embed mode. #content[class*="app-"] #rl-app textarea, #content[class*="app-"] #rl-app input, #content[class*="app-"] #rl-app .input-block-level, -#content[class*="app-"] #rl-app .icon-spinner +#content[class*="app-"] #rl-app .icon-spinner, +#content[class*="app-"] #rl-app #V-AdminPane #rl-settings-subscreen { box-sizing: border-box; } @@ -37,6 +41,10 @@ This stylesheet is used when SnappyMail runs in embed mode. min-height: 100%; } +#V-AdminPane .btn-logout { + display: none; +} + #rl-app select, #rl-app input { diff --git a/integrations/nextcloud/snappymail/lib/Controller/PageController.php b/integrations/nextcloud/snappymail/lib/Controller/PageController.php index b78af3b38..d8803b6bc 100644 --- a/integrations/nextcloud/snappymail/lib/Controller/PageController.php +++ b/integrations/nextcloud/snappymail/lib/Controller/PageController.php @@ -74,7 +74,13 @@ class PageController extends Controller */ private static function index_embed() { - if (!empty($_SERVER['QUERY_STRING'])) { +/* + $oConfig = \RainLoop\Api::Config(); + $bAdmin = empty($_SERVER['QUERY_STRING']) || $oConfig->Get('security', 'admin_panel_key', 'admin') != $_SERVER['QUERY_STRING']; +*/ + $bAdmin = !empty($_SERVER['QUERY_STRING']) && 'admin' == $_SERVER['QUERY_STRING']; + + if (!$bAdmin && !empty($_SERVER['QUERY_STRING'])) { SnappyMailHelper::startApp(true); } @@ -84,7 +90,7 @@ class PageController extends Controller SnappyMailHelper::startApp(); $oConfig = \RainLoop\Api::Config(); - $oActions = \RainLoop\Api::Actions(); + $oActions = $bAdmin ? new \RainLoop\ActionsAdmin() : \RainLoop\Api::Actions(); $oHttp = \MailSo\Base\Http::SingletonInstance(); $oServiceActions = new \RainLoop\ServiceActions($oHttp, $oActions); $sAppJsMin = $oConfig->Get('labs', 'use_app_debug_js', false) ? '' : '.min'; @@ -96,23 +102,24 @@ class PageController extends Controller // \RainLoop\Service::setCSP($sScriptNonce); $params = [ + 'Admin' => $bAdmin ? 1 : 0, 'LoadingDescriptionEsc' => \htmlspecialchars($oConfig->Get('webmail', 'loading_description', 'SnappyMail'), ENT_QUOTES|ENT_IGNORE, 'UTF-8'), - 'BaseTemplates' => \RainLoop\Utils::ClearHtmlOutput($oServiceActions->compileTemplates(false)), + 'BaseTemplates' => \RainLoop\Utils::ClearHtmlOutput($oServiceActions->compileTemplates($bAdmin)), 'BaseAppBootScript' => \file_get_contents(APP_VERSION_ROOT_PATH.'static/js'.($sAppJsMin ? '/min' : '').'/boot'.$sAppJsMin.'.js'), 'BaseAppBootScriptNonce' => $sScriptNonce, - 'BaseLanguage' => $oActions->compileLanguage($sLanguage, false), + 'BaseLanguage' => $oActions->compileLanguage($sLanguage, $bAdmin), 'BaseAppBootCss' => \file_get_contents(APP_VERSION_ROOT_PATH.'static/css/boot'.$sAppCssMin.'.css'), - 'BaseAppThemeCssLink' => $oActions->ThemeLink(false), + 'BaseAppThemeCssLink' => $oActions->ThemeLink($bAdmin), 'BaseAppThemeCss' => \preg_replace( '/\\s*([:;{},]+)\\s*/s', '$1', - $oActions->compileCss($oActions->GetTheme(false), false) + $oActions->compileCss($oActions->GetTheme($bAdmin), $bAdmin) ) ]; // Nextcloud html encodes, so addHeader('style') is not possible // \OCP\Util::addHeader('style', ['id'=>'app-boot-css'], \file_get_contents(APP_VERSION_ROOT_PATH.'static/css/boot'.$sAppCssMin.'.css')); - \OCP\Util::addHeader('link', ['type'=>'text/css','rel'=>'stylesheet','href'=>\RainLoop\Utils::WebStaticPath('css/app'.$sAppCssMin.'.css')], ''); + \OCP\Util::addHeader('link', ['type'=>'text/css','rel'=>'stylesheet','href'=>\RainLoop\Utils::WebStaticPath('css/'.($bAdmin?'admin':'app').$sAppCssMin.'.css')], ''); // \OCP\Util::addHeader('style', ['id'=>'app-theme-style','data-href'=>$params['BaseAppThemeCssLink']], $params['BaseAppThemeCss']); $response = new TemplateResponse('snappymail', 'index_embed', $params); diff --git a/integrations/nextcloud/snappymail/lib/Settings/AdminSettings.php b/integrations/nextcloud/snappymail/lib/Settings/AdminSettings.php index 14be42c92..d810d85e3 100644 --- a/integrations/nextcloud/snappymail/lib/Settings/AdminSettings.php +++ b/integrations/nextcloud/snappymail/lib/Settings/AdminSettings.php @@ -29,7 +29,9 @@ class AdminSettings implements ISettings } $uid = \OC::$server->getUserSession()->getUser()->getUID(); if (\OC_User::isAdminUser($uid)) { - $parameters['snappymail-admin-panel-link'] = SnappyMailHelper::getAppUrl().'?admin'; +// $parameters['snappymail-admin-panel-link'] = SnappyMailHelper::getAppUrl().'?admin'; + $parameters['snappymail-admin-panel-link'] = + \OC::$server->getURLGenerator()->linkToRoute('snappymail.page.index').'?admin'; } \OCA\SnappyMail\Util\SnappyMailHelper::loadApp(); diff --git a/integrations/nextcloud/snappymail/lib/Util/SnappyMailHelper.php b/integrations/nextcloud/snappymail/lib/Util/SnappyMailHelper.php index be4f5bcdd..1d5cb8f91 100644 --- a/integrations/nextcloud/snappymail/lib/Util/SnappyMailHelper.php +++ b/integrations/nextcloud/snappymail/lib/Util/SnappyMailHelper.php @@ -57,26 +57,28 @@ class SnappyMailHelper ) { $aDomains = \array_unique([ 'nextcloud', - \preg_replace('/:\d+/$','',$_SERVER['HTTP_HOST']), + \preg_replace('/:\d+$/','',$_SERVER['HTTP_HOST']), $_SERVER['SERVER_NAME'], \gethostname() ]); foreach ($aDomains as $i => $sDomain) { - $oProvider = \RainLoop\Api::Actions()->DomainProvider(); - $oDomain = $oProvider->Load($sDomain); - if (!($oDomain instanceof \RainLoop\Model\Domain)) { - $oDomain = new \RainLoop\Model\Domain($sDomain); - $bShortLogin = !$i; - $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::NONE; - $oDomain->SetConfig( - 'localhost', 143, $iSecurityType, $bShortLogin, - true, 'localhost', 4190, $iSecurityType, - 'localhost', 25, $iSecurityType, $bShortLogin, true, false, false, - ''); - $oProvider->Save($oDomain); - if (!$oConfig->Get('login', 'default_domain', '')) { - $oConfig->Set('login', 'default_domain', 'nextcloud'); - $bSave = true; + if ($sDomain) { + $oProvider = \RainLoop\Api::Actions()->DomainProvider(); + $oDomain = $oProvider->Load($sDomain); + if (!($oDomain instanceof \RainLoop\Model\Domain)) { + $oDomain = new \RainLoop\Model\Domain($sDomain); + $bShortLogin = !$i; + $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::NONE; + $oDomain->SetConfig( + 'localhost', 143, $iSecurityType, $bShortLogin, + true, 'localhost', 4190, $iSecurityType, + 'localhost', 25, $iSecurityType, $bShortLogin, true, false, false, + ''); + $oProvider->Save($oDomain); + if (!$oConfig->Get('login', 'default_domain', '')) { + $oConfig->Set('login', 'default_domain', 'nextcloud'); + $bSave = true; + } } } } @@ -93,8 +95,10 @@ class SnappyMailHelper $oActions = \RainLoop\Api::Actions(); $oConfig = \RainLoop\Api::Config(); if (isset($_GET[$oConfig->Get('security', 'admin_panel_key', 'admin')])) { -/* // TODO: check Nextcloud group if allowed - if ($oConfig->Get('security', 'allow_admin_panel', true) && !$oActions->IsAdminLoggined(false)) { + if ($oConfig->Get('security', 'allow_admin_panel', true) + && \OC_User::isAdminUser(\OC::$server->getUserSession()->getUser()->getUID()) + && !$oActions->IsAdminLoggined(false) + ) { $sRand = \MailSo\Base\Utils::Sha1Rand(); if ($oActions->Cacher(null, true)->Set(\RainLoop\KeyPathHelper::SessionAdminKey($sRand), \time())) { $sToken = \RainLoop\Utils::EncodeKeyValuesQ(array('token', $sRand)); @@ -102,7 +106,6 @@ class SnappyMailHelper \RainLoop\Utils::SetCookie('smadmin', $sToken); } } -*/ } else if (!$oActions->getMainAccountFromToken(false)) { $aCredentials = SnappyMailHelper::getLoginCredentials(); if ($aCredentials[0] && $aCredentials[1]) { diff --git a/integrations/nextcloud/snappymail/templates/admin-local.php b/integrations/nextcloud/snappymail/templates/admin-local.php index f48fb5273..19870127f 100755 --- a/integrations/nextcloud/snappymail/templates/admin-local.php +++ b/integrations/nextcloud/snappymail/templates/admin-local.php @@ -6,7 +6,7 @@

- + t('Go to SnappyMail Webmail admin panel')); ?> diff --git a/integrations/nextcloud/snappymail/templates/index_embed.php b/integrations/nextcloud/snappymail/templates/index_embed.php index e1288ff56..c51f8e355 100755 --- a/integrations/nextcloud/snappymail/templates/index_embed.php +++ b/integrations/nextcloud/snappymail/templates/index_embed.php @@ -1,6 +1,6 @@ -

+
diff --git a/plugins/nextcloud/js/message.js b/plugins/nextcloud/js/message.js index a828bf804..43432c754 100644 --- a/plugins/nextcloud/js/message.js +++ b/plugins/nextcloud/js/message.js @@ -123,6 +123,7 @@ if (VEVENT) { VEVENT.rawText = text; VEVENT.isCancelled = () => VEVENT.STATUS?.includes('CANCELLED'); + VEVENT.isConfirmed = () => VEVENT.STATUS?.includes('CONFIRMED'); VEVENT.shouldReply = () => VEVENT.METHOD?.includes('REPLY'); console.dir({ isCancelled: VEVENT.isCancelled(), @@ -138,6 +139,7 @@ }); let template = document.getElementById('MailMessageView'); + let cfg = rl.settings.get('Nextcloud'); const attachmentsControls = template.content.querySelector('.attachmentsControls'); if (attachmentsControls) { @@ -149,14 +151,29 @@ `)); // https://github.com/nextcloud/calendar/issues/4684 - let cfg = rl.settings.get('Nextcloud'); if (cfg.CalDAV) { attachmentsControls.append(Element.fromHTML(` `)); } } - +/* + // https://github.com/the-djmaze/snappymail/issues/592 + if (cfg.CalDAV) { + const attachmentsPlace = template.content.querySelector('.attachmentsPlace'); + attachmentsPlace.after(Element.fromHTML(` + + + + + + + + + +
Summary
Organizer
Start
End
Transparency
`)); + } +*/ const msgMenu = template.content.querySelector('#more-view-dropdown-id + menu'); if (msgMenu) { msgMenu.append(Element.fromHTML(`