From c29bb897510ce972c6886655afa3fa7704a1fada Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Mon, 23 Sep 2019 11:31:42 +0200 Subject: [PATCH] Use extra field work file upload instead of work document file BT#15549 --- main/inc/lib/extra_field.lib.php | 1 + main/work/work_list.php | 52 +++++++++++++++++--------------- 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/main/inc/lib/extra_field.lib.php b/main/inc/lib/extra_field.lib.php index 5bf8c37da1..2a6c474ed4 100755 --- a/main/inc/lib/extra_field.lib.php +++ b/main/inc/lib/extra_field.lib.php @@ -2661,6 +2661,7 @@ JAVASCRIPT; [ 'title' => $field['display_text'], 'target' => '_blank', + 'class' => 'download_extra_field', ] ); break; diff --git a/main/work/work_list.php b/main/work/work_list.php index 4b0c770dfc..d7a74cf1a9 100755 --- a/main/work/work_list.php +++ b/main/work/work_list.php @@ -105,7 +105,33 @@ if (!empty($my_folder_data['description'])) { $content .= Display::panel($contentWork, get_lang('Description')); } -$content .= workGetExtraFieldData($workId); +$extraFieldWorkData = workGetExtraFieldData($workId); + +if (!empty($extraFieldWorkData)) { + $forceDownload = api_get_configuration_value('force_download_doc_before_upload_work'); + if ($forceDownload) { + // Force to download documents first. + $downloadDocumentsFirst = addslashes(get_lang('DownloadDocumentsFirst')); + $content .= ""; + } +} + +$content .= $extraFieldWorkData; + $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null; $item_id = isset($_REQUEST['item_id']) ? (int) $_REQUEST['item_id'] : null; @@ -258,30 +284,6 @@ if (!api_is_invitee()) { '; $documents = getAllDocumentsFromWorkToString($workId, $courseInfo); - - if (!empty($documents)) { - $forceDownload = api_get_configuration_value('force_download_doc_before_upload_work'); - if ($forceDownload) { - // Force to download documents first. - $downloadDocumentsFirst = addslashes(get_lang('DownloadDocumentsFirst')); - $content .= ""; - } - } - $content .= $documents; $tableWork = Display::grid_html('results');