Skip to content
Merged
1 change: 1 addition & 0 deletions apps/files_external/img/app-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 18 additions & 3 deletions apps/files_external/lib/Settings/Section.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,21 @@
namespace OCA\Files_External\Settings;

use OCP\IL10N;
use OCP\Settings\ISection;
use OCP\IURLGenerator;
use OCP\Settings\IIconSection;

class Section implements ISection {
class Section implements IIconSection {
/** @var IL10N */
private $l;
/** @var IURLGenerator */
private $url;

public function __construct(IL10N $l) {
/**
* @param IURLGenerator $url
* @param IL10N $l
*/
public function __construct(IURLGenerator $url, IL10N $l) {
$this->url = $url;
$this->l = $l;
}

Expand Down Expand Up @@ -64,4 +72,11 @@ public function getName() {
public function getPriority() {
return 10;
}

/**
* {@inheritdoc}
*/
public function getIcon() {
return $this->url->imagePath('files_external', 'app-dark.svg');
}
}
5 changes: 5 additions & 0 deletions apps/files_external/tests/Settings/SectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,24 @@

use OCA\Files_External\Settings\Section;
use OCP\IL10N;
use OCP\IURLGenerator;
use Test\TestCase;

class SectionTest extends TestCase {
/** @var IL10N */
private $l;
/** @var IURLGenerator */
private $urlGenerator;
/** @var Section */
private $section;

public function setUp() {
parent::setUp();
$this->urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator')->disableOriginalConstructor()->getMock();
$this->l = $this->getMockBuilder('\OCP\IL10N')->disableOriginalConstructor()->getMock();

$this->section = new Section(
$this->urlGenerator,
$this->l
);
}
Expand Down
1 change: 1 addition & 0 deletions apps/theming/img/app-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 18 additions & 3 deletions apps/theming/lib/Settings/Section.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,21 @@
namespace OCA\Theming\Settings;

use OCP\IL10N;
use OCP\Settings\ISection;
use OCP\IURLGenerator;
use OCP\Settings\IIconSection;

class Section implements ISection {
class Section implements IIconSection {
/** @var IL10N */
private $l;
/** @var IURLGenerator */
private $url;

public function __construct(IL10N $l) {
/**
* @param IURLGenerator $url
* @param IL10N $l
*/
public function __construct(IURLGenerator $url, IL10N $l) {
$this->url = $url;
$this->l = $l;
}

Expand Down Expand Up @@ -64,4 +72,11 @@ public function getName() {
public function getPriority() {
return 30;
}

/**
* {@inheritdoc}
*/
public function getIcon() {
return $this->url->imagePath('theming', 'app-dark.svg');
}
}
18 changes: 16 additions & 2 deletions apps/theming/tests/Settings/SectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,24 @@

use OCA\Theming\Settings\Section;
use OCP\IL10N;
use OCP\IURLGenerator;
use Test\TestCase;

class SectionTest extends TestCase {
/** @var IL10N */
/** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */
private $url;
/** @var IL10N|\PHPUnit_Framework_MockObject_MockObject */
private $l;
/** @var Section */
private $section;

public function setUp() {
parent::setUp();
$this->l = $this->getMockBuilder('\OCP\IL10N')->getMock();
$this->url = $this->createMock(IURLGenerator::class);
$this->l = $this->createMock(IL10N::class);

$this->section = new Section(
$this->url,
$this->l
);
}
Expand All @@ -59,4 +64,13 @@ public function testGetName() {
public function testGetPriority() {
$this->assertSame(30, $this->section->getPriority());
}

public function testGetIcon() {
$this->url->expects($this->once())
->method('imagePath')
->with('theming', 'app-dark.svg')
->willReturn('icon');

$this->assertSame('icon', $this->section->getIcon());
}
}
21 changes: 18 additions & 3 deletions apps/user_ldap/lib/Settings/Section.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,21 @@
namespace OCA\User_LDAP\Settings;

use OCP\IL10N;
use OCP\Settings\ISection;
use OCP\IURLGenerator;
use OCP\Settings\IIconSection;

class Section implements ISection {
class Section implements IIconSection {
/** @var IL10N */
private $l;
/** @var IURLGenerator */
private $url;

public function __construct(IL10N $l) {
/**
* @param IURLGenerator $url
* @param IL10N $l
*/
public function __construct(IURLGenerator $url, IL10N $l) {
$this->url = $url;
$this->l = $l;
}

Expand Down Expand Up @@ -64,4 +72,11 @@ public function getName() {
public function getPriority() {
return 25;
}

/**
* {@inheritdoc}
*/
public function getIcon() {
return $this->url->imagePath('user_ldap', 'app.svg');
}
}
18 changes: 16 additions & 2 deletions apps/user_ldap/tests/Settings/SectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,24 @@

use OCA\User_LDAP\Settings\Section;
use OCP\IL10N;
use OCP\IURLGenerator;
use Test\TestCase;

class SectionTest extends TestCase {
/** @var IL10N */
/** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */
private $url;
/** @var IL10N|\PHPUnit_Framework_MockObject_MockObject */
private $l;
/** @var Section */
private $section;

public function setUp() {
parent::setUp();
$this->l = $this->getMockBuilder('\OCP\IL10N')->getMock();
$this->url = $this->createMock(IURLGenerator::class);
$this->l = $this->createMock(IL10N::class);

$this->section = new Section(
$this->url,
$this->l
);
}
Expand All @@ -59,4 +64,13 @@ public function testGetName() {
public function testGetPriority() {
$this->assertSame(25, $this->section->getPriority());
}

public function testGetIcon() {
$this->url->expects($this->once())
->method('imagePath')
->with('user_ldap', 'app.svg')
->willReturn('icon');

$this->assertSame('icon', $this->section->getIcon());
}
}
21 changes: 18 additions & 3 deletions apps/workflowengine/lib/Settings/Section.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,21 @@
namespace OCA\WorkflowEngine\Settings;

use OCP\IL10N;
use OCP\Settings\ISection;
use OCP\IURLGenerator;
use OCP\Settings\IIconSection;

class Section implements ISection {
class Section implements IIconSection {
/** @var IL10N */
private $l;
/** @var IURLGenerator */
private $url;

public function __construct(IL10N $l) {
/**
* @param IURLGenerator $url
* @param IL10N $l
*/
public function __construct(IURLGenerator $url, IL10N $l) {
$this->url = $url;
$this->l = $l;
}

Expand All @@ -54,4 +62,11 @@ public function getName() {
public function getPriority() {
return 55;
}

/**
* {@inheritdoc}
*/
public function getIcon() {
return $this->url->imagePath('core', 'actions/tag.svg');
}
}
6 changes: 6 additions & 0 deletions core/css/apps.scss
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ em {
opacity: 1;
box-shadow: inset 2px 0 #0082c9;
}
li > a:first-child img {
margin-bottom: -3px;
margin-right: 11px;
width: 16px;
margin-left: 2px;
}
.collapse {
display: none;
/* hide collapse button initially */
Expand Down
1 change: 1 addition & 0 deletions core/img/actions/settings-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions lib/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@
'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',
Expand Down
1 change: 1 addition & 0 deletions lib/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
3 changes: 2 additions & 1 deletion lib/private/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,8 @@ public function __construct($webRoot, \OC\Config $config) {
$c->getEncryptionManager(),
$c->getUserManager(),
$c->getLockingProvider(),
new \OC\Settings\Mapper($c->getDatabaseConnection())
new \OC\Settings\Mapper($c->getDatabaseConnection()),
$c->getURLGenerator()
);
return $manager;
});
Expand Down
19 changes: 12 additions & 7 deletions lib/private/Settings/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use OCP\IDBConnection;
use OCP\IL10N;
use OCP\ILogger;
use OCP\IURLGenerator;
use OCP\IUserManager;
use OCP\Lock\ILockingProvider;
use OCP\Settings\ISettings;
Expand All @@ -55,6 +56,8 @@ class Manager implements IManager {
private $userManager;
/** @var ILockingProvider */
private $lockingProvider;
/** @var IURLGenerator */
private $url;

/**
* @param ILogger $log
Expand All @@ -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,
Expand All @@ -75,7 +78,8 @@ public function __construct(
EncryptionManager $encryptionManager,
IUserManager $userManager,
ILockingProvider $lockingProvider,
Mapper $mapper
Mapper $mapper,
IURLGenerator $url
) {
$this->log = $log;
$this->dbc = $dbc;
Expand All @@ -85,6 +89,7 @@ public function __construct(
$this->encryptionManager = $encryptionManager;
$this->userManager = $userManager;
$this->lockingProvider = $lockingProvider;
$this->url = $url;
}

/**
Expand Down Expand Up @@ -260,11 +265,11 @@ private function query($className) {
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();
Expand Down
Loading