add constante for the app id and the app name
This commit is contained in:
parent
78c95c58ff
commit
9a67c165bd
|
@ -33,12 +33,16 @@ class Application extends App
|
||||||
*/
|
*/
|
||||||
protected $user;
|
protected $user;
|
||||||
|
|
||||||
|
public const APP_ID = 'side_menu';
|
||||||
|
|
||||||
|
public const APP_NAME = 'Side menu';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function __construct(array $urlParams = [])
|
public function __construct(array $urlParams = [])
|
||||||
{
|
{
|
||||||
parent::__construct('side_menu', $urlParams);
|
parent::__construct(self::APP_ID, $urlParams);
|
||||||
|
|
||||||
$this->config = OC::$server->getConfig();
|
$this->config = OC::$server->getConfig();
|
||||||
$this->cspnm = OC::$server->getContentSecurityPolicyNonceManager();
|
$this->cspnm = OC::$server->getContentSecurityPolicyNonceManager();
|
||||||
|
@ -53,7 +57,7 @@ class Application extends App
|
||||||
$enabled = true;
|
$enabled = true;
|
||||||
|
|
||||||
if (null !== $this->user) {
|
if (null !== $this->user) {
|
||||||
$enabled = (bool) $this->config->getUserValue($this->user->getUid(), 'side_menu', 'enabled', '1');
|
$enabled = (bool) $this->config->getUserValue($this->user->getUid(), self::APP_ID, 'enabled', '1');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $enabled;
|
return $enabled;
|
||||||
|
@ -76,20 +80,20 @@ class Application extends App
|
||||||
*/
|
*/
|
||||||
public function registerAssets()
|
public function registerAssets()
|
||||||
{
|
{
|
||||||
Util::addScript('side_menu', 'sideMenu');
|
Util::addScript(self::APP_ID, 'sideMenu');
|
||||||
Util::addStyle('side_menu', 'sideMenu');
|
Util::addStyle(self::APP_ID, 'sideMenu');
|
||||||
|
|
||||||
$stylesheet = OC::$server->getURLGenerator()->linkToRoute(
|
$stylesheet = OC::$server->getURLGenerator()->linkToRoute(
|
||||||
'side_menu.Css.stylesheet',
|
'side_menu.Css.stylesheet',
|
||||||
[
|
[
|
||||||
'v' => $this->config->getAppValue('side_menu', 'cache', '0'),
|
'v' => $this->config->getAppValue(self::APP_ID, 'cache', '0'),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$script = OC::$server->getURLGenerator()->linkToRoute(
|
$script = OC::$server->getURLGenerator()->linkToRoute(
|
||||||
'side_menu.Js.script',
|
'side_menu.Js.script',
|
||||||
[
|
[
|
||||||
'v' => $this->config->getAppValue('side_menu', 'cache', '0'),
|
'v' => $this->config->getAppValue(self::APP_ID, 'cache', '0'),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ use OCP\AppFramework\Http\TemplateResponse;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
use OCP\IUserSession;
|
use OCP\IUserSession;
|
||||||
|
use OCA\SideMenu\AppInfo\Application;
|
||||||
|
|
||||||
class CssController extends Controller
|
class CssController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -61,7 +62,7 @@ class CssController extends Controller
|
||||||
*/
|
*/
|
||||||
public function stylesheet()
|
public function stylesheet()
|
||||||
{
|
{
|
||||||
$response = new TemplateResponse('side_menu', 'css/stylesheet', $this->getConfig(), 'blank');
|
$response = new TemplateResponse(Application::APP_ID, 'css/stylesheet', $this->getConfig(), 'blank');
|
||||||
$response->addHeader('Content-Type', 'text/css');
|
$response->addHeader('Content-Type', 'text/css');
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
|
@ -69,13 +70,13 @@ class CssController extends Controller
|
||||||
|
|
||||||
protected function getConfig(): array
|
protected function getConfig(): array
|
||||||
{
|
{
|
||||||
$backgroundColor = $this->config->getAppValue('side_menu', 'background-color', '#333333');
|
$backgroundColor = $this->config->getAppValue(Application::APP_ID, 'background-color', '#333333');
|
||||||
$backgroundColorTo = $this->config->getAppValue('side_menu', 'background-color-to', $backgroundColor);
|
$backgroundColorTo = $this->config->getAppValue(Application::APP_ID, 'background-color-to', $backgroundColor);
|
||||||
|
|
||||||
$topMenuApps = (array) json_decode($this->config->getAppValue('side_menu', 'top-menu-apps', '[]'), true);
|
$topMenuApps = (array) json_decode($this->config->getAppValue(Application::APP_ID, 'top-menu-apps', '[]'), true);
|
||||||
|
|
||||||
if ($this->user) {
|
if ($this->user) {
|
||||||
$userTopMenuApps = (array) json_decode($this->config->getUserValue($this->user->getUid(), 'side_menu', 'top-menu-apps', '[]'), true);
|
$userTopMenuApps = (array) json_decode($this->config->getUserValue($this->user->getUid(), Application::APP_ID, 'top-menu-apps', '[]'), true);
|
||||||
|
|
||||||
if (!empty($userTopMenuApps)) {
|
if (!empty($userTopMenuApps)) {
|
||||||
$topMenuApps = $userTopMenuApps;
|
$topMenuApps = $userTopMenuApps;
|
||||||
|
@ -86,20 +87,20 @@ class CssController extends Controller
|
||||||
'vars' => [
|
'vars' => [
|
||||||
'background-color' => $backgroundColor,
|
'background-color' => $backgroundColor,
|
||||||
'background-color-to' => $backgroundColorTo,
|
'background-color-to' => $backgroundColorTo,
|
||||||
'current-app-background-color' => $this->config->getAppValue('side_menu', 'current-app-background-color', '#444444'),
|
'current-app-background-color' => $this->config->getAppValue(Application::APP_ID, 'current-app-background-color', '#444444'),
|
||||||
'loader-color' => $this->config->getAppValue('side_menu', 'loader-color', '#0e75ac'),
|
'loader-color' => $this->config->getAppValue(Application::APP_ID, 'loader-color', '#0e75ac'),
|
||||||
'text-color' => $this->config->getAppValue('side_menu', 'text-color', '#FFFFFF'),
|
'text-color' => $this->config->getAppValue(Application::APP_ID, 'text-color', '#FFFFFF'),
|
||||||
'opener' => $this->config->getAppValue('side_menu', 'opener', 'side-menu-opener'),
|
'opener' => $this->config->getAppValue(Application::APP_ID, 'opener', 'side-menu-opener'),
|
||||||
'icon-invert-filter' => abs((int) $this->config->getAppValue('side_menu', 'icon-invert-filter', '0')).'%',
|
'icon-invert-filter' => abs((int) $this->config->getAppValue(Application::APP_ID, 'icon-invert-filter', '0')).'%',
|
||||||
'icon-opacity' => abs((int) $this->config->getAppValue('side_menu', 'icon-opacity', '100') / 100),
|
'icon-opacity' => abs((int) $this->config->getAppValue(Application::APP_ID, 'icon-opacity', '100') / 100),
|
||||||
],
|
],
|
||||||
'display-logo' => (bool) $this->config->getAppValue('side_menu', 'display-logo', 1),
|
'display-logo' => (bool) $this->config->getAppValue(Application::APP_ID, 'display-logo', 1),
|
||||||
'opener-only' => (bool) $this->config->getAppValue('side_menu', 'opener-only', 0),
|
'opener-only' => (bool) $this->config->getAppValue(Application::APP_ID, 'opener-only', 0),
|
||||||
'external-sites-in-top-menu' => (bool) $this->config->getAppValue('side_menu', 'external-sites-in-top-menu', 0),
|
'external-sites-in-top-menu' => (bool) $this->config->getAppValue(Application::APP_ID, 'external-sites-in-top-menu', 0),
|
||||||
'size-icon' => $this->config->getAppValue('side_menu', 'size-icon', 'normal'),
|
'size-icon' => $this->config->getAppValue(Application::APP_ID, 'size-icon', 'normal'),
|
||||||
'size-text' => $this->config->getAppValue('side_menu', 'size-text', 'normal'),
|
'size-text' => $this->config->getAppValue(Application::APP_ID, 'size-text', 'normal'),
|
||||||
'always-displayed' => (bool) $this->config->getAppValue('side_menu', 'always-displayed', '0'),
|
'always-displayed' => (bool) $this->config->getAppValue(Application::APP_ID, 'always-displayed', '0'),
|
||||||
'big-menu' => (bool) $this->config->getAppValue('side_menu', 'big-menu', '0'),
|
'big-menu' => (bool) $this->config->getAppValue(Application::APP_ID, 'big-menu', '0'),
|
||||||
'top-menu-apps' => $topMenuApps,
|
'top-menu-apps' => $topMenuApps,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ use OCP\AppFramework\Http\TemplateResponse;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
use OCP\IUserSession;
|
use OCP\IUserSession;
|
||||||
|
use OCA\SideMenu\AppInfo\Application;
|
||||||
|
|
||||||
class JsController extends Controller
|
class JsController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -68,7 +69,7 @@ class JsController extends Controller
|
||||||
*/
|
*/
|
||||||
public function script(): TemplateResponse
|
public function script(): TemplateResponse
|
||||||
{
|
{
|
||||||
$response = new TemplateResponse('side_menu', 'js/script', $this->getConfig(), 'blank');
|
$response = new TemplateResponse(Application::APP_ID, 'js/script', $this->getConfig(), 'blank');
|
||||||
$response->addHeader('Content-Type', 'text/javascript');
|
$response->addHeader('Content-Type', 'text/javascript');
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
|
@ -86,20 +87,20 @@ class JsController extends Controller
|
||||||
|
|
||||||
protected function getConfig(): array
|
protected function getConfig(): array
|
||||||
{
|
{
|
||||||
$topMenuApps = (array) json_decode($this->config->getAppValue('side_menu', 'top-menu-apps', '[]'), true);
|
$topMenuApps = (array) json_decode($this->config->getAppValue(Application::APP_ID, 'top-menu-apps', '[]'), true);
|
||||||
$targetBlankApps = (array) json_decode($this->config->getAppValue('side_menu', 'target-blank-apps', '[]'), true);
|
$targetBlankApps = (array) json_decode($this->config->getAppValue(Application::APP_ID, 'target-blank-apps', '[]'), true);
|
||||||
$useAvatar = (bool) $this->config->getAppValue('side_menu', 'use-avatar', '0');
|
$useAvatar = (bool) $this->config->getAppValue(Application::APP_ID, 'use-avatar', '0');
|
||||||
$avatar = null;
|
$avatar = null;
|
||||||
|
|
||||||
if ($this->user) {
|
if ($this->user) {
|
||||||
$userTopMenuApps = (array) json_decode($this->config->getUserValue($this->user->getUid(), 'side_menu', 'top-menu-apps', '[]'), true);
|
$userTopMenuApps = (array) json_decode($this->config->getUserValue($this->user->getUid(), Application::APP_ID, 'top-menu-apps', '[]'), true);
|
||||||
|
|
||||||
if (!empty($userTopMenuApps)) {
|
if (!empty($userTopMenuApps)) {
|
||||||
$topMenuApps = $userTopMenuApps;
|
$topMenuApps = $userTopMenuApps;
|
||||||
}
|
}
|
||||||
|
|
||||||
$userTargetBlankMode = (int) $this->config->getUserValue($this->user->getUid(), 'side_menu', 'target-blank-mode', '1');
|
$userTargetBlankMode = (int) $this->config->getUserValue($this->user->getUid(), Application::APP_ID, 'target-blank-mode', '1');
|
||||||
$userTargetBlankApps = (array) json_decode($this->config->getUserValue($this->user->getUid(), 'side_menu', 'target-blank-apps', '[]'), true);
|
$userTargetBlankApps = (array) json_decode($this->config->getUserValue($this->user->getUid(), Application::APP_ID, 'target-blank-apps', '[]'), true);
|
||||||
|
|
||||||
if (2 === $userTargetBlankMode) {
|
if (2 === $userTargetBlankMode) {
|
||||||
$targetBlankApps = $userTargetBlankApps;
|
$targetBlankApps = $userTargetBlankApps;
|
||||||
|
@ -119,14 +120,14 @@ class JsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'opener-position' => $this->config->getAppValue('side_menu', 'opener-position', 'before'),
|
'opener-position' => $this->config->getAppValue(Application::APP_ID, 'opener-position', 'before'),
|
||||||
'opener-hover' => (bool) $this->config->getAppValue('side_menu', 'opener-hover', '0'),
|
'opener-hover' => (bool) $this->config->getAppValue(Application::APP_ID, 'opener-hover', '0'),
|
||||||
'external-sites-in-top-menu' => (bool) $this->config->getAppValue('side_menu', 'external-sites-in-top-menu', 0),
|
'external-sites-in-top-menu' => (bool) $this->config->getAppValue(Application::APP_ID, 'external-sites-in-top-menu', 0),
|
||||||
'force-light-icon' => (bool) $this->config->getAppValue('side_menu', 'force-light-icon', '0'),
|
'force-light-icon' => (bool) $this->config->getAppValue(Application::APP_ID, 'force-light-icon', '0'),
|
||||||
'hide-when-no-apps' => (bool) $this->config->getAppValue('side_menu', 'hide-when-no-apps', '0'),
|
'hide-when-no-apps' => (bool) $this->config->getAppValue(Application::APP_ID, 'hide-when-no-apps', '0'),
|
||||||
'loader-enabled' => (bool) $this->config->getAppValue('side_menu', 'loader-enabled', '1'),
|
'loader-enabled' => (bool) $this->config->getAppValue(Application::APP_ID, 'loader-enabled', '1'),
|
||||||
'always-displayed' => (bool) $this->config->getAppValue('side_menu', 'always-displayed', '0'),
|
'always-displayed' => (bool) $this->config->getAppValue(Application::APP_ID, 'always-displayed', '0'),
|
||||||
'big-menu' => (bool) $this->config->getAppValue('side_menu', 'big-menu', '0'),
|
'big-menu' => (bool) $this->config->getAppValue(Application::APP_ID, 'big-menu', '0'),
|
||||||
'avatar' => $avatar,
|
'avatar' => $avatar,
|
||||||
'top-menu-apps' => $topMenuApps,
|
'top-menu-apps' => $topMenuApps,
|
||||||
'target-blank-apps' => $targetBlankApps,
|
'target-blank-apps' => $targetBlankApps,
|
||||||
|
|
|
@ -29,6 +29,7 @@ use OCP\IL10N;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
use OCP\IUserSession;
|
use OCP\IUserSession;
|
||||||
use OCP\L10N\IFactory;
|
use OCP\L10N\IFactory;
|
||||||
|
use OCA\SideMenu\AppInfo\Application;
|
||||||
|
|
||||||
class NavController extends Controller
|
class NavController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -98,7 +99,7 @@ class NavController extends Controller
|
||||||
$apps = $this->appRepository->getVisibleApps();
|
$apps = $this->appRepository->getVisibleApps();
|
||||||
$currentLanguage = substr($this->l10nFactory->findLanguage(), 0, 2);
|
$currentLanguage = substr($this->l10nFactory->findLanguage(), 0, 2);
|
||||||
$categoriesLabels = $this->categoryFetcher->get();
|
$categoriesLabels = $this->categoryFetcher->get();
|
||||||
$externalSitesInTopMenu = (bool) $this->config->getAppValue('side_menu', 'external-sites-in-top-menu', 0);
|
$externalSitesInTopMenu = (bool) $this->config->getAppValue(Application::APP_ID, 'external-sites-in-top-menu', 0);
|
||||||
$user = OC::$server[IUserSession::class]->getUser();
|
$user = OC::$server[IUserSession::class]->getUser();
|
||||||
$appsCategories = [];
|
$appsCategories = [];
|
||||||
$categoriesAppsCount = [];
|
$categoriesAppsCount = [];
|
||||||
|
@ -110,8 +111,8 @@ class NavController extends Controller
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$topMenuApps = (array) json_decode($this->config->getAppValue('side_menu', 'top-menu-apps', '[]'), true);
|
$topMenuApps = (array) json_decode($this->config->getAppValue(Application::APP_ID, 'top-menu-apps', '[]'), true);
|
||||||
$userTopMenuApps = (array) json_decode($this->config->getUserValue($user->getUid(), 'side_menu', 'top-menu-apps', '[]'), true);
|
$userTopMenuApps = (array) json_decode($this->config->getUserValue($user->getUid(), Application::APP_ID, 'top-menu-apps', '[]'), true);
|
||||||
|
|
||||||
if (!empty($userTopMenuApps)) {
|
if (!empty($userTopMenuApps)) {
|
||||||
$topMenuApps = $userTopMenuApps;
|
$topMenuApps = $userTopMenuApps;
|
||||||
|
|
|
@ -23,6 +23,7 @@ use OCP\AppFramework\Http\Response;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
use OCP\IUserSession;
|
use OCP\IUserSession;
|
||||||
|
use OCA\SideMenu\AppInfo\Application;
|
||||||
|
|
||||||
class PersonalSettingController extends Controller
|
class PersonalSettingController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -104,7 +105,7 @@ class PersonalSettingController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($doSave) {
|
if ($doSave) {
|
||||||
$this->config->setUserValue($user->getUid(), 'side_menu', $name, $value);
|
$this->config->setUserValue($user->getUid(), Application::APP_ID, $name, $value);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
|
|
|
@ -24,6 +24,7 @@ use OCP\IConfig;
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
use OCP\ILogger;
|
use OCP\ILogger;
|
||||||
use OCP\Settings\ISettings;
|
use OCP\Settings\ISettings;
|
||||||
|
use OCA\SideMenu\AppInfo\Application;
|
||||||
|
|
||||||
class Admin implements ISettings
|
class Admin implements ISettings
|
||||||
{
|
{
|
||||||
|
@ -60,36 +61,36 @@ class Admin implements ISettings
|
||||||
*/
|
*/
|
||||||
public function getForm()
|
public function getForm()
|
||||||
{
|
{
|
||||||
$backgroundColor = $this->config->getAppValue('side_menu', 'background-color', '#333333');
|
$backgroundColor = $this->config->getAppValue(Application::APP_ID, 'background-color', '#333333');
|
||||||
$backgroundColorTo = $this->config->getAppValue('side_menu', 'background-color-to', $backgroundColor);
|
$backgroundColorTo = $this->config->getAppValue(Application::APP_ID, 'background-color-to', $backgroundColor);
|
||||||
|
|
||||||
$parameters = [
|
$parameters = [
|
||||||
'background-color' => $backgroundColor,
|
'background-color' => $backgroundColor,
|
||||||
'background-color-to' => $backgroundColorTo,
|
'background-color-to' => $backgroundColorTo,
|
||||||
'current-app-background-color' => $this->config->getAppValue('side_menu', 'current-app-background-color', '#444444'),
|
'current-app-background-color' => $this->config->getAppValue(Application::APP_ID, 'current-app-background-color', '#444444'),
|
||||||
'loader-color' => $this->config->getAppValue('side_menu', 'loader-color', '#0e75ac'),
|
'loader-color' => $this->config->getAppValue(Application::APP_ID, 'loader-color', '#0e75ac'),
|
||||||
'icon-invert-filter' => (int) $this->config->getAppValue('side_menu', 'icon-invert-filter', '0'),
|
'icon-invert-filter' => (int) $this->config->getAppValue(Application::APP_ID, 'icon-invert-filter', '0'),
|
||||||
'icon-opacity' => (int) $this->config->getAppValue('side_menu', 'icon-opacity', '100'),
|
'icon-opacity' => (int) $this->config->getAppValue(Application::APP_ID, 'icon-opacity', '100'),
|
||||||
'loader-enabled' => $this->config->getAppValue('side_menu', 'loader-enabled', '1'),
|
'loader-enabled' => $this->config->getAppValue(Application::APP_ID, 'loader-enabled', '1'),
|
||||||
'text-color' => $this->config->getAppValue('side_menu', 'text-color', '#FFFFFF'),
|
'text-color' => $this->config->getAppValue(Application::APP_ID, 'text-color', '#FFFFFF'),
|
||||||
'cache' => $this->config->getAppValue('side_menu', 'cache', '0'),
|
'cache' => $this->config->getAppValue(Application::APP_ID, 'cache', '0'),
|
||||||
'opener' => $this->config->getAppValue('side_menu', 'opener', 'side-menu-opener'),
|
'opener' => $this->config->getAppValue(Application::APP_ID, 'opener', 'side-menu-opener'),
|
||||||
'always-displayed' => $this->config->getAppValue('side_menu', 'always-displayed', '0'),
|
'always-displayed' => $this->config->getAppValue(Application::APP_ID, 'always-displayed', '0'),
|
||||||
'big-menu' => $this->config->getAppValue('side_menu', 'big-menu', '0'),
|
'big-menu' => $this->config->getAppValue(Application::APP_ID, 'big-menu', '0'),
|
||||||
'display-logo' => $this->config->getAppValue('side_menu', 'display-logo', '1'),
|
'display-logo' => $this->config->getAppValue(Application::APP_ID, 'display-logo', '1'),
|
||||||
'use-avatar' => $this->config->getAppValue('side_menu', 'use-avatar', '0'),
|
'use-avatar' => $this->config->getAppValue(Application::APP_ID, 'use-avatar', '0'),
|
||||||
'opener-position' => $this->config->getAppValue('side_menu', 'opener-position', 'before'),
|
'opener-position' => $this->config->getAppValue(Application::APP_ID, 'opener-position', 'before'),
|
||||||
'opener-hover' => $this->config->getAppValue('side_menu', 'opener-hover', '0'),
|
'opener-hover' => $this->config->getAppValue(Application::APP_ID, 'opener-hover', '0'),
|
||||||
'opener-only' => $this->config->getAppValue('side_menu', 'opener-only', '0'),
|
'opener-only' => $this->config->getAppValue(Application::APP_ID, 'opener-only', '0'),
|
||||||
'hide-when-no-apps' => $this->config->getAppValue('side_menu', 'hide-when-no-apps', '0'),
|
'hide-when-no-apps' => $this->config->getAppValue(Application::APP_ID, 'hide-when-no-apps', '0'),
|
||||||
'size-icon' => $this->config->getAppValue('side_menu', 'size-icon', 'normal'),
|
'size-icon' => $this->config->getAppValue(Application::APP_ID, 'size-icon', 'normal'),
|
||||||
'size-text' => $this->config->getAppValue('side_menu', 'size-text', 'normal'),
|
'size-text' => $this->config->getAppValue(Application::APP_ID, 'size-text', 'normal'),
|
||||||
'target-blank-apps' => (array) json_decode($this->config->getAppValue('side_menu', 'target-blank-apps', '[]'), true),
|
'target-blank-apps' => (array) json_decode($this->config->getAppValue(Application::APP_ID, 'target-blank-apps', '[]'), true),
|
||||||
'top-menu-apps' => (array) json_decode($this->config->getAppValue('side_menu', 'top-menu-apps', '[]'), true),
|
'top-menu-apps' => (array) json_decode($this->config->getAppValue(Application::APP_ID, 'top-menu-apps', '[]'), true),
|
||||||
'apps' => $this->appRepository->getVisibleApps(),
|
'apps' => $this->appRepository->getVisibleApps(),
|
||||||
];
|
];
|
||||||
|
|
||||||
return new TemplateResponse('side_menu', 'settings/admin-form', $parameters, '');
|
return new TemplateResponse(Application::APP_ID, 'settings/admin-form', $parameters, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -97,7 +98,7 @@ class Admin implements ISettings
|
||||||
*/
|
*/
|
||||||
public function getSection()
|
public function getSection()
|
||||||
{
|
{
|
||||||
return 'side_menu';
|
return Application::APP_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,6 +21,7 @@ namespace OCA\SideMenu\Settings;
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
use OCP\IURLGenerator;
|
use OCP\IURLGenerator;
|
||||||
use OCP\Settings\IIconSection;
|
use OCP\Settings\IIconSection;
|
||||||
|
use OCA\SideMenu\AppInfo\Application;
|
||||||
|
|
||||||
class AdminSection implements IIconSection
|
class AdminSection implements IIconSection
|
||||||
{
|
{
|
||||||
|
@ -52,7 +53,7 @@ class AdminSection implements IIconSection
|
||||||
*/
|
*/
|
||||||
public function getID()
|
public function getID()
|
||||||
{
|
{
|
||||||
return 'side_menu';
|
return Application::APP_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,7 +64,7 @@ class AdminSection implements IIconSection
|
||||||
*/
|
*/
|
||||||
public function getName()
|
public function getName()
|
||||||
{
|
{
|
||||||
return $this->l->t('Side menu');
|
return $this->l->t(Application::APP_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -25,6 +25,7 @@ use OCP\Settings\ISettings;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\IUserSession;
|
use OCP\IUserSession;
|
||||||
use OCA\SideMenu\Service\AppRepository;
|
use OCA\SideMenu\Service\AppRepository;
|
||||||
|
use OCA\SideMenu\AppInfo\Application;
|
||||||
|
|
||||||
class Personal implements ISettings
|
class Personal implements ISettings
|
||||||
{
|
{
|
||||||
|
@ -70,14 +71,14 @@ class Personal implements ISettings
|
||||||
$user = $this->userSession->getUser();
|
$user = $this->userSession->getUser();
|
||||||
|
|
||||||
$parameters = [
|
$parameters = [
|
||||||
'enabled' => $this->config->getUserValue($user->getUid(), 'side_menu', 'enabled', '1'),
|
'enabled' => $this->config->getUserValue($user->getUid(), Application::APP_ID, 'enabled', '1'),
|
||||||
'top-menu-apps' => (array) json_decode($this->config->getUserValue($user->getUid(), 'side_menu', 'top-menu-apps', '[]'), true),
|
'top-menu-apps' => (array) json_decode($this->config->getUserValue($user->getUid(), Application::APP_ID, 'top-menu-apps', '[]'), true),
|
||||||
'target-blank-mode' => $this->config->getUserValue($user->getUid(), 'side_menu', 'target-blank-mode', '1'),
|
'target-blank-mode' => $this->config->getUserValue($user->getUid(), Application::APP_ID, 'target-blank-mode', '1'),
|
||||||
'target-blank-apps' => (array) json_decode($this->config->getUserValue($user->getUid(), 'side_menu', 'target-blank-apps', '[]'), true),
|
'target-blank-apps' => (array) json_decode($this->config->getUserValue($user->getUid(), Application::APP_ID, 'target-blank-apps', '[]'), true),
|
||||||
'apps' => $this->appRepository->getVisibleApps(),
|
'apps' => $this->appRepository->getVisibleApps(),
|
||||||
];
|
];
|
||||||
|
|
||||||
return new TemplateResponse('side_menu', 'settings/personal-form', $parameters, '');
|
return new TemplateResponse(Application::APP_ID, 'settings/personal-form', $parameters, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -85,7 +86,7 @@ class Personal implements ISettings
|
||||||
*/
|
*/
|
||||||
public function getSection()
|
public function getSection()
|
||||||
{
|
{
|
||||||
return 'side_menu';
|
return Application::APP_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,6 +21,7 @@ namespace OCA\SideMenu\Settings;
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
use OCP\IURLGenerator;
|
use OCP\IURLGenerator;
|
||||||
use OCP\Settings\IIconSection;
|
use OCP\Settings\IIconSection;
|
||||||
|
use OCA\SideMenu\AppInfo\Application;
|
||||||
|
|
||||||
class PersonalSection implements IIconSection
|
class PersonalSection implements IIconSection
|
||||||
{
|
{
|
||||||
|
@ -52,7 +53,7 @@ class PersonalSection implements IIconSection
|
||||||
*/
|
*/
|
||||||
public function getID()
|
public function getID()
|
||||||
{
|
{
|
||||||
return 'side_menu';
|
return Application::APP_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,7 +64,7 @@ class PersonalSection implements IIconSection
|
||||||
*/
|
*/
|
||||||
public function getName()
|
public function getName()
|
||||||
{
|
{
|
||||||
return $this->l->t('Side menu');
|
return $this->l->t(Application::APP_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue