Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dd8561e691 | |||
| 61a4689eb2 | |||
| 4532dd345e | |||
| 6effdc6eed | |||
| 810d83880b | |||
| 25e70f276f | |||
| d06b6b9e31 | |||
| 5c218bff2a | |||
| b0385c172b | |||
| 04ac7e5ed1 | |||
| 67743485cb | |||
| 0ce318d6ec | |||
| c26c5f26df | |||
| 6ce7d3223f | |||
| 6eb977dad5 | |||
| 5f307cd046 | |||
| d2421f90bf | |||
| b16da36507 | |||
| 29f0ead9cc | |||
| e1567b0689 | |||
| aa139bc671 | |||
| b133ba3a97 | |||
| aaf2bb55db | |||
| 749f25a231 | |||
| 04026f5c75 | |||
| 48b2b30406 | |||
| 22e5445330 | |||
| 0544fd3765 | |||
| 2635dd89ca | |||
| aa203bb406 | |||
| 368c59a2bd | |||
| ab7b1e96fe | |||
| f4322a8d71 |
@@ -26,7 +26,7 @@ body:
|
|||||||
id: configuration
|
id: configuration
|
||||||
attributes:
|
attributes:
|
||||||
label: Configuration
|
label: Configuration
|
||||||
description: Export the configuration using the admin page and copy/paste here ([documentation](https://deblan.gitnet.page/side_menu_doc/docs/FAQ/export-config/)).
|
description: Export the configuration using the admin page and copy/paste here ([documentation](https://deblan.gitnet.page/side_menu_doc/tips/#export-the-configuration)).
|
||||||
value: |
|
value: |
|
||||||
```
|
```
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
name: New question
|
|
||||||
about: Use this template when you don't know how to do something
|
|
||||||
title: "[Question] "
|
|
||||||
labels:
|
|
||||||
- question
|
|
||||||
body:
|
|
||||||
- type: markdown
|
|
||||||
attributes:
|
|
||||||
value: |
|
|
||||||
Thanks for taking the time to fill information.
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
id: environment
|
|
||||||
attributes:
|
|
||||||
label: Environment
|
|
||||||
value: |
|
|
||||||
* Custom menu version:
|
|
||||||
* Nextcloud version:
|
|
||||||
* PHP version:
|
|
||||||
* Web server (Nginx, Apache2):
|
|
||||||
* Web browser and version (Firefox 80, Google Chrome 74, etc):
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
id: question
|
|
||||||
attributes:
|
|
||||||
label: Question
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
blank_issues_enabled: false
|
|
||||||
contact_links:
|
|
||||||
- name: Documentation
|
|
||||||
url: https://deblan.gitnet.page/side_menu_doc/
|
|
||||||
about: Official documentation web site
|
|
||||||
- name: Ask a question in our Matrix room
|
|
||||||
about: If you prefer a chat-like conversation or in need for quick help, this might be an alternative to opening an issue.
|
|
||||||
url: https://matrix.to/#/#custommenu:neutralnetwork.org
|
|
||||||
+103
@@ -0,0 +1,103 @@
|
|||||||
|
steps:
|
||||||
|
"Verify tag and app version":
|
||||||
|
image: alpine
|
||||||
|
commands:
|
||||||
|
- TAG=${CI_COMMIT_TAG/v//}
|
||||||
|
- grep "<version>$TAG</version>" appinfo/info.xml
|
||||||
|
when:
|
||||||
|
event: [tag]
|
||||||
|
|
||||||
|
"Install dependencies":
|
||||||
|
image: node:16
|
||||||
|
pull: true
|
||||||
|
commands:
|
||||||
|
- npm i
|
||||||
|
when:
|
||||||
|
event: [tag, push, pull_request, manual]
|
||||||
|
branch: [master, develop, feature/*, fix/*, bugfix/*, translations]
|
||||||
|
|
||||||
|
"Check dependencies":
|
||||||
|
image: gitnet.fr/deblan/osv-detector:v0.10
|
||||||
|
commands:
|
||||||
|
- osv-detector package-lock.json
|
||||||
|
failure: ignore
|
||||||
|
|
||||||
|
"Build JS":
|
||||||
|
image: node:16
|
||||||
|
commands:
|
||||||
|
- npm run build
|
||||||
|
when:
|
||||||
|
event: [tag, push, pull_request, manual]
|
||||||
|
branch: [master, develop, feature/*, fix/*, bugfix/*, translations]
|
||||||
|
|
||||||
|
"Build translations":
|
||||||
|
image: deblan/php:8.0
|
||||||
|
commands:
|
||||||
|
- php bin/generate_l10n.php
|
||||||
|
when:
|
||||||
|
event: [tag, push, pull_request, manual]
|
||||||
|
branch: [master, develop, feature/*, fix/*, bugfix/*, translations]
|
||||||
|
|
||||||
|
"Create signature":
|
||||||
|
image: nextcloud:25
|
||||||
|
secrets: [app_certificate, app_public_certificate]
|
||||||
|
environment:
|
||||||
|
SQLITE_DATABASE: /var/www/data/data.db
|
||||||
|
NEXTCLOUD_ADMIN_USER: admin
|
||||||
|
NEXTCLOUD_ADMIN_PASSWORD: admin
|
||||||
|
commands:
|
||||||
|
- echo "$APP_CERTIFICATE" > "/tmp/side_menu.key"
|
||||||
|
- echo "$APP_PUBLIC_CERTIFICATE" > "/tmp/side_menu.crt"
|
||||||
|
- mkdir /tmp/app
|
||||||
|
- cp -r README.md CHANGELOG.md appinfo css lib img l10n js src templates screenshots vendor /tmp/app
|
||||||
|
- /usr/src/nextcloud/occ integrity:sign-app
|
||||||
|
--privateKey=/tmp/side_menu.key
|
||||||
|
--certificate=/tmp/side_menu.crt
|
||||||
|
--path=/tmp/app
|
||||||
|
- mv /tmp/app/appinfo/signature.json appinfo/
|
||||||
|
when:
|
||||||
|
event: [tag]
|
||||||
|
|
||||||
|
# check-code-quality:
|
||||||
|
# image: sonarsource/sonar-scanner-cli
|
||||||
|
# secrets: [sonar_token, sonar_host, sonar_project]
|
||||||
|
# commands:
|
||||||
|
# - sonar-scanner
|
||||||
|
# -Dsonar.projectKey=$SONAR_PROJECT
|
||||||
|
# -Dsonar.sources=.
|
||||||
|
# -Dsonar.host.url=$SONAR_HOST
|
||||||
|
# -Dsonar.pullrequest.key=$CI_COMMIT_PULL_REQUEST
|
||||||
|
# -Dsonar.pullrequest.branch=$CI_COMMIT_SOURCE_BRANCH
|
||||||
|
# -Dsonar.pullrequest.base=$CI_COMMIT_TARGET_BRANCH
|
||||||
|
# failure: ignore
|
||||||
|
# when:
|
||||||
|
# event: [pull_request]
|
||||||
|
|
||||||
|
"Create package":
|
||||||
|
image: deblan/php:8.0
|
||||||
|
volumes:
|
||||||
|
- /var/www/html/artifacts:/var/www/html/artifacts
|
||||||
|
secrets: [app_certificate]
|
||||||
|
commands:
|
||||||
|
- apt-get update
|
||||||
|
- apt-get install -y zip make
|
||||||
|
- mkdir -p "$HOME/.nextcloud/certificates"
|
||||||
|
- echo "$APP_CERTIFICATE" > "$HOME/.nextcloud/certificates/side_menu.key"
|
||||||
|
- export VERSION=$(grep "<version>" appinfo/info.xml | grep -o "[0-9]*\.[0-9]*\.[0-9]*" --color=never)
|
||||||
|
- export RELEASE_DIRECTORY="/var/www/html/artifacts/deblan/side_menu"
|
||||||
|
- make release
|
||||||
|
when:
|
||||||
|
event: [tag]
|
||||||
|
|
||||||
|
"Push release":
|
||||||
|
image: plugins/gitea-release
|
||||||
|
volumes:
|
||||||
|
- /var/www/html/artifacts:/var/www/html/artifacts
|
||||||
|
settings:
|
||||||
|
api_key:
|
||||||
|
from_secret: gitnet_api_key
|
||||||
|
base_url: https://gitnet.fr
|
||||||
|
note: ${CI_COMMIT_MESSAGE}
|
||||||
|
files: /var/www/html/artifacts/deblan/side_menu/${CI_COMMIT_TAG/v//}/*
|
||||||
|
when:
|
||||||
|
event: [tag]
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
variables:
|
|
||||||
volumes: &volumes
|
|
||||||
- /data/${CI_REPO}:/builds
|
|
||||||
|
|
||||||
when:
|
|
||||||
event: [tag, push, pull_request, manual]
|
|
||||||
branch: [master, develop, feature/*, fix/*, bugfix/*, translations]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
"Install dependencies":
|
|
||||||
image: node:16
|
|
||||||
pull: true
|
|
||||||
commands:
|
|
||||||
- npm i
|
|
||||||
|
|
||||||
"Build JS":
|
|
||||||
image: node:16
|
|
||||||
commands:
|
|
||||||
- npm run build
|
|
||||||
|
|
||||||
"Build translations":
|
|
||||||
image: deblan/php:8.3
|
|
||||||
commands:
|
|
||||||
- php bin/generate_l10n.php
|
|
||||||
|
|
||||||
"Build cache":
|
|
||||||
image: gitnet.fr/deblan/woodpecker-cache
|
|
||||||
volumes: *volumes
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
variables:
|
|
||||||
volumes: &volumes
|
|
||||||
- /data/${CI_REPO}:/builds
|
|
||||||
- /var/www/html/artifacts:/var/www/html/artifacts
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- build
|
|
||||||
|
|
||||||
when:
|
|
||||||
event: [tag]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
"Verify tag and app version":
|
|
||||||
image: alpine
|
|
||||||
commands:
|
|
||||||
- TAG=${CI_COMMIT_TAG/v//}
|
|
||||||
- grep "<version>$TAG</version>" appinfo/info.xml
|
|
||||||
|
|
||||||
"Create signature":
|
|
||||||
image: nextcloud:25
|
|
||||||
secrets: [app_certificate, app_public_certificate]
|
|
||||||
volumes: *volumes
|
|
||||||
environment:
|
|
||||||
SQLITE_DATABASE: /var/www/data/data.db
|
|
||||||
NEXTCLOUD_ADMIN_USER: admin
|
|
||||||
NEXTCLOUD_ADMIN_PASSWORD: admin
|
|
||||||
commands:
|
|
||||||
- cd "/builds/$CI_COMMIT_SHA"
|
|
||||||
- echo "$APP_CERTIFICATE" > "/tmp/side_menu.key"
|
|
||||||
- echo "$APP_PUBLIC_CERTIFICATE" > "/tmp/side_menu.crt"
|
|
||||||
- mkdir /tmp/app
|
|
||||||
- cp -r README.md CHANGELOG.md appinfo css lib img l10n js src templates screenshots vendor /tmp/app
|
|
||||||
- /usr/src/nextcloud/occ integrity:sign-app
|
|
||||||
--privateKey=/tmp/side_menu.key
|
|
||||||
--certificate=/tmp/side_menu.crt
|
|
||||||
--path=/tmp/app
|
|
||||||
- mv /tmp/app/appinfo/signature.json appinfo/
|
|
||||||
|
|
||||||
"Create package":
|
|
||||||
image: deblan/php:8.3
|
|
||||||
volumes: *volumes
|
|
||||||
secrets: [app_certificate]
|
|
||||||
commands:
|
|
||||||
- cd "/builds/$CI_COMMIT_SHA"
|
|
||||||
- apt-get update
|
|
||||||
- apt-get install -y zip make
|
|
||||||
- mkdir -p "$HOME/.nextcloud/certificates"
|
|
||||||
- echo "$APP_CERTIFICATE" > "$HOME/.nextcloud/certificates/side_menu.key"
|
|
||||||
- export VERSION=$(grep "<version>" appinfo/info.xml | grep -o "[0-9]*\.[0-9]*\.[0-9]*" --color=never)
|
|
||||||
- export RELEASE_DIRECTORY="/var/www/html/artifacts/deblan/side_menu"
|
|
||||||
- make release
|
|
||||||
|
|
||||||
"Push release":
|
|
||||||
image: plugins/gitea-release
|
|
||||||
volumes: *volumes
|
|
||||||
settings:
|
|
||||||
api_key:
|
|
||||||
from_secret: gitnet_api_key
|
|
||||||
base_url: https://gitnet.fr
|
|
||||||
note: ${CI_COMMIT_MESSAGE}
|
|
||||||
files: /var/www/html/artifacts/deblan/side_menu/${CI_COMMIT_TAG/v//}/*
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
variables:
|
|
||||||
volumes: &volumes
|
|
||||||
- /data/${CI_REPO}:/builds
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- build
|
|
||||||
|
|
||||||
skip_clone: true
|
|
||||||
|
|
||||||
steps:
|
|
||||||
"Check dependencies":
|
|
||||||
image: gitnet.fr/deblan/osv-detector:v0.10
|
|
||||||
volumes: *volumes
|
|
||||||
commands:
|
|
||||||
- cd "/builds/$CI_COMMIT_SHA"
|
|
||||||
- osv-detector package-lock.json
|
|
||||||
failure: ignore
|
|
||||||
@@ -1,25 +1,5 @@
|
|||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
## 3.13.1
|
|
||||||
### Fixed
|
|
||||||
* fix #354: remove the opener when the menu is always displayed
|
|
||||||
* fix extra margin between the logo and the opener
|
|
||||||
|
|
||||||
## 3.13.0
|
|
||||||
### Added
|
|
||||||
* show apps generated with Tables (fix #349)
|
|
||||||
* add constructor property promotion
|
|
||||||
### Fixed
|
|
||||||
* remove .app-navigation--close translationX for always-displayed menu (fix #348)
|
|
||||||
|
|
||||||
## 3.12.0
|
|
||||||
### Added
|
|
||||||
* add compatibility with NC29
|
|
||||||
|
|
||||||
## 3.11.8
|
|
||||||
### Fixed
|
|
||||||
* move the logo inside #nextcloud element (fix #278 #239) [NC26]
|
|
||||||
|
|
||||||
## 3.11.7
|
## 3.11.7
|
||||||
### Added
|
### Added
|
||||||
* update translations
|
* update translations
|
||||||
|
|||||||
+3
-3
@@ -32,7 +32,7 @@ Notice
|
|||||||
Because I believe in a free and decentralized Internet, [Gitnet](https://gitnet.fr) is **self-hosted at home**.
|
Because I believe in a free and decentralized Internet, [Gitnet](https://gitnet.fr) is **self-hosted at home**.
|
||||||
In case of downtime, you can download **Custom Menu** from [here](https://kim.deblan.fr/~side_menu/).
|
In case of downtime, you can download **Custom Menu** from [here](https://kim.deblan.fr/~side_menu/).
|
||||||
]]></description>
|
]]></description>
|
||||||
<version>3.13.1</version>
|
<version>3.11.7</version>
|
||||||
<licence>agpl</licence>
|
<licence>agpl</licence>
|
||||||
<author mail="contact@deblan.fr" homepage="https://www.deblan.io/">Simon Vieille</author>
|
<author mail="contact@deblan.fr" homepage="https://www.deblan.io/">Simon Vieille</author>
|
||||||
<namespace>SideMenu</namespace>
|
<namespace>SideMenu</namespace>
|
||||||
@@ -54,8 +54,8 @@ In case of downtime, you can download **Custom Menu** from [here](https://kim.de
|
|||||||
<screenshot>https://gitnet.fr/deblan/side_menu/raw/branch/master/screenshots/nc25_big_menu.png</screenshot>
|
<screenshot>https://gitnet.fr/deblan/side_menu/raw/branch/master/screenshots/nc25_big_menu.png</screenshot>
|
||||||
<screenshot>https://gitnet.fr/deblan/side_menu/raw/branch/master/screenshots/nc25_default_menu.png</screenshot>
|
<screenshot>https://gitnet.fr/deblan/side_menu/raw/branch/master/screenshots/nc25_default_menu.png</screenshot>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<nextcloud min-version="25" max-version="29"/>
|
<nextcloud min-version="25" max-version="28"/>
|
||||||
<php min-version="8.0"/>
|
<php min-version="7.4"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<settings>
|
<settings>
|
||||||
<admin>OCA\SideMenu\Settings\Admin</admin>
|
<admin>OCA\SideMenu\Settings\Admin</admin>
|
||||||
|
|||||||
+13
-67
@@ -1,75 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Imports a json configuration into a sqlite database.
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
* php bin/import_config.php /path/to/config.json /path/to/owncloud.db
|
||||||
|
*/
|
||||||
|
|
||||||
function showUsageAndExit(int $code)
|
$configFile = $argv[1];
|
||||||
{
|
$databaseFile = $argv[2];
|
||||||
global $argv;
|
|
||||||
|
|
||||||
echo "${argv[0]} [--help] --config /path/to/config/config.php --file /path/to/config.json\n";
|
$content = file_get_contents($configFile);
|
||||||
|
$config = json_decode($content, true);
|
||||||
|
|
||||||
exit($code);
|
$pdo = new \Pdo(sprintf('sqlite:%s', $databaseFile));
|
||||||
}
|
$stmt = $pdo->prepare('UPDATE oc_appconfig SET configvalue=:value WHERE configkey=:key and appid=:appId');
|
||||||
|
|
||||||
function value(string $shortName, string $longName, array $options, bool $required = true): ?string
|
foreach ($config as $key => $value) {
|
||||||
{
|
|
||||||
$value = $options[$shortName] ?? $options[$longName] ?? null;
|
|
||||||
|
|
||||||
if (is_array($value)) {
|
|
||||||
echo "To much --{$longName}\n";
|
|
||||||
showUsageAndExit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($value) && $required) {
|
|
||||||
echo "--{$longName} is missing\n";
|
|
||||||
showUsageAndExit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
$options = getopt('t:f:c:h', [
|
|
||||||
'type:',
|
|
||||||
'file:',
|
|
||||||
'config:',
|
|
||||||
'help',
|
|
||||||
]);
|
|
||||||
|
|
||||||
$help = value('h', 'help', $options, false);
|
|
||||||
$config = value('c', 'config', $options);
|
|
||||||
$file = value('f', 'file', $options);
|
|
||||||
|
|
||||||
if (!is_readable($config) && !is_file($config)) {
|
|
||||||
echo "No such file: {$config}\n";
|
|
||||||
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_readable($file) && !is_file($file)) {
|
|
||||||
echo "No such file: {$file}\n";
|
|
||||||
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
$appConfig = json_decode(file_get_contents($file), true);
|
|
||||||
|
|
||||||
require $config;
|
|
||||||
|
|
||||||
if ('mysql' === $CONFIG['dbtype']) {
|
|
||||||
$pdo = new \PDO(
|
|
||||||
'mysql:host='.$CONFIG['dbhost'].';dbname='.$CONFIG['dbname'],
|
|
||||||
$CONFIG['dbuser'],
|
|
||||||
$CONFIG['dbpassword']
|
|
||||||
);
|
|
||||||
} elseif ($CONFIG['dbtype']) {
|
|
||||||
$pdo = new \PDO(sprintf('sqlite:%s', $CONFIG['datadirectory'].'/owncloud.db'));
|
|
||||||
} else {
|
|
||||||
echo "dbtype is not valid\n";
|
|
||||||
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
$stmt = $pdo->prepare('UPDATE '.$CONFIG['dbtableprefix'].'appconfig SET configvalue=:value WHERE configkey=:key and appid=:appId');
|
|
||||||
|
|
||||||
foreach ($appConfig as $key => $value) {
|
|
||||||
$stmt->execute([
|
$stmt->execute([
|
||||||
'appId' => 'side_menu',
|
'appId' => 'side_menu',
|
||||||
'key' => $key,
|
'key' => $key,
|
||||||
|
|||||||
+2
-7
@@ -89,10 +89,6 @@
|
|||||||
.side-menu-opener span {
|
.side-menu-opener span {
|
||||||
position: relative;
|
position: relative;
|
||||||
left: 50px;
|
left: 50px;
|
||||||
display: block;
|
|
||||||
width: 1px;
|
|
||||||
height: 1px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.side-menu-opener:active, .side-menu-opener:focus {
|
.side-menu-opener:active, .side-menu-opener:focus {
|
||||||
@@ -297,9 +293,8 @@
|
|||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
|
|
||||||
.side-menu-always-displayed .app-navigation-toggle-wrapper {
|
.side-menu-always-displayed .app-navigation--close {
|
||||||
right: 0 !important;
|
transform: translateX(calc(-100% + 50px));
|
||||||
margin-left: 0 !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#side-menu.side-menu-with-categories {
|
#side-menu.side-menu-with-categories {
|
||||||
|
|||||||
@@ -22,25 +22,37 @@ use OCA\SideMenu\AppInfo\Application;
|
|||||||
use OCP\AppFramework\Controller;
|
use OCP\AppFramework\Controller;
|
||||||
use OCP\AppFramework\Http\DataDownloadResponse;
|
use OCP\AppFramework\Http\DataDownloadResponse;
|
||||||
use OCP\AppFramework\Http\RedirectResponse;
|
use OCP\AppFramework\Http\RedirectResponse;
|
||||||
|
use OCP\AppFramework\Http\Response;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
use OCP\IURLGenerator;
|
use OCP\IURLGenerator;
|
||||||
|
|
||||||
class AdminSettingController extends Controller
|
class AdminSettingController extends Controller
|
||||||
{
|
{
|
||||||
public function __construct(
|
/**
|
||||||
$appName,
|
* @var IConfig
|
||||||
IRequest $request,
|
*/
|
||||||
protected IConfig $config,
|
protected $config;
|
||||||
protected IURLGenerator $urlGenerator
|
|
||||||
) {
|
/**
|
||||||
|
* @var IURLGenerator
|
||||||
|
*/
|
||||||
|
protected $urlGenerator;
|
||||||
|
|
||||||
|
public function __construct($appName, IRequest $request, IConfig $config, IURLGenerator $urlGenerator)
|
||||||
|
{
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
|
|
||||||
|
$this->config = $config;
|
||||||
|
$this->urlGenerator = $urlGenerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
|
*
|
||||||
|
* @return RedirectResponse
|
||||||
*/
|
*/
|
||||||
public function removeCache(): RedirectResponse
|
public function removeCache()
|
||||||
{
|
{
|
||||||
$this->config->setAppValue(Application::APP_ID, 'cache-categories', '[]');
|
$this->config->setAppValue(Application::APP_ID, 'cache-categories', '[]');
|
||||||
|
|
||||||
@@ -51,8 +63,10 @@ class AdminSettingController extends Controller
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function exportConfiguration(): DataDownloadResponse
|
public function exportConfiguration()
|
||||||
{
|
{
|
||||||
$keys = $this->config->getAppKeys(Application::APP_ID);
|
$keys = $this->config->getAppKeys(Application::APP_ID);
|
||||||
$appConfig = [];
|
$appConfig = [];
|
||||||
|
|||||||
@@ -29,14 +29,28 @@ use OCP\IUserSession;
|
|||||||
|
|
||||||
class AppController extends Controller
|
class AppController extends Controller
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var ConfigProxy
|
||||||
|
*/
|
||||||
|
protected $config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var AppRepository
|
||||||
|
*/
|
||||||
|
protected $appRepository;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
string $appName,
|
string $appName,
|
||||||
IRequest $request,
|
IRequest $request,
|
||||||
protected AppRepository $appRepository,
|
AppRepository $appRepository,
|
||||||
protected IURLGenerator $urlGenerator,
|
IURLGenerator $urlGenerator,
|
||||||
protected ConfigProxy $config
|
ConfigProxy $config
|
||||||
) {
|
) {
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
|
|
||||||
|
$this->appRepository = $appRepository;
|
||||||
|
$this->urlGenerator = $urlGenerator;
|
||||||
|
$this->config = $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -32,26 +32,49 @@ use OCP\IUserSession;
|
|||||||
|
|
||||||
class CssController extends Controller
|
class CssController extends Controller
|
||||||
{
|
{
|
||||||
protected ?User $user;
|
/**
|
||||||
|
* @var ConfigProxy
|
||||||
|
*/
|
||||||
|
protected $config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var User
|
||||||
|
*/
|
||||||
|
protected $user;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ThemingDefaults
|
||||||
|
*/
|
||||||
|
protected $theming;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Color
|
||||||
|
*/
|
||||||
|
protected $color;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
string $appName,
|
string $appName,
|
||||||
IRequest $request,
|
IRequest $request,
|
||||||
protected ConfigProxy $config,
|
ConfigProxy $config,
|
||||||
protected ThemingDefaults $theming,
|
ThemingDefaults $theming,
|
||||||
protected Color $color
|
Color $color
|
||||||
) {
|
) {
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
|
|
||||||
$this->user = OC::$server[IUserSession::class]->getUser();
|
$this->user = OC::$server[IUserSession::class]->getUser();
|
||||||
|
$this->config = $config;
|
||||||
|
$this->theming = $theming;
|
||||||
|
$this->color = $color;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
* @PublicPage
|
* @PublicPage
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function stylesheet(): TemplateResponse
|
public function stylesheet()
|
||||||
{
|
{
|
||||||
$response = new TemplateResponse(Application::APP_ID, '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');
|
||||||
@@ -84,15 +107,15 @@ class CssController extends Controller
|
|||||||
$isDarkThemeUserEnabled = 'dark' === $this->config->getUserValue($this->user, 'theme', '', 'accessibility');
|
$isDarkThemeUserEnabled = 'dark' === $this->config->getUserValue($this->user, 'theme', '', 'accessibility');
|
||||||
$isBreezeDarkUserEnabled = $this->config->getUserValue($this->user, 'theme_enabled', '', 'breezedark');
|
$isBreezeDarkUserEnabled = $this->config->getUserValue($this->user, 'theme_enabled', '', 'breezedark');
|
||||||
|
|
||||||
$isBreezeDarkUserEnabled = '1' === $isBreezeDarkUserEnabled
|
$isBreezeDarkUserEnabled = '1' === $isBreezeDarkUserEnabled ||
|
||||||
|| ($isBreezeDarkGlobalEnabled && '' === $isBreezeDarkUserEnabled);
|
($isBreezeDarkGlobalEnabled && '' === $isBreezeDarkUserEnabled);
|
||||||
} else {
|
} else {
|
||||||
$isDarkThemeUserEnabled = false;
|
$isDarkThemeUserEnabled = false;
|
||||||
$isBreezeDarkUserEnabled = false;
|
$isBreezeDarkUserEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$isDarkMode = ($isAccessibilityAppEnabled && $isDarkThemeUserEnabled)
|
$isDarkMode = ($isAccessibilityAppEnabled && $isDarkThemeUserEnabled) ||
|
||||||
|| ($isBreezeDarkAppEnabled && $isBreezeDarkUserEnabled);
|
($isBreezeDarkAppEnabled && $isBreezeDarkUserEnabled);
|
||||||
|
|
||||||
$primaryColor = $this->theming->getColorPrimary();
|
$primaryColor = $this->theming->getColorPrimary();
|
||||||
$lightenPrimaryColor = $this->color->adjustBrightness($primaryColor, 0.2);
|
$lightenPrimaryColor = $this->color->adjustBrightness($primaryColor, 0.2);
|
||||||
|
|||||||
@@ -32,14 +32,32 @@ use OCP\L10N\IFactory;
|
|||||||
|
|
||||||
class JsController extends Controller
|
class JsController extends Controller
|
||||||
{
|
{
|
||||||
protected ?User $user;
|
/**
|
||||||
|
* @var ConfigProxy
|
||||||
|
*/
|
||||||
|
protected $config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var User
|
||||||
|
*/
|
||||||
|
protected $user;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ThemingDefaults
|
||||||
|
*/
|
||||||
|
protected $themingDefaults;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var IFactory
|
||||||
|
*/
|
||||||
|
protected $l10nFactory;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
string $appName,
|
string $appName,
|
||||||
IRequest $request,
|
IRequest $request,
|
||||||
protected ConfigProxy $config,
|
ConfigProxy $config,
|
||||||
protected ThemingDefaults $themingDefaults,
|
ThemingDefaults $themingDefaults,
|
||||||
protected IFactory $l10nFactory
|
IFactory $l10nFactory
|
||||||
) {
|
) {
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
namespace OCA\SideMenu\Controller;
|
namespace OCA\SideMenu\Controller;
|
||||||
|
|
||||||
use OC;
|
use OC;
|
||||||
|
use OC\App\AppStore\Fetcher\CategoryFetcher;
|
||||||
use OC\URLGenerator;
|
use OC\URLGenerator;
|
||||||
use OCA\SideMenu\Service\AppRepository;
|
use OCA\SideMenu\Service\AppRepository;
|
||||||
use OCA\SideMenu\Service\CategoryRepository;
|
use OCA\SideMenu\Service\CategoryRepository;
|
||||||
@@ -31,24 +32,57 @@ use OCP\L10N\IFactory;
|
|||||||
|
|
||||||
class NavController extends Controller
|
class NavController extends Controller
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var ConfigProxy
|
||||||
|
*/
|
||||||
|
protected $config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var AppRepository
|
||||||
|
*/
|
||||||
|
protected $appRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var IFactory
|
||||||
|
*/
|
||||||
|
protected $l10nFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var CategoryFetcher
|
||||||
|
*/
|
||||||
|
protected $categoryFetcher;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var URLGenerator
|
||||||
|
*/
|
||||||
|
protected $router;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
string $appName,
|
string $appName,
|
||||||
IRequest $request,
|
IRequest $request,
|
||||||
protected ConfigProxy $config,
|
ConfigProxy $config,
|
||||||
protected AppRepository $appRepository,
|
AppRepository $appRepository,
|
||||||
protected CategoryRepository $categoryRepository,
|
CategoryRepository $categoryRepository,
|
||||||
protected URLGenerator $router,
|
URLGenerator $router,
|
||||||
protected IFactory $l10nFactory
|
IFactory $l10nFactory
|
||||||
) {
|
) {
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
|
|
||||||
|
$this->config = $config;
|
||||||
|
$this->appRepository = $appRepository;
|
||||||
|
$this->categoryRepository = $categoryRepository;
|
||||||
|
$this->l10nFactory = $l10nFactory;
|
||||||
|
$this->router = $router;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
* @PublicPage
|
* @PublicPage
|
||||||
|
*
|
||||||
|
* @return JSONResponse
|
||||||
*/
|
*/
|
||||||
public function items(): JSONResponse
|
public function items()
|
||||||
{
|
{
|
||||||
$user = OC::$server[IUserSession::class]->getUser();
|
$user = OC::$server[IUserSession::class]->getUser();
|
||||||
$items = [];
|
$items = [];
|
||||||
@@ -155,11 +189,11 @@ class NavController extends Controller
|
|||||||
|
|
||||||
usort($items, function ($a, $b) use ($categoriesLabels) {
|
usort($items, function ($a, $b) use ($categoriesLabels) {
|
||||||
foreach ($categoriesLabels as $key => $value) {
|
foreach ($categoriesLabels as $key => $value) {
|
||||||
if ('other' === $a['categoryId']) {
|
if ($a['categoryId'] === 'other') {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('other' === $b['categoryId']) {
|
if ($b['categoryId'] === 'other') {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,20 +21,40 @@ namespace OCA\SideMenu\Controller;
|
|||||||
use OCA\SideMenu\AppInfo\Application;
|
use OCA\SideMenu\AppInfo\Application;
|
||||||
use OCA\SideMenu\Service\ConfigProxy;
|
use OCA\SideMenu\Service\ConfigProxy;
|
||||||
use OCP\AppFramework\Controller;
|
use OCP\AppFramework\Controller;
|
||||||
|
use OCP\AppFramework\Http\Response;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
use OCP\IUserSession;
|
use OCP\IUserSession;
|
||||||
|
|
||||||
class PersonalSettingController extends Controller
|
class PersonalSettingController extends Controller
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var IConfig
|
||||||
|
*/
|
||||||
|
protected $config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ConfigProxy
|
||||||
|
*/
|
||||||
|
protected $configProxy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var IUserSession
|
||||||
|
*/
|
||||||
|
protected $userSession;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
$appName,
|
$appName,
|
||||||
IRequest $request,
|
IRequest $request,
|
||||||
protected IConfig $config,
|
IConfig $config,
|
||||||
protected ConfigProxy $configProxy,
|
ConfigProxy $configProxy,
|
||||||
protected IUserSession $userSession
|
IUserSession $userSession
|
||||||
) {
|
) {
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
|
|
||||||
|
$this->config = $config;
|
||||||
|
$this->configProxy = $configProxy;
|
||||||
|
$this->userSession = $userSession;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,8 +63,10 @@ class PersonalSettingController extends Controller
|
|||||||
*
|
*
|
||||||
* @param mixed $name
|
* @param mixed $name
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function valueSet($name, $value): array
|
public function valueSet($name, $value)
|
||||||
{
|
{
|
||||||
$doSave = false;
|
$doSave = false;
|
||||||
$user = $this->userSession->getUser();
|
$user = $this->userSession->getUser();
|
||||||
|
|||||||
@@ -3,12 +3,7 @@
|
|||||||
namespace OCA\SideMenu\Service;
|
namespace OCA\SideMenu\Service;
|
||||||
|
|
||||||
use OC\User\User;
|
use OC\User\User;
|
||||||
use OCA\SideMenu\AppInfo\Application;
|
|
||||||
use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent;
|
|
||||||
use OCP\AppFramework\Http\TemplateResponse;
|
|
||||||
use OCP\EventDispatcher\IEventDispatcher;
|
|
||||||
use OCP\INavigationManager;
|
use OCP\INavigationManager;
|
||||||
use OCP\IUserSession;
|
|
||||||
use OCP\L10N\IFactory;
|
use OCP\L10N\IFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -18,25 +13,51 @@ use OCP\L10N\IFactory;
|
|||||||
*/
|
*/
|
||||||
class AppRepository
|
class AppRepository
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var \OC_App
|
||||||
|
*/
|
||||||
|
protected $ocApp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var IFactory
|
||||||
|
*/
|
||||||
|
protected $l10nFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ConfigProxy
|
||||||
|
*/
|
||||||
|
protected $config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var CategoryRepository
|
||||||
|
*/
|
||||||
|
protected $categoryRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var INavigationManager
|
||||||
|
*/
|
||||||
|
protected $navigationManager;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected \OC_App $ocApp,
|
\OC_App $ocApp,
|
||||||
protected INavigationManager $navigationManager,
|
INavigationManager $navigationManager,
|
||||||
protected IFactory $l10nFactory,
|
IFactory $l10nFactory,
|
||||||
protected ConfigProxy $config,
|
ConfigProxy $config,
|
||||||
protected CategoryRepository $categoryRepository,
|
CategoryRepository $categoryRepository
|
||||||
protected IEventDispatcher $dispatcher,
|
|
||||||
protected IUserSession $userSession,
|
|
||||||
) {
|
) {
|
||||||
$this->dispatcher->dispatchTyped(new BeforeTemplateRenderedEvent(
|
$this->ocApp = $ocApp;
|
||||||
$this->userSession->isLoggedIn(),
|
$this->l10nFactory = $l10nFactory;
|
||||||
new TemplateResponse(Application::APP_NAME, '')
|
$this->config = $config;
|
||||||
));
|
$this->navigationManager = $navigationManager;
|
||||||
|
$this->categoryRepository = $categoryRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves visibles apps.
|
* Retrieves visibles apps.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getVisibleApps(): array
|
public function getVisibleApps()
|
||||||
{
|
{
|
||||||
$navigation = $this->navigationManager->getAll();
|
$navigation = $this->navigationManager->getAll();
|
||||||
$appCategoriesCustom = $this->config->getAppValueArray('apps-categories-custom', '[]');
|
$appCategoriesCustom = $this->config->getAppValueArray('apps-categories-custom', '[]');
|
||||||
@@ -69,14 +90,6 @@ class AppRepository
|
|||||||
'external_links',
|
'external_links',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
} elseif ('tables_application' === substr($app['id'], 0, 18)) {
|
|
||||||
$visibleApps[$app['id']] = [
|
|
||||||
'id' => $app['id'],
|
|
||||||
'name' => $this->getAppName($app),
|
|
||||||
'href' => $app['href'],
|
|
||||||
'icon' => $app['icon'],
|
|
||||||
'category' => [],
|
|
||||||
];
|
|
||||||
} elseif ('files' === $app['id']) {
|
} elseif ('files' === $app['id']) {
|
||||||
$visibleApps[$app['id']] = [
|
$visibleApps[$app['id']] = [
|
||||||
'id' => $app['id'],
|
'id' => $app['id'],
|
||||||
@@ -97,7 +110,7 @@ class AppRepository
|
|||||||
return $visibleApps;
|
return $visibleApps;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAppName($app): string
|
public function getAppName($app)
|
||||||
{
|
{
|
||||||
return $this->config->getAppValue(
|
return $this->config->getAppValue(
|
||||||
'app.navigation.name',
|
'app.navigation.name',
|
||||||
@@ -106,7 +119,7 @@ class AppRepository
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOrderedApps(?User $user = null): array
|
public function getOrderedApps(?User $user = null)
|
||||||
{
|
{
|
||||||
$apps = $this->getVisibleApps();
|
$apps = $this->getVisibleApps();
|
||||||
$orders = $this->config->getAppValueArray('apps-order', '[]');
|
$orders = $this->config->getAppValueArray('apps-order', '[]');
|
||||||
|
|||||||
@@ -15,19 +15,51 @@ use OCP\L10N\IFactory;
|
|||||||
*/
|
*/
|
||||||
class CategoryRepository
|
class CategoryRepository
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var CategoryFetcher
|
||||||
|
*/
|
||||||
|
protected $categoryFetcher;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var IFactory
|
||||||
|
*/
|
||||||
|
protected $l10nFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ConfigProxy
|
||||||
|
*/
|
||||||
|
protected $config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var IConfig
|
||||||
|
*/
|
||||||
|
protected $iConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var IUserSession
|
||||||
|
*/
|
||||||
|
protected $userSession;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected CategoryFetcher $categoryFetcher,
|
CategoryFetcher $categoryFetcher,
|
||||||
protected ConfigProxy $config,
|
ConfigProxy $config,
|
||||||
protected IConfig $iConfig,
|
IConfig $iConfig,
|
||||||
protected IFactory $l10nFactory,
|
IFactory $l10nFactory,
|
||||||
protected IUserSession $userSession
|
IUserSession $userSession
|
||||||
) {
|
) {
|
||||||
|
$this->categoryFetcher = $categoryFetcher;
|
||||||
|
$this->l10nFactory = $l10nFactory;
|
||||||
|
$this->config = $config;
|
||||||
|
$this->iConfig = $iConfig;
|
||||||
|
$this->userSession = $userSession;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves categories.
|
* Retrieves categories.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getOrderedCategories(): array
|
public function getOrderedCategories()
|
||||||
{
|
{
|
||||||
$currentLanguage = substr($this->l10nFactory->findLanguage(), 0, 2);
|
$currentLanguage = substr($this->l10nFactory->findLanguage(), 0, 2);
|
||||||
$type = $this->config->getAppValue('categories-order-type', 'default');
|
$type = $this->config->getAppValue('categories-order-type', 'default');
|
||||||
|
|||||||
@@ -13,7 +13,12 @@ use OCP\IConfig;
|
|||||||
*/
|
*/
|
||||||
class ConfigProxy
|
class ConfigProxy
|
||||||
{
|
{
|
||||||
public function __construct(protected IConfig $config)
|
/**
|
||||||
|
* @var IConfig
|
||||||
|
*/
|
||||||
|
protected $config;
|
||||||
|
|
||||||
|
public function __construct(IConfig $config)
|
||||||
{
|
{
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,12 @@ use OCP\IDBConnection;
|
|||||||
*/
|
*/
|
||||||
class LangRepository
|
class LangRepository
|
||||||
{
|
{
|
||||||
public function __construct(protected IDBConnection $db)
|
/**
|
||||||
|
* @var IDBConnection
|
||||||
|
*/
|
||||||
|
protected $db;
|
||||||
|
|
||||||
|
public function __construct(IDBConnection $db)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
}
|
}
|
||||||
|
|||||||
+59
-11
@@ -21,27 +21,75 @@ namespace OCA\SideMenu\Settings;
|
|||||||
use OCA\SideMenu\AppInfo\Application;
|
use OCA\SideMenu\AppInfo\Application;
|
||||||
use OCA\SideMenu\Service\AppRepository;
|
use OCA\SideMenu\Service\AppRepository;
|
||||||
use OCA\SideMenu\Service\CategoryRepository;
|
use OCA\SideMenu\Service\CategoryRepository;
|
||||||
use OCA\SideMenu\Service\Color;
|
|
||||||
use OCA\SideMenu\Service\ConfigProxy;
|
use OCA\SideMenu\Service\ConfigProxy;
|
||||||
use OCA\SideMenu\Service\LangRepository;
|
|
||||||
use OCA\Theming\ThemingDefaults;
|
|
||||||
use OCP\AppFramework\Http\TemplateResponse;
|
use OCP\AppFramework\Http\TemplateResponse;
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
use OCP\ILogger;
|
use OCP\ILogger;
|
||||||
use OCP\Settings\ISettings;
|
use OCP\Settings\ISettings;
|
||||||
|
use OCA\Theming\ThemingDefaults;
|
||||||
|
use OCA\SideMenu\Service\Color;
|
||||||
|
use OCA\SideMenu\Service\LangRepository;
|
||||||
|
|
||||||
class Admin implements ISettings
|
class Admin implements ISettings
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var IL10N
|
||||||
|
*/
|
||||||
|
private $l;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ILogger
|
||||||
|
*/
|
||||||
|
private $logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ConfigProxy
|
||||||
|
*/
|
||||||
|
private $config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var AppRepository
|
||||||
|
*/
|
||||||
|
private $appRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var CategoryRepository
|
||||||
|
*/
|
||||||
|
private $categoryRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ThemingDefaults
|
||||||
|
*/
|
||||||
|
protected $theming;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Color
|
||||||
|
*/
|
||||||
|
protected $color;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var LangRepository
|
||||||
|
*/
|
||||||
|
protected $langRepository;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected IL10N $l,
|
IL10N $l,
|
||||||
protected ILogger $logger,
|
ILogger $logger,
|
||||||
protected ConfigProxy $config,
|
ConfigProxy $config,
|
||||||
protected AppRepository $appRepository,
|
AppRepository $appRepository,
|
||||||
protected CategoryRepository $categoryRepository,
|
CategoryRepository $categoryRepository,
|
||||||
protected ThemingDefaults $theming,
|
ThemingDefaults $theming,
|
||||||
protected Color $color,
|
Color $color,
|
||||||
protected LangRepository $langRepository
|
LangRepository $langRepository
|
||||||
) {
|
) {
|
||||||
|
$this->l = $l;
|
||||||
|
$this->logger = $logger;
|
||||||
|
$this->config = $config;
|
||||||
|
$this->appRepository = $appRepository;
|
||||||
|
$this->categoryRepository = $categoryRepository;
|
||||||
|
$this->theming = $theming;
|
||||||
|
$this->color = $color;
|
||||||
|
$this->langRepository = $langRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -25,22 +25,51 @@ use OCP\Settings\IIconSection;
|
|||||||
|
|
||||||
class AdminSection implements IIconSection
|
class AdminSection implements IIconSection
|
||||||
{
|
{
|
||||||
public function __construct(
|
/**
|
||||||
protected IURLGenerator $url,
|
* @var IL10N
|
||||||
protected IL10N $l
|
*/
|
||||||
) {
|
private $l;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var IURLGenerator
|
||||||
|
*/
|
||||||
|
private $url;
|
||||||
|
|
||||||
|
public function __construct(IURLGenerator $url, IL10N $l)
|
||||||
|
{
|
||||||
|
$this->url = $url;
|
||||||
|
$this->l = $l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns the ID of the section. It is supposed to be a lower case string,
|
||||||
|
* e.g. 'ldap'.
|
||||||
|
*
|
||||||
|
* @returns string
|
||||||
|
*/
|
||||||
public function getID()
|
public function getID()
|
||||||
{
|
{
|
||||||
return Application::APP_ID;
|
return Application::APP_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns the translated name as it should be displayed, e.g. 'LDAP / AD
|
||||||
|
* integration'. Use the L10N service to translate it.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function getName()
|
public function getName()
|
||||||
{
|
{
|
||||||
return $this->l->t(Application::APP_NAME);
|
return $this->l->t(Application::APP_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int whether the form should be rather on the top or bottom of
|
||||||
|
* the settings navigation. The sections are arranged in ascending order of
|
||||||
|
* the priority values. It is required to return a value between 0 and 99.
|
||||||
|
*
|
||||||
|
* E.g.: 70
|
||||||
|
*/
|
||||||
public function getPriority()
|
public function getPriority()
|
||||||
{
|
{
|
||||||
return 70;
|
return 70;
|
||||||
|
|||||||
@@ -29,13 +29,43 @@ use OCP\Settings\ISettings;
|
|||||||
|
|
||||||
class Personal implements ISettings
|
class Personal implements ISettings
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var IL10N
|
||||||
|
*/
|
||||||
|
private $l;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ILogger
|
||||||
|
*/
|
||||||
|
private $logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ConfigProxy
|
||||||
|
*/
|
||||||
|
private $config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var IUserSession
|
||||||
|
*/
|
||||||
|
private $userSession;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var AppRepository
|
||||||
|
*/
|
||||||
|
private $appRepository;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected IL10N $l,
|
IL10N $l,
|
||||||
protected ILogger $logger,
|
ILogger $logger,
|
||||||
protected ConfigProxy $config,
|
ConfigProxy $config,
|
||||||
protected IUserSession $userSession,
|
IUserSession $userSession,
|
||||||
protected AppRepository $appRepository
|
AppRepository $appRepository
|
||||||
) {
|
) {
|
||||||
|
$this->l = $l;
|
||||||
|
$this->logger = $logger;
|
||||||
|
$this->config = $config;
|
||||||
|
$this->userSession = $userSession;
|
||||||
|
$this->appRepository = $appRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -26,13 +26,34 @@ use OCP\Settings\IIconSection;
|
|||||||
|
|
||||||
class PersonalSection implements IIconSection
|
class PersonalSection implements IIconSection
|
||||||
{
|
{
|
||||||
public function __construct(
|
/**
|
||||||
protected IURLGenerator $url,
|
* @var IL10N
|
||||||
protected IL10N $l,
|
*/
|
||||||
protected ConfigProxy $configProxy
|
private $l;
|
||||||
) {
|
|
||||||
|
/**
|
||||||
|
* @var IURLGenerator
|
||||||
|
*/
|
||||||
|
private $url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ConfigProxy
|
||||||
|
*/
|
||||||
|
private $configProxy;
|
||||||
|
|
||||||
|
public function __construct(IURLGenerator $url, IL10N $l, ConfigProxy $configProxy)
|
||||||
|
{
|
||||||
|
$this->url = $url;
|
||||||
|
$this->l = $l;
|
||||||
|
$this->configProxy = $configProxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns the ID of the section. It is supposed to be a lower case string,
|
||||||
|
* e.g. 'ldap'.
|
||||||
|
*
|
||||||
|
* @returns string
|
||||||
|
*/
|
||||||
public function getID()
|
public function getID()
|
||||||
{
|
{
|
||||||
if ($this->configProxy->getAppValueBool('force', '0')) {
|
if ($this->configProxy->getAppValueBool('force', '0')) {
|
||||||
@@ -42,6 +63,12 @@ class PersonalSection implements IIconSection
|
|||||||
return Application::APP_ID;
|
return Application::APP_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns the translated name as it should be displayed, e.g. 'LDAP / AD
|
||||||
|
* integration'. Use the L10N service to translate it.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function getName()
|
public function getName()
|
||||||
{
|
{
|
||||||
if ($this->configProxy->getAppValueBool('force', '0')) {
|
if ($this->configProxy->getAppValueBool('force', '0')) {
|
||||||
@@ -51,6 +78,13 @@ class PersonalSection implements IIconSection
|
|||||||
return $this->l->t(Application::APP_NAME);
|
return $this->l->t(Application::APP_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int whether the form should be rather on the top or bottom of
|
||||||
|
* the settings navigation. The sections are arranged in ascending order of
|
||||||
|
* the priority values. It is required to return a value between 0 and 99.
|
||||||
|
*
|
||||||
|
* E.g.: 70
|
||||||
|
*/
|
||||||
public function getPriority()
|
public function getPriority()
|
||||||
{
|
{
|
||||||
if ($this->configProxy->getAppValueBool('force', '0')) {
|
if ($this->configProxy->getAppValueBool('force', '0')) {
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
v-bind:label="settings.name"
|
v-bind:label="settings.name"
|
||||||
v-bind:avatar="settings.avatar" />
|
v-bind:avatar="settings.avatar" />
|
||||||
<AppSearch v-model:search="search" />
|
<AppSearch v-model:search="search" />
|
||||||
<OpenerButton v-if="!alwaysDisplayed" />
|
<OpenerButton />
|
||||||
<Logo
|
<Logo
|
||||||
v-if="!avatar && !alwaysDisplayed && logo" v-bind:classes="{'side-menu-logo': true, 'avatardiv': false}"
|
v-if="!avatar && !alwaysDisplayed && logo" v-bind:classes="{'side-menu-logo': true, 'avatardiv': false}"
|
||||||
v-bind:image="logo"
|
v-bind:image="logo"
|
||||||
|
|||||||
@@ -42,11 +42,13 @@
|
|||||||
top: 49px;
|
top: 49px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#side-menu.hide-opener .side-menu-header .side-menu-opener.side-menu-closer {
|
#side-menu.hide-opener .side-menu-header .side-menu-opener.side-menu-closer
|
||||||
|
{
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
#side-menu.hide-opener.side-menu-with-categories .side-menu-search {
|
#side-menu.hide-opener.side-menu-with-categories .side-menu-search
|
||||||
|
{
|
||||||
float: none;
|
float: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ if ($_['always-displayed']) {
|
|||||||
const body = document.querySelector('body')
|
const body = document.querySelector('body')
|
||||||
const html = document.querySelector('html')
|
const html = document.querySelector('html')
|
||||||
const nextcloud = document.querySelector('#nextcloud')
|
const nextcloud = document.querySelector('#nextcloud')
|
||||||
const logo = document.querySelector('.header-left .logo')
|
|
||||||
|
|
||||||
const isTouchDevice = window.matchMedia("(pointer: coarse)").matches
|
const isTouchDevice = window.matchMedia("(pointer: coarse)").matches
|
||||||
|
|
||||||
@@ -171,10 +170,6 @@ if ($_['always-displayed']) {
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
if (nextcloud) {
|
if (nextcloud) {
|
||||||
if (logo && logo.parentNode !== nextcloud) {
|
|
||||||
nextcloud.appendChild(logo)
|
|
||||||
}
|
|
||||||
|
|
||||||
<?php if ($_['opener-position'] === 'before'): ?>
|
<?php if ($_['opener-position'] === 'before'): ?>
|
||||||
nextcloud.parentNode.insertBefore(sideMenuOpener, nextcloud)
|
nextcloud.parentNode.insertBefore(sideMenuOpener, nextcloud)
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
|
|||||||
Reference in New Issue
Block a user