mirror of https://github.com/sualko/cloud_bbb
fix: always show missing conf message
parent
b28469ada4
commit
cc566608b2
|
@ -2,19 +2,18 @@
|
|||
|
||||
namespace OCA\BigBlueButton\Controller;
|
||||
|
||||
use OCA\BigBlueButton\TemplateProvider;
|
||||
use OCP\AppFramework\Controller;
|
||||
use OCP\AppFramework\Http\TemplateResponse;
|
||||
use OCP\IConfig;
|
||||
use OCP\IRequest;
|
||||
|
||||
class PageController extends Controller {
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
/** @var TemplateProvider */
|
||||
private $templateProvider;
|
||||
|
||||
public function __construct(string $appName, IRequest $request, IConfig $config) {
|
||||
public function __construct(string $appName, IRequest $request, TemplateProvider $templateProvider) {
|
||||
parent::__construct($appName, $request);
|
||||
|
||||
$this->config = $config;
|
||||
$this->templateProvider = $templateProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -22,8 +21,6 @@ class PageController extends Controller {
|
|||
* @NoCSRFRequired
|
||||
*/
|
||||
public function index() {
|
||||
return new TemplateResponse($this->appName, 'manager', [
|
||||
'shortener' => $this->config->getAppValue('bbb', 'app.shortener', ''),
|
||||
]);
|
||||
return $this->templateProvider->getManager();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,42 +2,29 @@
|
|||
|
||||
namespace OCA\BigBlueButton\Settings;
|
||||
|
||||
use \OCP\IL10N;
|
||||
use OCA\BigBlueButton\TemplateProvider;
|
||||
use OCP\AppFramework\Http\TemplateResponse;
|
||||
use OCP\IConfig;
|
||||
use OCP\Settings\ISettings;
|
||||
|
||||
class Personal implements ISettings {
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
|
||||
/** @var IL10N */
|
||||
private $l;
|
||||
/** @var TemplateProvider */
|
||||
private $templateProvider;
|
||||
|
||||
/**
|
||||
* Admin constructor.
|
||||
*
|
||||
* @param IConfig $config
|
||||
*/
|
||||
public function __construct(IConfig $config, IL10N $l) {
|
||||
$this->config = $config;
|
||||
$this->l = $l;
|
||||
public function __construct(TemplateProvider $templateProvider) {
|
||||
$this->templateProvider = $templateProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TemplateResponse
|
||||
*/
|
||||
public function getForm() {
|
||||
$warning = '';
|
||||
|
||||
if (empty($this->config->getAppValue('bbb', 'api.url')) || empty($this->config->getAppValue('bbb', 'api.secret'))) {
|
||||
$warning = $this->l->t('API URL or secret not configured. Please contact your administrator.');
|
||||
}
|
||||
|
||||
return new TemplateResponse('bbb', 'manager', [
|
||||
'warning' => $warning,
|
||||
'shortener' => $this->config->getAppValue('bbb', 'app.shortener', ''),
|
||||
]);
|
||||
return $this->templateProvider->getManager();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace OCA\BigBlueButton;
|
||||
|
||||
use OCP\AppFramework\Http\TemplateResponse;
|
||||
use OCP\IConfig;
|
||||
use OCP\IL10N;
|
||||
|
||||
class TemplateProvider {
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
|
||||
/** @var IL10N */
|
||||
private $l;
|
||||
|
||||
/**
|
||||
* Admin constructor.
|
||||
*
|
||||
* @param IConfig $config
|
||||
*/
|
||||
public function __construct(IConfig $config, IL10N $l) {
|
||||
$this->config = $config;
|
||||
$this->l = $l;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TemplateResponse
|
||||
*/
|
||||
public function getManager(): TemplateResponse {
|
||||
$warning = '';
|
||||
|
||||
if (empty($this->config->getAppValue('bbb', 'api.url')) || empty($this->config->getAppValue('bbb', 'api.secret'))) {
|
||||
$warning = $this->l->t('API URL or secret not configured. Please contact your administrator.');
|
||||
}
|
||||
|
||||
return new TemplateResponse('bbb', 'manager', [
|
||||
'warning' => $warning,
|
||||
'shortener' => $this->config->getAppValue('bbb', 'app.shortener', ''),
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -2,10 +2,12 @@
|
|||
script('bbb', 'manager');
|
||||
?>
|
||||
|
||||
<div id="bbb-root" data-shortener="<?php p($_['shortener']); ?>"></div>
|
||||
<div id="bbb-app">
|
||||
<div id="bbb-root" data-shortener="<?php p($_['shortener']); ?>"></div>
|
||||
|
||||
<?php if (!empty($_['warning'])): ?>
|
||||
<div id="bbb-warning">
|
||||
<span class="icon icon-error-color icon-visible"></span> <?php p($_['warning']); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($_['warning'])): ?>
|
||||
<div id="bbb-warning">
|
||||
<span class="icon icon-error-color icon-visible"></span> <?php p($_['warning']); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
opacity: 0.6;
|
||||
}
|
||||
|
||||
#bbb-root {
|
||||
#bbb-root, #bbb-app {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue