add constante for the app id and the app name
This commit is contained in:
parent
78c95c58ff
commit
9a67c165bd
9 changed files with 89 additions and 77 deletions
|
|
@ -26,6 +26,7 @@ use OCP\AppFramework\Http\TemplateResponse;
|
|||
use OCP\IConfig;
|
||||
use OCP\IRequest;
|
||||
use OCP\IUserSession;
|
||||
use OCA\SideMenu\AppInfo\Application;
|
||||
|
||||
class CssController extends Controller
|
||||
{
|
||||
|
|
@ -61,7 +62,7 @@ class CssController extends Controller
|
|||
*/
|
||||
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');
|
||||
|
||||
return $response;
|
||||
|
|
@ -69,13 +70,13 @@ class CssController extends Controller
|
|||
|
||||
protected function getConfig(): array
|
||||
{
|
||||
$backgroundColor = $this->config->getAppValue('side_menu', 'background-color', '#333333');
|
||||
$backgroundColorTo = $this->config->getAppValue('side_menu', 'background-color-to', $backgroundColor);
|
||||
$backgroundColor = $this->config->getAppValue(Application::APP_ID, 'background-color', '#333333');
|
||||
$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) {
|
||||
$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)) {
|
||||
$topMenuApps = $userTopMenuApps;
|
||||
|
|
@ -86,20 +87,20 @@ class CssController extends Controller
|
|||
'vars' => [
|
||||
'background-color' => $backgroundColor,
|
||||
'background-color-to' => $backgroundColorTo,
|
||||
'current-app-background-color' => $this->config->getAppValue('side_menu', 'current-app-background-color', '#444444'),
|
||||
'loader-color' => $this->config->getAppValue('side_menu', 'loader-color', '#0e75ac'),
|
||||
'text-color' => $this->config->getAppValue('side_menu', 'text-color', '#FFFFFF'),
|
||||
'opener' => $this->config->getAppValue('side_menu', 'opener', 'side-menu-opener'),
|
||||
'icon-invert-filter' => abs((int) $this->config->getAppValue('side_menu', 'icon-invert-filter', '0')).'%',
|
||||
'icon-opacity' => abs((int) $this->config->getAppValue('side_menu', 'icon-opacity', '100') / 100),
|
||||
'current-app-background-color' => $this->config->getAppValue(Application::APP_ID, 'current-app-background-color', '#444444'),
|
||||
'loader-color' => $this->config->getAppValue(Application::APP_ID, 'loader-color', '#0e75ac'),
|
||||
'text-color' => $this->config->getAppValue(Application::APP_ID, 'text-color', '#FFFFFF'),
|
||||
'opener' => $this->config->getAppValue(Application::APP_ID, 'opener', 'side-menu-opener'),
|
||||
'icon-invert-filter' => abs((int) $this->config->getAppValue(Application::APP_ID, 'icon-invert-filter', '0')).'%',
|
||||
'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),
|
||||
'opener-only' => (bool) $this->config->getAppValue('side_menu', 'opener-only', 0),
|
||||
'external-sites-in-top-menu' => (bool) $this->config->getAppValue('side_menu', 'external-sites-in-top-menu', 0),
|
||||
'size-icon' => $this->config->getAppValue('side_menu', 'size-icon', 'normal'),
|
||||
'size-text' => $this->config->getAppValue('side_menu', 'size-text', 'normal'),
|
||||
'always-displayed' => (bool) $this->config->getAppValue('side_menu', 'always-displayed', '0'),
|
||||
'big-menu' => (bool) $this->config->getAppValue('side_menu', 'big-menu', '0'),
|
||||
'display-logo' => (bool) $this->config->getAppValue(Application::APP_ID, 'display-logo', 1),
|
||||
'opener-only' => (bool) $this->config->getAppValue(Application::APP_ID, 'opener-only', 0),
|
||||
'external-sites-in-top-menu' => (bool) $this->config->getAppValue(Application::APP_ID, 'external-sites-in-top-menu', 0),
|
||||
'size-icon' => $this->config->getAppValue(Application::APP_ID, 'size-icon', 'normal'),
|
||||
'size-text' => $this->config->getAppValue(Application::APP_ID, 'size-text', 'normal'),
|
||||
'always-displayed' => (bool) $this->config->getAppValue(Application::APP_ID, 'always-displayed', '0'),
|
||||
'big-menu' => (bool) $this->config->getAppValue(Application::APP_ID, 'big-menu', '0'),
|
||||
'top-menu-apps' => $topMenuApps,
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue