From a34c626d4310ef41ed281705b0b8d61219bf2678 Mon Sep 17 00:00:00 2001
From: Viktoria Wiebe <vwiebe@uni-osnabrueck.de>
Date: Thu, 2 Jun 2022 14:47:11 +0000
Subject: [PATCH] fixes biest #359 - show library add item descritpion
 according to config

Closes #359

Merge request studip/studip!326
---
 app/views/file/add_files_window.php | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/app/views/file/add_files_window.php b/app/views/file/add_files_window.php
index 64b2ff90106..cefd7a897e2 100644
--- a/app/views/file/add_files_window.php
+++ b/app/views/file/add_files_window.php
@@ -17,7 +17,8 @@ if ($folder_id) {
 <div class="files_source_selector" data-folder_id="<?= htmlReady($folder_id) ?>" <? if ($hidden) echo ' style="display: none;"'; ?>>
     <h2 class="dialog-subtitle"><?= _('Quelle auswählen') ?></h2>
     <div class="file_select_possibilities">
-        <? if (($range instanceof Course) && !$range->getSemClass()['studygroup_mode'] && $GLOBALS['perm']->have_studip_perm('tutor', $range->id) && $GLOBALS['LIBRARY_CATALOGS'] && $show_library_functions) : ?>
+        <? if ($range instanceof Course && !$range->getSemClass()['studygroup_mode'] && $GLOBALS['perm']->have_studip_perm('tutor', $range->id) 
+            && $GLOBALS['LIBRARY_CATALOGS'] && $show_library_functions && $library_search_description) : ?>
             <div>
                 <a class="important-item" data-dialog="size=medium-43"
                    href="<?= $controller->link_for('file/add_from_library/' . $folder_id)?>">
@@ -45,16 +46,21 @@ if ($folder_id) {
                 <?= Icon::create('files')->asImg(50) ?>
                 <?= _('Persönlicher Dateibereich') ?>
             </a>
-            <a href="<?= $controller->link_for('file/choose_file_from_course/' . htmlReady($folder_id), array_merge($options, ['from_plugin' => ""])) ?>" data-dialog>
+            <a href="<?= $controller->link_for('file/choose_file_from_course/' . $folder_id, array_merge($options, ['from_plugin' => ""])) ?>" data-dialog>
                 <?= Icon::create('seminar')->asImg(50) ?>
                 <?= _('Meine Veranstaltungen') ?>
             </a>
-            <? if (($range instanceof Course) && $GLOBALS['perm']->have_studip_perm('tutor', $range->id) && $show_library_functions) : ?>
-                <a href="<?= $controller->link_for('library_file/select_type/' . htmlReady($folder_id)) ?>"
-                   data-dialog="size=auto">
+            <? if ($range instanceof Course && $GLOBALS['perm']->have_studip_perm('tutor', $range->id) && $show_library_functions) : ?>
+                <a href="<?= $controller->link_for('library_file/select_type/' . $folder_id) ?>" data-dialog="size=auto">
                     <?= Icon::create('literature')->asImg(50) ?>
                     <?= _('Literatur') ?>
                 </a>
+                <? if ($GLOBALS['LIBRARY_CATALOGS'] && !$range->getSemClass()['studygroup_mode'] && !$library_search_description) : ?>
+                    <a href="<?= $controller->link_for('file/add_from_library/' . $folder_id) ?>" data-dialog="size=medium-43">
+                        <?= Icon::create('literature')->asImg(50) ?>
+                        <?= _('Originaldokument aus Bibliothek') ?>
+                    </a>
+                <? endif ?>
             <? endif ?>
             <? if (Config::get()->OERCAMPUS_ENABLED && $GLOBALS['perm']->have_perm(Config::get()->OERCAMPUS_PUBLIC_STATUS)) : ?>
                 <a href="<?= $controller->link_for('oer/addfile/choose_file', array_merge($options, ['from_plugin' => ""])) ?>"
-- 
GitLab