Register the app management in the normal way

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2017-03-26 18:40:56 +02:00
parent f154b1d32c
commit ec330c7ac4
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
4 changed files with 12 additions and 43 deletions

View File

@ -61,7 +61,6 @@
<div id="appmenu">
<ul>
<?php $headerIconCount = 8; ?>
<?php foreach($_['headernavigation'] as $entry): ?>
<li data-id="<?php p($entry['id']); ?>">
<a href="<?php print_unescaped($entry['href']); ?>" tabindex="3"
@ -74,22 +73,12 @@
</a>
</li>
<?php endforeach; ?>
<li id="more-apps" class="menutoggle<?php if (!(count($_['navigation']) > $headerIconCount || (OC_User::isAdminUser(OC_User::getUser()) && count($_['navigation'])>=$headerIconCount))): ?> hidden<?php endif; ?>">
<li id="more-apps" class="menutoggle<?php if (count($_['navigation']) <= 8): ?> hidden<?php endif; ?>">
<a href="#">
<div class="icon-more-white"></div>
<span><?php p($l->t('More apps')); ?></span>
</a>
</li>
<?php if(OC_User::isAdminUser(OC_User::getUser())): ?>
<li <?php if(count($_['navigation'])>$headerIconCount-1): ?> class="hidden apps-management"<?php else: ?> class="apps-management" <?php endif; ?>>
<a href="<?php print_unescaped(\OC::$server->getURLGenerator()->linkToRoute('settings.AppSettings.viewApps')); ?>" tabindex="4"
<?php if( $_['appsmanagement_active'] ): ?> class="active"<?php endif; ?>>
<img src="<?php print_unescaped(image_path('settings', 'apps.svg') . '?v=' . $_['versionHash']); ?>" />
<div class="icon-loading-dark" style="display:none;"></div>
<span><?php p($l->t('Apps')); ?></span>
</a>
</li>
<?php endif; ?>
</ul>
</div>
@ -115,25 +104,6 @@
</a>
</li>
<?php endforeach; ?>
<?php
/* show "More apps" link to app administration directly in app navigation, as last entry */
if(OC_User::isAdminUser(OC_User::getUser())):
?>
<li class="apps-management">
<a href="<?php print_unescaped(\OC::$server->getURLGenerator()->linkToRoute('settings.AppSettings.viewApps')); ?>" tabindex="4"
<?php if( $_['appsmanagement_active'] ): ?> class="active"<?php endif; ?>>
<svg width="32" height="32" viewBox="0 0 32 32" class="app-icon">
<defs><filter id="invert-appsmanagement"><feColorMatrix in="SourceGraphic" type="matrix" values="-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0"></feColorMatrix></filter></defs>
<image x="0" y="0" width="32" height="32" preserveAspectRatio="xMinYMin meet" filter="url(#invert-appsmanagement)" xlink:href="<?php print_unescaped(image_path('settings', 'apps.svg') . '?v=' . $_['versionHash']); ?>"></image>
</svg>
<div class="icon-loading-dark" style="display:none;"></div>
<span>
<?php p($l->t('Apps')); ?>
</span>
</a>
</li>
<?php endif; ?>
</ul>
</div>
</div></nav>

View File

@ -178,6 +178,17 @@ class NavigationManager implements INavigationManager {
'name' => $l->t($nav['name']),
]);
}
if ($this->isAdmin()) {
$l = $this->l10nFac->get('settings');
$this->add([
'id' => 'core_apps',
'order' => 9999,
'href' => $this->urlGenerator->linkToRoute('settings.AppSettings.viewApps'),
'icon' => $this->urlGenerator->imagePath('settings', 'apps.svg'),
'name' => $l->t('Apps'),
]);
}
}
private function isAdmin() {

View File

@ -95,14 +95,8 @@ class TemplateLayout extends \OC_Template {
}
}
$userDisplayName = \OC_User::getDisplayName();
$appsMgmtActive = strpos(\OC::$server->getRequest()->getRequestUri(), \OC::$server->getURLGenerator()->linkToRoute('settings.AppSettings.viewApps')) === 0;
if ($appsMgmtActive) {
$l = \OC::$server->getL10N('lib');
$this->assign('application', $l->t('Apps'));
}
$this->assign('user_displayname', $userDisplayName);
$this->assign('user_uid', \OC_User::getUser());
$this->assign('appsmanagement_active', $appsMgmtActive);
if (\OC_User::getUser() === false) {
$this->assign('userAvatarSet', false);

View File

@ -531,9 +531,6 @@ class OC_App {
// This is private as well. It simply works, so don't ask for more details
private static function proceedNavigation($list) {
$headerIconCount = 8;
if(OC_User::isAdminUser(OC_User::getUser())) {
$headerIconCount--;
}
usort($list, function($a, $b) {
if (isset($a['order']) && isset($b['order'])) {
return ($a['order'] < $b['order']) ? -1 : 1;
@ -577,9 +574,6 @@ class OC_App {
public static function proceedAppNavigation($entries) {
$headerIconCount = 8;
if(OC_User::isAdminUser(OC_User::getUser())) {
$headerIconCount--;
}
$activeAppIndex = -1;
$list = self::proceedNavigation($entries);