summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-01-24 10:56:31 -0600
committerGitHub <noreply@github.com>2017-01-24 10:56:31 -0600
commite09bba5e366d14223c1326ac4a08cf3e5904612a (patch)
tree824ddc7166e002b46bea6f1cff916785603c2494 /lib
parentf55260bc83feeb76ae662c7b97d092da83d8b6bb (diff)
parent38f684aadfb10d491fabfeb0af9a22c109c9cfff (diff)
downloadnextcloud-server-e09bba5e366d14223c1326ac4a08cf3e5904612a.tar.gz
nextcloud-server-e09bba5e366d14223c1326ac4a08cf3e5904612a.zip
Merge pull request #3151 from nextcloud/navigation-icons
add icons to navigation of personal & admin settings
Diffstat (limited to 'lib')
-rw-r--r--lib/composer/composer/autoload_classmap.php1
-rw-r--r--lib/composer/composer/autoload_static.php1
-rw-r--r--lib/private/Server.php3
-rw-r--r--lib/private/Settings/Manager.php19
-rw-r--r--lib/private/Settings/Section.php21
-rw-r--r--lib/public/Settings/IIconSection.php38
-rw-r--r--lib/public/Settings/ISection.php1
7 files changed, 73 insertions, 11 deletions
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index d0ca4646e52..84b5dc637bc 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -225,6 +225,7 @@ return array(
'OCP\\Security\\ISecureRandom' => $baseDir . '/lib/public/Security/ISecureRandom.php',
'OCP\\Security\\StringUtils' => $baseDir . '/lib/public/Security/StringUtils.php',
'OCP\\Session\\Exceptions\\SessionNotAvailableException' => $baseDir . '/lib/public/Session/Exceptions/SessionNotAvailableException.php',
+ 'OCP\\Settings\\IIconSection' => $baseDir . '/lib/public/Settings/IIconSection.php',
'OCP\\Settings\\IManager' => $baseDir . '/lib/public/Settings/IManager.php',
'OCP\\Settings\\ISection' => $baseDir . '/lib/public/Settings/ISection.php',
'OCP\\Settings\\ISettings' => $baseDir . '/lib/public/Settings/ISettings.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index 6fe9a95c249..01edabe6889 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -255,6 +255,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\Security\\ISecureRandom' => __DIR__ . '/../../..' . '/lib/public/Security/ISecureRandom.php',
'OCP\\Security\\StringUtils' => __DIR__ . '/../../..' . '/lib/public/Security/StringUtils.php',
'OCP\\Session\\Exceptions\\SessionNotAvailableException' => __DIR__ . '/../../..' . '/lib/public/Session/Exceptions/SessionNotAvailableException.php',
+ 'OCP\\Settings\\IIconSection' => __DIR__ . '/../../..' . '/lib/public/Settings/IIconSection.php',
'OCP\\Settings\\IManager' => __DIR__ . '/../../..' . '/lib/public/Settings/IManager.php',
'OCP\\Settings\\ISection' => __DIR__ . '/../../..' . '/lib/public/Settings/ISection.php',
'OCP\\Settings\\ISettings' => __DIR__ . '/../../..' . '/lib/public/Settings/ISettings.php',
diff --git a/lib/private/Server.php b/lib/private/Server.php
index d88a687bbc4..8528d5e7b32 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -792,7 +792,8 @@ class Server extends ServerContainer implements IServerContainer {
$c->getEncryptionManager(),
$c->getUserManager(),
$c->getLockingProvider(),
- new \OC\Settings\Mapper($c->getDatabaseConnection())
+ new \OC\Settings\Mapper($c->getDatabaseConnection()),
+ $c->getURLGenerator()
);
return $manager;
});
diff --git a/lib/private/Settings/Manager.php b/lib/private/Settings/Manager.php
index 949826aa246..7a339b94199 100644
--- a/lib/private/Settings/Manager.php
+++ b/lib/private/Settings/Manager.php
@@ -29,6 +29,7 @@ use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IL10N;
use OCP\ILogger;
+use OCP\IURLGenerator;
use OCP\IUserManager;
use OCP\Lock\ILockingProvider;
use OCP\Settings\ISettings;
@@ -55,6 +56,8 @@ class Manager implements IManager {
private $userManager;
/** @var ILockingProvider */
private $lockingProvider;
+ /** @var IURLGenerator */
+ private $url;
/**
* @param ILogger $log
@@ -65,7 +68,7 @@ class Manager implements IManager {
* @param IUserManager $userManager
* @param ILockingProvider $lockingProvider
* @param Mapper $mapper
- * @internal param IDBConnection $dbc
+ * @param IURLGenerator $url
*/
public function __construct(
ILogger $log,
@@ -75,7 +78,8 @@ class Manager implements IManager {
EncryptionManager $encryptionManager,
IUserManager $userManager,
ILockingProvider $lockingProvider,
- Mapper $mapper
+ Mapper $mapper,
+ IURLGenerator $url
) {
$this->log = $log;
$this->dbc = $dbc;
@@ -85,6 +89,7 @@ class Manager implements IManager {
$this->encryptionManager = $encryptionManager;
$this->userManager = $userManager;
$this->lockingProvider = $lockingProvider;
+ $this->url = $url;
}
/**
@@ -260,11 +265,11 @@ class Manager implements IManager {
public function getAdminSections() {
// built-in sections
$sections = [
- 0 => [new Section('server', $this->l->t('Server settings'), 0)],
- 5 => [new Section('sharing', $this->l->t('Sharing'), 0)],
- 45 => [new Section('encryption', $this->l->t('Encryption'), 0)],
- 98 => [new Section('additional', $this->l->t('Additional settings'), 0)],
- 99 => [new Section('tips-tricks', $this->l->t('Tips & tricks'), 0)],
+ 0 => [new Section('server', $this->l->t('Server settings'), 0, $this->url->imagePath('settings', 'admin.svg'))],
+ 5 => [new Section('sharing', $this->l->t('Sharing'), 0, $this->url->imagePath('core', 'actions/share.svg'))],
+ 45 => [new Section('encryption', $this->l->t('Encryption'), 0, $this->url->imagePath('core', 'actions/password.svg'))],
+ 98 => [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))],
+ 99 => [new Section('tips-tricks', $this->l->t('Tips & tricks'), 0, $this->url->imagePath('settings', 'help.svg'))],
];
$rows = $this->mapper->getAdminSectionsFromDB();
diff --git a/lib/private/Settings/Section.php b/lib/private/Settings/Section.php
index b3cf242279f..c89a3999c4e 100644
--- a/lib/private/Settings/Section.php
+++ b/lib/private/Settings/Section.php
@@ -23,25 +23,29 @@
namespace OC\Settings;
-use OCP\Settings\ISection;
+use OCP\Settings\IIconSection;
-class Section implements ISection {
+class Section implements IIconSection {
/** @var string */
private $id;
/** @var string */
private $name;
/** @var int */
private $priority;
+ /** @var string */
+ private $icon;
/**
* @param string $id
* @param string $name
* @param int $priority
+ * @param string $icon
*/
- public function __construct($id, $name, $priority) {
+ public function __construct($id, $name, $priority, $icon = '') {
$this->id = $id;
$this->name = $name;
$this->priority = $priority;
+ $this->icon = $icon;
}
/**
@@ -74,4 +78,15 @@ class Section implements ISection {
public function getPriority() {
return $this->priority;
}
+
+ /**
+ * returns the relative path to an 16*16 icon describing the section.
+ * e.g. '/core/img/places/files.svg'
+ *
+ * @returns string
+ * @since 12
+ */
+ public function getIcon() {
+ return $this->icon;
+ }
}
diff --git a/lib/public/Settings/IIconSection.php b/lib/public/Settings/IIconSection.php
new file mode 100644
index 00000000000..089b9b094e9
--- /dev/null
+++ b/lib/public/Settings/IIconSection.php
@@ -0,0 +1,38 @@
+<?php
+/**
+ * @copyright Copyright (c) 2017, Joas Schilling <coding@schilljs.com>
+ *
+ * @author Joas Schilling <coding@schilljs.com>
+ *
+ * @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 OCP\Settings;
+
+/**
+ * @since 12
+ */
+interface IIconSection extends ISection {
+ /**
+ * returns the relative path to an 16*16 icon describing the section.
+ * e.g. '/core/img/places/files.svg'
+ *
+ * @returns string
+ * @since 12
+ */
+ public function getIcon();
+}
diff --git a/lib/public/Settings/ISection.php b/lib/public/Settings/ISection.php
index 5edf5de0ca4..3c08b74bdc9 100644
--- a/lib/public/Settings/ISection.php
+++ b/lib/public/Settings/ISection.php
@@ -24,6 +24,7 @@
namespace OCP\Settings;
/**
+ * @deprecated 12 Use IIconSection instead
* @since 9.1
*/
interface ISection {