Compare commits

..

11 Commits

Author SHA1 Message Date
Simon Vieille d279fbd813 change typo 2020-10-14 16:23:09 +02:00
Simon Vieille 0d98a40536 release v1.17.0 2020-10-14 16:16:06 +02:00
Simon Vieille 5e894f9f08 add admin actions: remove cache, export configuration 2020-10-14 16:14:50 +02:00
Simon Vieille 731d4f826b release v1.16.4 2020-10-14 10:00:21 +02:00
Simon Vieille 4225b157e0 app:check compliance 2020-10-14 09:57:42 +02:00
Simon Vieille 0eefcd23cd app:check compliance (info.xml) 2020-10-14 09:33:19 +02:00
Simon Vieille ead4ce9a6f release v1.16.3 2020-10-13 14:33:07 +02:00
Simon Vieille baa2a0748e fix links that must be opened in new window 2020-10-13 14:32:15 +02:00
Simon Vieille 5b5daa92b9 remove useless call 2020-10-13 13:26:08 +02:00
Simon Vieille b19911b02f release v1.16.2 2020-10-13 11:09:56 +02:00
Simon Vieille a57017e80b fix issue with personal settings when global settings are forced 2020-10-13 11:09:14 +02:00
11 changed files with 162 additions and 19 deletions
+7 -6
View File
@@ -1,5 +1,6 @@
<?xml version="1.0"?>
<info>
<info xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd">
<id>side_menu</id>
<name>Custom menu</name>
<summary>Modify the display of the menu.</summary>
@@ -19,10 +20,14 @@ If you like this application and want to support the development:
* ☕ [Buy me a coffee](https://www.buymeacoffee.com/deblan)
* 😃 [Leave a comment](https://apps.nextcloud.com/apps/side_menu#comments)
]]></description>
<version>1.17.0</version>
<licence>agpl</licence>
<author mail="contact@deblan.fr" homepage="https://www.deblan.io/">Simon Vieille</author>
<version>1.16.1</version>
<namespace>SideMenu</namespace>
<documentation>
<admin>https://gitnet.fr/deblan/side_menu/src/branch/master/README.md</admin>
<developer>https://gitnet.fr/deblan/side_menu/src/branch/master/README.md</developer>
</documentation>
<category>customization</category>
<website>https://gitnet.fr/deblan/side_menu</website>
<discussion>https://matrix.to/#/!GhfQePnOSPYpYEunWM:neutralnetwork.org</discussion>
@@ -34,10 +39,6 @@ If you like this application and want to support the development:
<screenshot>https://gitnet.fr/deblan/side_menu/raw/branch/master/screenshots/nc18_menu_always_displayed.png</screenshot>
<screenshot>https://gitnet.fr/deblan/side_menu/raw/branch/master/screenshots/nc20_big_menu_responsive.png</screenshot>
<screenshot>https://gitnet.fr/deblan/side_menu/raw/branch/master/screenshots/personal_settings.png</screenshot>
<documentation>
<admin>https://gitnet.fr/deblan/side_menu/src/branch/master/README.md</admin>
<developer>https://gitnet.fr/deblan/side_menu/src/branch/master/README.md</developer>
</documentation>
<dependencies>
<nextcloud min-version="18" max-version="20"/>
</dependencies>
+7 -5
View File
@@ -19,10 +19,12 @@
return [
'routes' => [
['name' => 'Css#stylesheet', 'url' => '/css/stylesheet', 'verb' => 'GET'],
['name' => 'Js#script', 'url' => '/js/script', 'verb' => 'GET'],
['name' => 'Js#config', 'url' => '/js/config', 'verb' => 'GET'],
['name' => 'Nav#items', 'url' => '/nav/items', 'verb' => 'GET'],
['name' => 'PersonalSetting#valueSet', 'url' => '/personalSetting/valueSet', 'verb' => 'POST'],
['name' => 'Css#stylesheet', 'url' => '/css/stylesheet', 'verb' => 'GET'],
['name' => 'Js#script', 'url' => '/js/script', 'verb' => 'GET'],
['name' => 'Js#config', 'url' => '/js/config', 'verb' => 'GET'],
['name' => 'Nav#items', 'url' => '/nav/items', 'verb' => 'GET'],
['name' => 'PersonalSetting#valueSet', 'url' => '/personalSetting/valueSet', 'verb' => 'POST'],
['name' => 'AdminSetting#removeCache', 'url' => '/admin/cache/remove', 'verb' => 'GET'],
['name' => 'AdminSetting#exportConfiguration', 'url' => '/admin/config/export', 'verb' => 'GET'],
],
];
+1 -1
View File
@@ -72,7 +72,7 @@ class Application extends App
$container = $this->getContainer();
$container->registerService('AppRepository', function (ContainerInterface $c) {
return new AppRepository(new OC_App());
return new AppRepository();
});
$container->registerService('ConfigProxy', function (ContainerInterface $c) {
+92
View File
@@ -0,0 +1,92 @@
<?php
/**
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace OCA\SideMenu\Controller;
use OCA\SideMenu\AppInfo\Application;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\DataDownloadResponse;
use OCP\AppFramework\Http\RedirectResponse;
use OCP\AppFramework\Http\Response;
use OCP\IConfig;
use OCP\IRequest;
use OCP\IURLGenerator;
class AdminSettingController extends Controller
{
/**
* @var IConfig
*/
protected $config;
/**
* @var IURLGenerator
*/
protected $urlGenerator;
public function __construct($appName, IRequest $request, IConfig $config, IURLGenerator $urlGenerator)
{
parent::__construct($appName, $request);
$this->config = $config;
$this->urlGenerator = $urlGenerator;
}
/**
* @NoCSRFRequired
*
* @return RedirectResponse
*/
public function removeCache()
{
$this->config->setAppValue(Application::APP_ID, 'cache-categories', '[]');
return new RedirectResponse($this->urlGenerator->linkToRoute('settings.AdminSettings.index', [
'section' => Application::APP_ID,
]).'#more');
}
/**
* @NoCSRFRequired
*
* @return Response
*/
public function exportConfiguration()
{
$keys = $this->config->getAppKeys(Application::APP_ID);
$config = [];
$excludedKeys = [
'cache',
'cache-categories',
];
foreach ($keys as $key) {
if (in_array($key, $excludedKeys)) {
continue;
}
$config[$key] = $this->config->getAppValue(Application::APP_ID, $key);
}
return new DataDownloadResponse(
json_encode($config, JSON_PRETTY_PRINT),
'config.json',
'text/json'
);
}
}
+2 -1
View File
@@ -98,6 +98,7 @@ class NavController extends Controller
$currentLanguage = substr($this->l10nFactory->findLanguage(), 0, 2);
$externalSitesInTopMenu = $this->config->getAppValueBool('external-sites-in-top-menu', '0');
$user = OC::$server[IUserSession::class]->getUser();
$isForced = $this->config->getAppValueBool('force', '0');
$appsCategories = [];
$categoriesAppsCount = [];
$items = [];
@@ -119,7 +120,7 @@ class NavController extends Controller
$topMenuApps = $this->config->getAppValueArray('top-menu-apps', '[]');
$userTopMenuApps = $this->config->getUserValueArray($user, 'top-menu-apps', '[]');
if (!empty($userTopMenuApps)) {
if (!$isForced && !empty($userTopMenuApps)) {
$topMenuApps = $userTopMenuApps;
}
+2 -3
View File
@@ -2,7 +2,6 @@
namespace OCA\SideMenu\Service;
use OC_App;
use OCP\L10N\IFactory;
/**
@@ -13,7 +12,7 @@ use OCP\L10N\IFactory;
class AppRepository
{
/**
* @var OC_App
* @var \OC_App
*/
protected $ocApp;
@@ -22,7 +21,7 @@ class AppRepository
*/
protected $l10nFactory;
public function __construct(OC_App $ocApp, IFactory $l10nFactory)
public function __construct(\OC_App $ocApp, IFactory $l10nFactory)
{
$this->ocApp = $ocApp;
$this->l10nFactory = $l10nFactory;
+2
View File
@@ -59,3 +59,5 @@
"Use the avatar instead of the logo": "Verwenden Sie den Avatar anstelle des Logos"
"You do not have permission to change the settings.": "Sie haben keine Berechtigung zum Ändern der Einstellungen."
"Force this configuration to users": "Erzwingen Sie diese Konfiguration für Benutzer"
"Export the configuration": "Exportieren Sie die Konfiguration"
"Purge the cache": "Leeren Sie den Cache"
+2
View File
@@ -59,3 +59,5 @@
"Use the avatar instead of the logo": "Utiliser l'avatar à la place du logo"
"You do not have permission to change the settings.": "Vous n'avez pas la permission de changer les paramètres."
"Force this configuration to users": "Forcer cette configuration aux utilisateurs"
"Export the configuration": "Exporter la configuration"
"Purge the cache": "Purger le cache"
+22
View File
@@ -108,6 +108,28 @@ var updateTopMenu = function() {
k++
})
// Hack for https://github.com/nextcloud/server/blob/23b0b63c213f5b31eecae817ffd4a9e26f6624d0/core/src/components/MainMenu.js#L74-L96
menu.undelegate('li:not(#more-apps) > a', 'click')
menu.delegate('li:not(#more-apps) > a', 'click', function(e) {
var a = $(e.target)
if (!a.is('a')) {
a = a.closest('a')
}
if (a.attr('target') !== '_blank' && e.which === 1 && !e.ctrlKey && !e.metaKey && a.parent('#more-apps').length === 0) {
a.find('svg').remove()
a.find('div').remove()
a.prepend(jQuery('<div/>').addClass(
OCA.Theming && OCA.Theming.inverted
? 'icon-loading-small'
: 'icon-loading-small-dark'
))
window.location.href = a.attr('href')
}
})
jQuery('#apps li.app-external-site').each(function(i, app) {
app = jQuery(app)
var appId = app.attr('data-id')
+25 -2
View File
@@ -16,9 +16,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
use OCP\IURLGenerator;
use OCP\IConfig;
use OCA\SideMenu\AppInfo\Application;
script('side_menu', 'admin');
style('side_menu', 'admin');
style('side_menu', 'support');
$urlGenerator = \OC::$server[IURLGenerator::class];
$cacheSize = floor(mb_strlen(\OC::$server[IConfig::class]->getAppValue(Application::APP_ID, 'cache-categories', ''), '8bit') / 1024);
$choicesYesNo = [
'No' => '0',
@@ -31,6 +37,7 @@ $choicesSizes = [
'Normal' => 'normal',
'Big' => 'big',
];
?>
<div id="side-menu-section">
@@ -489,9 +496,25 @@ $choicesSizes = [
<input type="hidden" id="side-menu-cache" name="cache" value="<?php print_unescaped($_['cache']); ?>" class="side-menu-setting">
<button id="side-menu-save" class="btn btn-primary"><?php p($l->t('Save')); ?></button>
<button id="side-menu-save" class="btn btn-info">
<?php p($l->t('Save')); ?>
</button>
<span id="side-menu-message" class="msg"></span>
</div>
<div class="section" id="more">
<a href="<?php echo $urlGenerator->linkToRoute('side_menu.AdminSetting.exportConfiguration') ?>" target="_blank">
<button class="btn btn-primary" >
<?php p($l->t('Export the configuration')); ?>
</button>
</a>
<a href="<?php echo $urlGenerator->linkToRoute('side_menu.AdminSetting.removeCache') ?>">
<button class="btn btn-primary" >
<?php p($l->t('Purge the cache')); ?> (<?php echo $cacheSize ?> Kb)
</button>
</a>
<div style="height: 30px"></div>
-1
View File
@@ -18,7 +18,6 @@
script('side_menu', 'admin');
style('side_menu', 'admin');
style('side_menu', 'support');
$choicesYesNo = [
'No' => '0',