From 6697415d499ebebf157794802f77b65ea59fd8e8 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Thu, 19 Jan 2017 02:26:43 +0100 Subject: [PATCH 01/11] add icons to personal settings navigation Signed-off-by: Jan-Christoph Borchardt --- settings/css/settings.css | 23 +++++++++++++++++++++++ settings/img/activity-dark.svg | 4 ++++ settings/img/change.svg | 5 +++++ settings/img/password.svg | 1 + settings/img/share.svg | 1 + settings/img/toggle-filelist.svg | 1 + settings/templates/personal.php | 6 ++++-- 7 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 settings/img/activity-dark.svg create mode 100644 settings/img/change.svg create mode 100644 settings/img/password.svg create mode 100644 settings/img/share.svg create mode 100644 settings/img/toggle-filelist.svg diff --git a/settings/css/settings.css b/settings/css/settings.css index 557395c571717..9f4ea17376e66 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -7,6 +7,29 @@ input#openid, input#webdav { width:20em; } /* PERSONAL */ +/* icons for sidebar */ +.nav-icon-personal-settings { + background-image: url('../img/personal.svg?v=1'); +} +.nav-icon-sessions { + background-image: url('../img/toggle-filelist.svg?v=1'); +} +.nav-icon-apppasswords { + background-image: url('../img/password.svg?v=1'); +} +.nav-icon-clientsbox { + background-image: url('../img/change.svg?v=1'); +} +.nav-icon-activity { + background-image: url('../img/activity-dark.svg?v=1'); +} +.nav-icon-federated-cloud { + background-image: url('../img/share.svg?v=1'); +} +.nav-icon-second-factor-backup-codes { + background-image: url('../img/password.svg?v=1'); +} + #avatarform { width: 160px; padding-right: 0; diff --git a/settings/img/activity-dark.svg b/settings/img/activity-dark.svg new file mode 100644 index 0000000000000..0fccc5522853d --- /dev/null +++ b/settings/img/activity-dark.svg @@ -0,0 +1,4 @@ + + + + diff --git a/settings/img/change.svg b/settings/img/change.svg new file mode 100644 index 0000000000000..cbc5d982b30ab --- /dev/null +++ b/settings/img/change.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/settings/img/password.svg b/settings/img/password.svg new file mode 100644 index 0000000000000..3d161917f6ec6 --- /dev/null +++ b/settings/img/password.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/settings/img/share.svg b/settings/img/share.svg new file mode 100644 index 0000000000000..c0ad952236928 --- /dev/null +++ b/settings/img/share.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/settings/img/toggle-filelist.svg b/settings/img/toggle-filelist.svg new file mode 100644 index 0000000000000..10bc79fa063fb --- /dev/null +++ b/settings/img/toggle-filelist.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/settings/templates/personal.php b/settings/templates/personal.php index a14982b9b741e..d3a835c4a16d1 100644 --- a/settings/templates/personal.php +++ b/settings/templates/personal.php @@ -9,12 +9,14 @@ ?>
-
    +
      %s", \OCP\Util::sanitizeHTML($anchor), \OCP\Util::sanitizeHTML($sectionName))); + print_unescaped(sprintf("
    • %s
    • ", \OCP\Util::sanitizeHTML($anchor), + \OCP\Util::sanitizeHTML($class), \OCP\Util::sanitizeHTML($sectionName))); } }?>
    From b6bfc4e801500b0a0facbc7e4c02d8b52ce209a4 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Thu, 19 Jan 2017 02:55:02 +0100 Subject: [PATCH 02/11] add icons to admin settings navigation Signed-off-by: Jan-Christoph Borchardt --- settings/css/settings.css | 30 ++++++++++++++++++++++++++++++ settings/img/edit.svg | 1 + settings/img/settings.svg | 1 + settings/img/tag.svg | 1 + settings/img/theming.svg | 1 + settings/img/toggle.svg | 1 + settings/templates/admin/frame.php | 7 +++++-- 7 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 settings/img/edit.svg create mode 100644 settings/img/settings.svg create mode 100644 settings/img/tag.svg create mode 100644 settings/img/theming.svg create mode 100644 settings/img/toggle.svg diff --git a/settings/css/settings.css b/settings/css/settings.css index 9f4ea17376e66..f3aa079e35fb8 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -726,6 +726,36 @@ table.grid td.date{ } /* ADMIN */ + +/* icons for sidebar */ +.nav-icon-server { + background-image: url('../img/admin.svg?v=1'); +} +.nav-icon-sharing { + background-image: url('../img/share.svg?v=1'); +} +.nav-icon-theming { + background-image: url('../img/theming.svg?v=1'); +} +.nav-icon-encryption { + background-image: url('../img/password.svg?v=1'); +} +.nav-icon-workflow { + background-image: url('../img/tag.svg?v=1'); +} +.nav-icon-survey_client { + background-image: url('../img/toggle.svg?v=1'); +} +.nav-icon-logging { + background-image: url('../img/edit.svg?v=1'); +} +.nav-icon-additional { + background-image: url('../img/settings.svg?v=1'); +} +.nav-icon-tips-tricks { + background-image: url('../img/help.svg?v=1'); +} + #security-warning li { list-style: initial; margin: 10px 0; diff --git a/settings/img/edit.svg b/settings/img/edit.svg new file mode 100644 index 0000000000000..a8ab7162a4662 --- /dev/null +++ b/settings/img/edit.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/settings/img/settings.svg b/settings/img/settings.svg new file mode 100644 index 0000000000000..2160b673e3046 --- /dev/null +++ b/settings/img/settings.svg @@ -0,0 +1 @@ + diff --git a/settings/img/tag.svg b/settings/img/tag.svg new file mode 100644 index 0000000000000..464ab936a74c6 --- /dev/null +++ b/settings/img/tag.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/settings/img/theming.svg b/settings/img/theming.svg new file mode 100644 index 0000000000000..adf97966c41d0 --- /dev/null +++ b/settings/img/theming.svg @@ -0,0 +1 @@ + diff --git a/settings/img/toggle.svg b/settings/img/toggle.svg new file mode 100644 index 0000000000000..1f3de01ff34b9 --- /dev/null +++ b/settings/img/toggle.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/settings/templates/admin/frame.php b/settings/templates/admin/frame.php index 761d76c443477..7ae6b5fa012cd 100644 --- a/settings/templates/admin/frame.php +++ b/settings/templates/admin/frame.php @@ -29,13 +29,16 @@ ?>
    -
      +
        getURLGenerator()->linkToRoute('settings.AdminSettings.index', ['section' => $form['anchor']]); + $class = 'nav-icon-' . $form['anchor']; $sectionName = $form['section-name']; $active = $form['active'] ? ' class="active"' : ''; - print_unescaped(sprintf("%s", $active, \OCP\Util::sanitizeHTML($anchor), \OCP\Util::sanitizeHTML($sectionName))); + print_unescaped(sprintf("%s", $active, \OCP\Util::sanitizeHTML($anchor), + \OCP\Util::sanitizeHTML($class), + \OCP\Util::sanitizeHTML($sectionName))); } }?>
      From 381e58d7d4c5b04f32cdbec813ec2a2d150e09bc Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Wed, 18 Jan 2017 21:53:31 -0600 Subject: [PATCH 03/11] add viewBox to not run into scaling issues Signed-off-by: Morris Jobke --- settings/img/edit.svg | 2 +- settings/img/settings.svg | 2 +- settings/img/share.svg | 2 +- settings/img/toggle-filelist.svg | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/settings/img/edit.svg b/settings/img/edit.svg index a8ab7162a4662..5b798f3f4e44b 100644 --- a/settings/img/edit.svg +++ b/settings/img/edit.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/settings/img/settings.svg b/settings/img/settings.svg index 2160b673e3046..f132dfa94bdf6 100644 --- a/settings/img/settings.svg +++ b/settings/img/settings.svg @@ -1 +1 @@ - + diff --git a/settings/img/share.svg b/settings/img/share.svg index c0ad952236928..68f2100e490e7 100644 --- a/settings/img/share.svg +++ b/settings/img/share.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/settings/img/toggle-filelist.svg b/settings/img/toggle-filelist.svg index 10bc79fa063fb..47f019057ea66 100644 --- a/settings/img/toggle-filelist.svg +++ b/settings/img/toggle-filelist.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file From 8c8354399a1923b3580bf887f1f0ab1ef50bc14e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 19 Jan 2017 10:34:17 +0100 Subject: [PATCH 04/11] Allow apps to specify an icon with the sections via the API Signed-off-by: Joas Schilling --- lib/public/Settings/IIconSection.php | 38 +++++++++++++++++++ lib/public/Settings/ISection.php | 1 + .../Controller/AdminSettingsController.php | 8 ++++ settings/css/settings.css | 10 +++++ settings/templates/admin/frame.php | 23 ++++++++--- 5 files changed, 74 insertions(+), 6 deletions(-) create mode 100644 lib/public/Settings/IIconSection.php diff --git a/lib/public/Settings/IIconSection.php b/lib/public/Settings/IIconSection.php new file mode 100644 index 0000000000000..089b9b094e98c --- /dev/null +++ b/lib/public/Settings/IIconSection.php @@ -0,0 +1,38 @@ + + * + * @author Joas Schilling + * + * @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 . + * + */ + +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 5edf5de0ca4f5..3c08b74bdc9e6 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 { diff --git a/settings/Controller/AdminSettingsController.php b/settings/Controller/AdminSettingsController.php index ef70caf56902f..4bc986e708e70 100644 --- a/settings/Controller/AdminSettingsController.php +++ b/settings/Controller/AdminSettingsController.php @@ -28,7 +28,9 @@ use OCP\AppFramework\Http\TemplateResponse; use OCP\INavigationManager; use OCP\IRequest; +use OCP\Settings\IIconSection; use OCP\Settings\IManager as ISettingsManager; +use OCP\Settings\ISection; use OCP\Template; /** @@ -133,10 +135,16 @@ private function getNavigationParameters($currentSection) { /** @var \OC\Settings\Section[] $prioritizedSections */ foreach($sections as $prioritizedSections) { foreach ($prioritizedSections as $section) { + $icon = ''; + if ($section instanceof IIconSection) { + $icon = $section->getIcon(); + } + $templateParameters[] = [ 'anchor' => $section->getID(), 'section-name' => $section->getName(), 'active' => $section->getID() === $currentSection, + 'icon' => $icon, ]; } } diff --git a/settings/css/settings.css b/settings/css/settings.css index f3aa079e35fb8..b9b5570bc7e0b 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -727,6 +727,16 @@ table.grid td.date{ /* ADMIN */ +/* Navigation icons */ +#app-navigation img { + margin-bottom: -3px; + margin-right: 6px; + width: 16px; +} +#app-navigation li span.no-icon { + padding-left: 25px; +} + /* icons for sidebar */ .nav-icon-server { background-image: url('../img/admin.svg?v=1'); diff --git a/settings/templates/admin/frame.php b/settings/templates/admin/frame.php index 7ae6b5fa012cd..2b234f4cd9b76 100644 --- a/settings/templates/admin/frame.php +++ b/settings/templates/admin/frame.php @@ -29,18 +29,29 @@ ?>
      -
        - + getURLGenerator()->linkToRoute('settings.AdminSettings.index', ['section' => $form['anchor']]); $class = 'nav-icon-' . $form['anchor']; $sectionName = $form['section-name']; $active = $form['active'] ? ' class="active"' : ''; - print_unescaped(sprintf("%s", $active, \OCP\Util::sanitizeHTML($anchor), - \OCP\Util::sanitizeHTML($class), - \OCP\Util::sanitizeHTML($sectionName))); + ?> +
      • > + + + + + + + + +
      • + + } + ?>
      From c3985aba70c7a89eeb47cef58b28442055bec4c2 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 19 Jan 2017 10:37:17 +0100 Subject: [PATCH 05/11] Add the icon for the default sections Signed-off-by: Joas Schilling --- core/img/actions/settings-dark.svg | 1 + lib/private/Server.php | 3 ++- lib/private/Settings/Manager.php | 19 ++++++++++++------- lib/private/Settings/Section.php | 21 ++++++++++++++++++--- settings/css/settings.css | 29 ----------------------------- settings/img/edit.svg | 1 - settings/img/settings.svg | 1 - settings/img/tag.svg | 1 - settings/img/theming.svg | 1 - settings/img/toggle.svg | 1 - 10 files changed, 33 insertions(+), 45 deletions(-) create mode 100644 core/img/actions/settings-dark.svg delete mode 100644 settings/img/edit.svg delete mode 100644 settings/img/settings.svg delete mode 100644 settings/img/tag.svg delete mode 100644 settings/img/theming.svg delete mode 100644 settings/img/toggle.svg diff --git a/core/img/actions/settings-dark.svg b/core/img/actions/settings-dark.svg new file mode 100644 index 0000000000000..2160b673e3046 --- /dev/null +++ b/core/img/actions/settings-dark.svg @@ -0,0 +1 @@ + diff --git a/lib/private/Server.php b/lib/private/Server.php index d88a687bbc4ed..8528d5e7b32ee 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -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; }); diff --git a/lib/private/Settings/Manager.php b/lib/private/Settings/Manager.php index 949826aa246da..7a339b94199e4 100644 --- a/lib/private/Settings/Manager.php +++ b/lib/private/Settings/Manager.php @@ -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; @@ -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 @@ public function __construct( EncryptionManager $encryptionManager, IUserManager $userManager, ILockingProvider $lockingProvider, - Mapper $mapper + Mapper $mapper, + IURLGenerator $url ) { $this->log = $log; $this->dbc = $dbc; @@ -85,6 +89,7 @@ public function __construct( $this->encryptionManager = $encryptionManager; $this->userManager = $userManager; $this->lockingProvider = $lockingProvider; + $this->url = $url; } /** @@ -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(); diff --git a/lib/private/Settings/Section.php b/lib/private/Settings/Section.php index b3cf242279fc2..c89a3999c4e7e 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 @@ public function getName() { 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/settings/css/settings.css b/settings/css/settings.css index b9b5570bc7e0b..5c6e30b9bf2d8 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -737,35 +737,6 @@ table.grid td.date{ padding-left: 25px; } -/* icons for sidebar */ -.nav-icon-server { - background-image: url('../img/admin.svg?v=1'); -} -.nav-icon-sharing { - background-image: url('../img/share.svg?v=1'); -} -.nav-icon-theming { - background-image: url('../img/theming.svg?v=1'); -} -.nav-icon-encryption { - background-image: url('../img/password.svg?v=1'); -} -.nav-icon-workflow { - background-image: url('../img/tag.svg?v=1'); -} -.nav-icon-survey_client { - background-image: url('../img/toggle.svg?v=1'); -} -.nav-icon-logging { - background-image: url('../img/edit.svg?v=1'); -} -.nav-icon-additional { - background-image: url('../img/settings.svg?v=1'); -} -.nav-icon-tips-tricks { - background-image: url('../img/help.svg?v=1'); -} - #security-warning li { list-style: initial; margin: 10px 0; diff --git a/settings/img/edit.svg b/settings/img/edit.svg deleted file mode 100644 index 5b798f3f4e44b..0000000000000 --- a/settings/img/edit.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/settings/img/settings.svg b/settings/img/settings.svg deleted file mode 100644 index f132dfa94bdf6..0000000000000 --- a/settings/img/settings.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/settings/img/tag.svg b/settings/img/tag.svg deleted file mode 100644 index 464ab936a74c6..0000000000000 --- a/settings/img/tag.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/settings/img/theming.svg b/settings/img/theming.svg deleted file mode 100644 index adf97966c41d0..0000000000000 --- a/settings/img/theming.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/settings/img/toggle.svg b/settings/img/toggle.svg deleted file mode 100644 index 1f3de01ff34b9..0000000000000 --- a/settings/img/toggle.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file From 17a7eaabcd734c1f989ffc191152d0957195f5d0 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 19 Jan 2017 10:40:11 +0100 Subject: [PATCH 06/11] Add the icons for shipped apps Signed-off-by: Joas Schilling --- apps/files_external/img/app-dark.svg | 1 + apps/files_external/lib/Settings/Section.php | 21 +++++++++++++++++--- apps/theming/img/app-dark.svg | 1 + apps/theming/lib/Settings/Section.php | 21 +++++++++++++++++--- apps/user_ldap/lib/Settings/Section.php | 21 +++++++++++++++++--- apps/workflowengine/lib/Settings/Section.php | 21 +++++++++++++++++--- 6 files changed, 74 insertions(+), 12 deletions(-) create mode 100644 apps/files_external/img/app-dark.svg create mode 100644 apps/theming/img/app-dark.svg diff --git a/apps/files_external/img/app-dark.svg b/apps/files_external/img/app-dark.svg new file mode 100644 index 0000000000000..157af238eeb1c --- /dev/null +++ b/apps/files_external/img/app-dark.svg @@ -0,0 +1 @@ + diff --git a/apps/files_external/lib/Settings/Section.php b/apps/files_external/lib/Settings/Section.php index 4b4bac93d2934..4829bb60d3990 100644 --- a/apps/files_external/lib/Settings/Section.php +++ b/apps/files_external/lib/Settings/Section.php @@ -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; } @@ -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'); + } } diff --git a/apps/theming/img/app-dark.svg b/apps/theming/img/app-dark.svg new file mode 100644 index 0000000000000..adf97966c41d0 --- /dev/null +++ b/apps/theming/img/app-dark.svg @@ -0,0 +1 @@ + diff --git a/apps/theming/lib/Settings/Section.php b/apps/theming/lib/Settings/Section.php index cffbb8901c82b..6078743deadb7 100644 --- a/apps/theming/lib/Settings/Section.php +++ b/apps/theming/lib/Settings/Section.php @@ -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; } @@ -64,4 +72,11 @@ public function getName() { public function getPriority() { return 30; } + + /** + * {@inheritdoc} + */ + public function getIcon() { + return $this->url->imagePath('theming', 'app-dark.svg'); + } } diff --git a/apps/user_ldap/lib/Settings/Section.php b/apps/user_ldap/lib/Settings/Section.php index 82d8d0c84fa80..a4106bacb9e47 100644 --- a/apps/user_ldap/lib/Settings/Section.php +++ b/apps/user_ldap/lib/Settings/Section.php @@ -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; } @@ -64,4 +72,11 @@ public function getName() { public function getPriority() { return 25; } + + /** + * {@inheritdoc} + */ + public function getIcon() { + return $this->url->imagePath('user_ldap', 'app.svg'); + } } diff --git a/apps/workflowengine/lib/Settings/Section.php b/apps/workflowengine/lib/Settings/Section.php index df8bb80713488..b46f9a4a35f02 100644 --- a/apps/workflowengine/lib/Settings/Section.php +++ b/apps/workflowengine/lib/Settings/Section.php @@ -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; } @@ -54,4 +62,11 @@ public function getName() { public function getPriority() { return 55; } + + /** + * {@inheritdoc} + */ + public function getIcon() { + return $this->url->imagePath('core', 'actions/tag.svg'); + } } From 80b800128d93e26ba7b06279ed6ef6f3a2f00651 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 19 Jan 2017 11:02:56 +0100 Subject: [PATCH 07/11] Fix the manager tests Signed-off-by: Joas Schilling --- tests/lib/Settings/ManagerTest.php | 74 ++++++++++++++++++------------ 1 file changed, 44 insertions(+), 30 deletions(-) diff --git a/tests/lib/Settings/ManagerTest.php b/tests/lib/Settings/ManagerTest.php index b91331a1d3062..70401abb65254 100644 --- a/tests/lib/Settings/ManagerTest.php +++ b/tests/lib/Settings/ManagerTest.php @@ -32,6 +32,7 @@ use OCP\IDBConnection; use OCP\IL10N; use OCP\ILogger; +use OCP\IURLGenerator; use OCP\IUserManager; use OCP\Lock\ILockingProvider; use Test\TestCase; @@ -55,18 +56,21 @@ class ManagerTest extends TestCase { private $lockingProvider; /** @var Mapper|\PHPUnit_Framework_MockObject_MockObject */ private $mapper; + /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */ + private $url; public function setUp() { parent::setUp(); - $this->logger = $this->getMockBuilder('\OCP\ILogger')->getMock(); - $this->dbConnection = $this->getMockBuilder('\OCP\IDBConnection')->getMock(); - $this->l10n = $this->getMockBuilder('\OCP\IL10N')->getMock(); - $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock(); - $this->encryptionManager = $this->getMockBuilder('\OCP\Encryption\IManager')->getMock(); - $this->userManager = $this->getMockBuilder('\OCP\IUserManager')->getMock(); - $this->lockingProvider = $this->getMockBuilder('\OCP\Lock\ILockingProvider')->getMock(); - $this->mapper = $this->getMockBuilder(Mapper::class)->disableOriginalConstructor()->getMock(); + $this->logger = $this->createMock(ILogger::class); + $this->dbConnection = $this->createMock(IDBConnection::class); + $this->l10n = $this->createMock(IL10N::class); + $this->config = $this->createMock(IConfig::class); + $this->encryptionManager = $this->createMock(IManager::class); + $this->userManager = $this->createMock(IUserManager::class); + $this->lockingProvider = $this->createMock(ILockingProvider::class); + $this->mapper = $this->createMock(Mapper::class); + $this->url = $this->createMock(IURLGenerator::class); $this->manager = new Manager( $this->logger, @@ -76,7 +80,8 @@ public function setUp() { $this->encryptionManager, $this->userManager, $this->lockingProvider, - $this->mapper + $this->mapper, + $this->url ); } @@ -133,22 +138,26 @@ public function testGetAdminSections() { $this->mapper->expects($this->once()) ->method('getAdminSectionsFromDB') ->will($this->returnValue([ - ['class' => '\OCA\LogReader\Settings\Section', 'priority' => 90] + ['class' => \OCA\WorkflowEngine\Settings\Section::class, 'priority' => 90] ])); - $this->mapper->expects($this->once()) - ->method('getAdminSettingsCountFromDB') - ->will($this->returnValue([ - 'logging' => 1 - ])); + $this->url->expects($this->exactly(5)) + ->method('imagePath') + ->willReturnMap([ + ['settings', 'admin.svg', '1'], + ['core', 'actions/share.svg', '2'], + ['core', 'actions/password.svg', '3'], + ['core', 'actions/settings-dark.svg', '4'], + ['settings', 'help.svg', '5'], + ]); $this->assertEquals([ - 0 => [new Section('server', 'Server settings', 0)], - 5 => [new Section('sharing', 'Sharing', 0)], - 45 => [new Section('encryption', 'Encryption', 0)], - 90 => [new \OCA\LogReader\Settings\Section(\OC::$server->getL10N('logreader'))], - 98 => [new Section('additional', 'Additional settings', 0)], - 99 => [new Section('tips-tricks', 'Tips & tricks', 0)], + 0 => [new Section('server', 'Server settings', 0, '1')], + 5 => [new Section('sharing', 'Sharing', 0, '2')], + 45 => [new Section('encryption', 'Encryption', 0, '3')], + 90 => [\OC::$server->query(\OCA\WorkflowEngine\Settings\Section::class)], + 98 => [new Section('additional', 'Additional settings', 0, '4')], + 99 => [new Section('tips-tricks', 'Tips & tricks', 0, '5')], ], $this->manager->getAdminSections()); } @@ -161,19 +170,24 @@ public function testGetAdminSectionsEmptySection() { $this->mapper->expects($this->once()) ->method('getAdminSectionsFromDB') ->will($this->returnValue([ - ['class' => '\OCA\LogReader\Settings\Section', 'priority' => 90] ])); - $this->mapper->expects($this->once()) - ->method('getAdminSettingsCountFromDB') - ->will($this->returnValue([])); + $this->url->expects($this->exactly(5)) + ->method('imagePath') + ->willReturnMap([ + ['settings', 'admin.svg', '1'], + ['core', 'actions/share.svg', '2'], + ['core', 'actions/password.svg', '3'], + ['core', 'actions/settings-dark.svg', '4'], + ['settings', 'help.svg', '5'], + ]); $this->assertEquals([ - 0 => [new Section('server', 'Server settings', 0)], - 5 => [new Section('sharing', 'Sharing', 0)], - 45 => [new Section('encryption', 'Encryption', 0)], - 98 => [new Section('additional', 'Additional settings', 0)], - 99 => [new Section('tips-tricks', 'Tips & tricks', 0)], + 0 => [new Section('server', 'Server settings', 0, '1')], + 5 => [new Section('sharing', 'Sharing', 0, '2')], + 45 => [new Section('encryption', 'Encryption', 0, '3')], + 98 => [new Section('additional', 'Additional settings', 0, '4')], + 99 => [new Section('tips-tricks', 'Tips & tricks', 0, '5')], ], $this->manager->getAdminSections()); } From 5812e99f1d403428316235063e215f4bf6231c04 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 19 Jan 2017 15:30:40 +0100 Subject: [PATCH 08/11] Fix app section tests Signed-off-by: Joas Schilling --- apps/theming/tests/Settings/SectionTest.php | 18 ++++++++++++++++-- apps/user_ldap/tests/Settings/SectionTest.php | 18 ++++++++++++++++-- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/apps/theming/tests/Settings/SectionTest.php b/apps/theming/tests/Settings/SectionTest.php index 3a3a4375236b2..90d1854aebf0c 100644 --- a/apps/theming/tests/Settings/SectionTest.php +++ b/apps/theming/tests/Settings/SectionTest.php @@ -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 ); } @@ -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()); + } } diff --git a/apps/user_ldap/tests/Settings/SectionTest.php b/apps/user_ldap/tests/Settings/SectionTest.php index 2d2165b8e56d2..ae780dd7665e5 100644 --- a/apps/user_ldap/tests/Settings/SectionTest.php +++ b/apps/user_ldap/tests/Settings/SectionTest.php @@ -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 ); } @@ -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()); + } } From 4253a9bde33b57270fcf2dd2a2a09ffe8d8dcb92 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Thu, 19 Jan 2017 16:12:09 -0600 Subject: [PATCH 09/11] update autoloader static class files Signed-off-by: Morris Jobke --- lib/composer/composer/autoload_classmap.php | 1 + lib/composer/composer/autoload_static.php | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index d0ca4646e52e6..84b5dc637bce6 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -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', diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index 6fe9a95c249b7..01edabe6889d7 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', From d16051fa6fc33c76f7cba9ab5dca8131bd3a109a Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Fri, 20 Jan 2017 23:12:45 -0600 Subject: [PATCH 10/11] fix test mocks Signed-off-by: Morris Jobke --- apps/files_external/tests/Settings/SectionTest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/files_external/tests/Settings/SectionTest.php b/apps/files_external/tests/Settings/SectionTest.php index b5dfb28b382d5..ee501b1270b58 100644 --- a/apps/files_external/tests/Settings/SectionTest.php +++ b/apps/files_external/tests/Settings/SectionTest.php @@ -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 ); } From 38f684aadfb10d491fabfeb0af9a22c109c9cfff Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Tue, 24 Jan 2017 00:59:50 +0100 Subject: [PATCH 11/11] fix positioning details of icons in navigation Signed-off-by: Jan-Christoph Borchardt --- core/css/apps.scss | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/css/apps.scss b/core/css/apps.scss index 93e60fbfbf14f..f91f78d52f8dc 100644 --- a/core/css/apps.scss +++ b/core/css/apps.scss @@ -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 */