mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
Added Nextcloud admin setting for embed/iframe mode for #96
This commit is contained in:
parent
5c597c4c1d
commit
46556931cc
4 changed files with 23 additions and 13 deletions
|
|
@ -26,14 +26,13 @@ class FetchController extends Controller {
|
|||
try {
|
||||
$sUrl = '';
|
||||
$sPath = '';
|
||||
$bAutologin = false;
|
||||
|
||||
if (isset($_POST['appname']) && 'snappymail' === $_POST['appname']) {
|
||||
$this->config->setAppValue('snappymail', 'snappymail-autologin',
|
||||
isset($_POST['snappymail-autologin']) ? '1' === $_POST['snappymail-autologin'] : false);
|
||||
$this->config->setAppValue('snappymail', 'snappymail-autologin-with-email',
|
||||
isset($_POST['snappymail-autologin']) ? '2' === $_POST['snappymail-autologin'] : false);
|
||||
$bAutologin = $this->config->getAppValue('snappymail', 'snappymail-autologin', false);
|
||||
$this->config->setAppValue('snappymail', 'snappymail-embed', isset($_POST['snappymail-embed']));
|
||||
} else {
|
||||
return new JSONResponse([
|
||||
'status' => 'error',
|
||||
|
|
|
|||
|
|
@ -16,8 +16,11 @@ class PageController extends Controller
|
|||
*/
|
||||
public function index()
|
||||
{
|
||||
// Uncomment to test without using an iframe
|
||||
// return static::index_embed();
|
||||
$config = \OC::$server->getConfig();
|
||||
|
||||
if ($config->getAppValue('snappymail', 'snappymail-embed')) {
|
||||
return static::index_embed();
|
||||
}
|
||||
|
||||
\OC::$server->getNavigationManager()->setActiveEntry('snappymail');
|
||||
|
||||
|
|
@ -26,7 +29,6 @@ class PageController extends Controller
|
|||
$query = '';
|
||||
// If the user has set credentials for SnappyMail in their personal
|
||||
// settings, override everything before and use those instead.
|
||||
$config = \OC::$server->getConfig();
|
||||
$sUID = \OC::$server->getUserSession()->getUser()->getUID();
|
||||
$sEmail = $config->getUserValue($sUID, 'snappymail', 'snappymail-email', '');
|
||||
if ($sEmail) {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ class AdminSettings implements ISettings {
|
|||
public function getForm() {
|
||||
$keys = [
|
||||
'snappymail-autologin',
|
||||
'snappymail-autologin-with-email'
|
||||
'snappymail-autologin-with-email',
|
||||
'snappymail-embed'
|
||||
];
|
||||
|
||||
$parameters = [];
|
||||
|
|
|
|||
|
|
@ -8,35 +8,43 @@
|
|||
<fieldset class="personalblock">
|
||||
<h2><?php echo($l->t('SnappyMail Webmail')); ?></h2>
|
||||
<br />
|
||||
<?php if ($_['snappymail-admin-panel-link']): ?>
|
||||
<?php if ($_['snappymail-admin-panel-link']) { ?>
|
||||
<p>
|
||||
<a href="<?php echo $_['snappymail-admin-panel-link'] ?>" target="_blank" style="text-decoration: underline">
|
||||
<?php echo($l->t('Go to SnappyMail Webmail admin panel')); ?>
|
||||
</a>
|
||||
</p>
|
||||
<br />
|
||||
<?php endif; ?>
|
||||
<?php } ?>
|
||||
<p>
|
||||
<div style="display: flex;">
|
||||
<input type="radio" id="snappymail-noautologin" name="snappymail-autologin" value="0" <?php if (!$_['snappymail-autologin']&&!$_['snappymail-autologin-with-email']): ?>checked="checked"<?php endif; ?> />
|
||||
<input type="radio" id="snappymail-noautologin" name="snappymail-autologin" value="0" <?php if (!$_['snappymail-autologin']&&!$_['snappymail-autologin-with-email']) echo 'checked="checked"'; ?> />
|
||||
<label style="margin: auto 5px;" for="snappymail-noautologin">
|
||||
<?php echo($l->t('Users will login manually, or define credentials in their personal settings for automatic logins.')); ?>
|
||||
</label>
|
||||
</div>
|
||||
<div style="display: flex;">
|
||||
<input type="radio" id="snappymail-autologin" name="snappymail-autologin" value="1" <?php if ($_['snappymail-autologin']): ?>checked="checked"<?php endif; ?> />
|
||||
<input type="radio" id="snappymail-autologin" name="snappymail-autologin" value="1" <?php if ($_['snappymail-autologin']) echo 'checked="checked"'; ?> />
|
||||
<label style="margin: auto 5px;" for="snappymail-autologin">
|
||||
<?php echo($l->t('Attempt to automatically login users with their Nextcloud username and password, or user-defined credentials, if set.')); ?>
|
||||
</label>
|
||||
</div>
|
||||
<div style="display: flex;">
|
||||
<input type="radio" id="snappymail-autologin-with-email" name="snappymail-autologin" value="2" <?php if ($_['snappymail-autologin-with-email']): ?>checked="checked"<?php endif; ?> />
|
||||
<input type="radio" id="snappymail-autologin-with-email" name="snappymail-autologin" value="2" <?php if ($_['snappymail-autologin-with-email']) echo 'checked="checked"'; ?> />
|
||||
<label style="margin: auto 5px;" for="snappymail-autologin-with-email">
|
||||
<?php echo($l->t('Attempt to automatically login users with their Nextcloud email and password, or user-defined credentials, if set.')); ?>
|
||||
</label>
|
||||
</div>
|
||||
<br />
|
||||
<br />
|
||||
</p>
|
||||
<br />
|
||||
<br />
|
||||
<p>
|
||||
<input id="snappymail-embed" name="snappymail-embed" type="checkbox" class="checkbox" <?php if ($_['snappymail-embed']) echo 'checked="checked"'; ?>>
|
||||
<label for="snappymail-embed">Embed without iframe (experimental)</label>
|
||||
</p>
|
||||
<br />
|
||||
<br />
|
||||
<p>
|
||||
<button id="snappymail-save-button" name="snappymail-save-button"><?php echo($l->t('Save')); ?></button>
|
||||
<span class="snappymail-result-desc"></span>
|
||||
</p>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue