This repository has been archived by the owner on Nov 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #156 from nkinkade/app-framework
Gets admin and personal settings working again
- Loading branch information
Showing
10 changed files
with
166 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
namespace OCA\RainLoop\Settings; | ||
|
||
use OCA\RainLoop\Util\RainLoopHelper; | ||
use OCP\AppFramework\Http\TemplateResponse; | ||
use OCP\IConfig; | ||
use OCP\Settings\ISettings; | ||
|
||
class AdminSettings implements ISettings { | ||
|
||
private $config; | ||
|
||
public function __construct(IConfig $config) { | ||
$this->config = $config; | ||
} | ||
|
||
public function getForm() { | ||
$keys = [ | ||
'rainloop-autologin', | ||
'rainloop-autologin-with-email' | ||
]; | ||
|
||
$parameters = []; | ||
foreach ($keys as $k) { | ||
$v = $this->config->getAppValue('rainloop', $k); | ||
$parameters[$k] = $v; | ||
} | ||
|
||
$uid = \OC::$server->getUserSession()->getUser()->getUID(); | ||
if (\OC_User::isAdminUser($uid)) { | ||
$parameters['rainloop-admin-panel-link'] = RainLoopHelper::getAppUrl().'?admin'; | ||
} | ||
|
||
return new TemplateResponse('rainloop', 'admin-local', $parameters); | ||
} | ||
|
||
public function getSection() { | ||
return 'additional'; | ||
} | ||
|
||
public function getPriority() { | ||
return 50; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
namespace OCA\RainLoop\Settings; | ||
|
||
use OCP\AppFramework\Http\TemplateResponse; | ||
use OCP\IConfig; | ||
|
||
class PersonalSettings { | ||
private $config; | ||
|
||
public function __construct(IConfig $config) { | ||
$this->config = $config; | ||
} | ||
|
||
public function getForm() { | ||
$uid = \OC::$server->getUserSession()->getUser()->getUID(); | ||
|
||
$keys = [ | ||
'rainloop-email', | ||
'rainloop-password' | ||
]; | ||
|
||
$parameters = []; | ||
foreach ($keys as $k) { | ||
$v = $this->config->getUserValue($uid, 'rainloop', $k); | ||
$parameters[$k] = $v; | ||
} | ||
|
||
return new TemplateResponse('rainloop', 'personal_settings', $parameters); | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,8 @@ | ||
<div class="section"> | ||
<form id="mail-rainloop-personal-form" action="#" method="post"> | ||
<input type="hidden" name="requesttoken" value="<?php echo $_['requesttoken'] ?>" id="requesttoken"> | ||
<input type="hidden" name="appname" value="rainloop"> | ||
|
||
<fieldset class="personalblock"> | ||
<h2><?php p($l->t('RainLoop Webmail')); ?></h2> | ||
<p> | ||
<input type="text" id="rainloop-email" name="rainloop-email" | ||
value="<?php echo $_['rainloop-email']; ?>" placeholder="<?php p($l->t('Email')); ?>" /> | ||
|
||
<input type="password" id="rainloop-password" name="rainloop-password" | ||
value="<?php echo $_['rainloop-password']; ?>" placeholder="<?php p($l->t('Password')); ?>" /> | ||
|
||
<input type="button" id="rainloop-save-button" name="rainloop-save-button" value="<?php p($l->t('Save')); ?>" /> | ||
<span class="rainloop-result-desc"></span> | ||
</p> | ||
</fieldset> | ||
</form> | ||
</div> | ||
<?php | ||
|
||
use OCA\RainLoop\Settings\PersonalSettings; | ||
|
||
$app = new \OCA\RainLoop\AppInfo\Application(); | ||
$controller = $app->getContainer()->query(PersonalSettings::class); | ||
return $controller->getForm()->render(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php script('rainloop', 'personal') ?> | ||
|
||
<div class="section"> | ||
<form id="mail-rainloop-personal-form" action="#" method="post"> | ||
<input type="hidden" name="requesttoken" value="<?php echo $_['requesttoken'] ?>" id="requesttoken"> | ||
<input type="hidden" name="appname" value="rainloop"> | ||
|
||
<fieldset class="personalblock"> | ||
<h2><?php p($l->t('RainLoop Webmail')); ?></h2> | ||
<p> | ||
Enter an email and password to auto-login to RainLoop. <b>Please note</b> that this feature | ||
<a href="https://github.com/pierre-alain-b/rainloop-nextcloud/issues/87" | ||
style="color:blue; text-decoration:underline" target="_blank">may have some</a> | ||
<a href="https://github.com/RainLoop/rainloop-webmail/issues/1082" | ||
style="color:blue; text-decoration:underline" target="_blank">security considerations</a>. | ||
</p> | ||
<p> | ||
<input type="text" id="rainloop-email" name="rainloop-email" | ||
value="<?php echo $_['rainloop-email']; ?>" placeholder="<?php p($l->t('Email')); ?>" /> | ||
|
||
<input type="password" id="rainloop-password" name="rainloop-password" | ||
value="<?php echo $_['rainloop-password']; ?>" placeholder="<?php p($l->t('Password')); ?>" /> | ||
|
||
<input type="button" id="rainloop-save-button" name="rainloop-save-button" value="<?php p($l->t('Save')); ?>" /> | ||
<span class="rainloop-result-desc"></span> | ||
</p> | ||
</fieldset> | ||
</form> | ||
</div> |