From 9540c392c091fc3750125fb6d2d5c376f45c2905 Mon Sep 17 00:00:00 2001
From: Thomas Hackl <hackl@data-quest.de>
Date: Sat, 15 Jul 2023 20:59:30 +0000
Subject: [PATCH] =?UTF-8?q?Draft:=20Resolve=20"Bilderpool=20umh=C3=A4ngen?=
 =?UTF-8?q?=20in=20Administration=20->=20Standort"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #2900

Merge request studip/studip!1967
---
 app/controllers/stock_images.php              |  4 +--
 lib/navigation/AdminNavigation.php            |  7 +++++
 lib/navigation/ContentsNavigation.php         |  7 -----
 .../stock-images/NavigationWidget.vue         | 31 -------------------
 .../vue/components/stock-images/Page.vue      |  3 --
 .../vue/components/stock-images/components.js |  1 -
 6 files changed, 8 insertions(+), 45 deletions(-)
 delete mode 100644 resources/vue/components/stock-images/NavigationWidget.vue

diff --git a/app/controllers/stock_images.php b/app/controllers/stock_images.php
index b272a71e9a7..46954343926 100644
--- a/app/controllers/stock_images.php
+++ b/app/controllers/stock_images.php
@@ -12,9 +12,7 @@ class StockImagesController extends AuthenticatedController
         URLHelper::removeLinkParam('cid');
         $GLOBALS['perm']->check('admin');
 
-        if (Navigation::hasItem('/contents/stock_images')) {
-            Navigation::activateItem('/contents/stock_images');
-        }
+        Navigation::activateItem('/admin/locations/stock_images');
         \PageLayout::setTitle(_('Verwaltung des Bilder-Pools'));
         $this->setSidebar();
     }
diff --git a/lib/navigation/AdminNavigation.php b/lib/navigation/AdminNavigation.php
index 6c9d7e3c488..fa3063730c6 100644
--- a/lib/navigation/AdminNavigation.php
+++ b/lib/navigation/AdminNavigation.php
@@ -161,6 +161,13 @@ class AdminNavigation extends Navigation
                 )
             );
 
+            if ($GLOBALS['perm']->have_perm('admin')) {
+                $pool = new Navigation(_('Bilder-Pool'), 'dispatch.php/stock_images', []);
+                $pool->setImage(Icon::create('picture'));
+                $pool->setDescription(_('Verwalten Sie den Pool frei verfügbarer Bilder.'));
+                $navigation->addSubNavigation('stock_images', $pool);
+            }
+
         }
         $this->addSubNavigation('locations', $navigation);
 
diff --git a/lib/navigation/ContentsNavigation.php b/lib/navigation/ContentsNavigation.php
index c206ef5daf6..119de6a73d0 100644
--- a/lib/navigation/ContentsNavigation.php
+++ b/lib/navigation/ContentsNavigation.php
@@ -139,13 +139,6 @@ class ContentsNavigation extends Navigation
             $this->addSubNavigation('my_elearning', $elearning);
         }
 
-        if ($GLOBALS['perm']->have_perm('admin')) {
-            $pool = new Navigation(_('Bilder-Pool'), 'dispatch.php/stock_images', []);
-            $pool->setImage(Icon::create('picture'));
-            $pool->setDescription(_('Verwalten Sie den Pool frei verfügbarer Bilder.'));
-            $this->addSubNavigation('stock_images', $pool);
-        }
-
         if (!$GLOBALS['perm']->have_perm('root') && $GLOBALS['user']->getAuthenticatedUser()->hasRole('Hilfe-Administrator(in)')) {
             $help = new Navigation(_('Hilfe'), 'dispatch.php/help_content/admin_overview');
             $help->setImage(Icon::create('question-circle'));
diff --git a/resources/vue/components/stock-images/NavigationWidget.vue b/resources/vue/components/stock-images/NavigationWidget.vue
deleted file mode 100644
index 4cdc12ac4ec..00000000000
--- a/resources/vue/components/stock-images/NavigationWidget.vue
+++ /dev/null
@@ -1,31 +0,0 @@
-<template>
-    <SidebarWidget>
-        <template #content>
-            <ul
-                class="widget-list widget-links sidebar-navigation navigation-level-3"
-                :aria-label="$gettext('Dritte Navigationsebene')"
-            >
-                <li class="active">
-                    <a aria-current="page" id="nav_overview_index" class="active" :href="overviewUrl">
-                        {{ $gettext('Übersicht') }}
-                    </a>
-                </li>
-            </ul>
-        </template>
-    </SidebarWidget>
-</template>
-
-<script>
-import SidebarWidget from '../SidebarWidget.vue';
-
-export default {
-    components: {
-        SidebarWidget,
-    },
-    computed: {
-        overviewUrl() {
-            return window.STUDIP.URLHelper.getURL('dispatch.php/contents/overview');
-        },
-    },
-};
-</script>
diff --git a/resources/vue/components/stock-images/Page.vue b/resources/vue/components/stock-images/Page.vue
index b7daddc75e9..3d8ce54fc84 100644
--- a/resources/vue/components/stock-images/Page.vue
+++ b/resources/vue/components/stock-images/Page.vue
@@ -13,7 +13,6 @@
             />
         </ImagesPagination>
         <MountingPortal mountTo="#stock-images-widget" name="sidebar-stock-images">
-            <NavigationWidget />
             <SearchWidget :query="query" @search="onSearch" />
             <OrientationFilterWidget v-model="filters" />
             <ColorFilterWidget v-model="filters" />
@@ -41,7 +40,6 @@ import ColorFilterWidget from './ColorFilterWidget.vue';
 import EditDialog from './EditDialog.vue';
 import ImagesList from './ImagesList.vue';
 import ImagesPagination from './ImagesPagination.vue';
-import NavigationWidget from './NavigationWidget.vue';
 import OrientationFilterWidget from './OrientationFilterWidget.vue';
 import SearchWidget from './SearchWidget.vue';
 import UploadDialog from './UploadDialog.vue';
@@ -54,7 +52,6 @@ export default {
         EditDialog,
         ImagesList,
         ImagesPagination,
-        NavigationWidget,
         OrientationFilterWidget,
         SearchWidget,
         UploadDialog,
diff --git a/resources/vue/components/stock-images/components.js b/resources/vue/components/stock-images/components.js
index 93c61d274bd..2e1861f10f9 100644
--- a/resources/vue/components/stock-images/components.js
+++ b/resources/vue/components/stock-images/components.js
@@ -6,7 +6,6 @@ export { default as StockImagesImagesList } from './ImagesList.vue';
 export { default as StockImagesImagesListItem } from './ImagesListItem.vue';
 export { default as StockImagesImagesPagination } from './ImagesPagination.vue';
 export { default as StockImagesMetadataBox } from './MetadataBox.vue';
-export { default as StockImagesNavigationWidget } from './NavigationWidget.vue';
 export { default as StockImagesOrientationFilterWidget } from './OrientationFilterWidget.vue';
 export { default as StockImagesPage } from './Page.vue';
 export { default as StockImagesSearchWidget } from './SearchWidget.vue';
-- 
GitLab