Work: Add parameter to validate invisible subfolders with ajax - refs BT#20589

pull/4628/head
Christian 3 years ago
parent fff9269deb
commit 0b39c27215
  1. 7
      main/inc/ajax/lp.ajax.php
  2. 5
      main/inc/lib/document.lib.php

@ -50,7 +50,10 @@ switch ($action) {
$lpId = isset($_GET['lp_id']) ? $_GET['lp_id'] : false; $lpId = isset($_GET['lp_id']) ? $_GET['lp_id'] : false;
$url = isset($_GET['url']) ? $_GET['url'] : ''; $url = isset($_GET['url']) ? $_GET['url'] : '';
$addMove = isset($_GET['add_move_button']) && $_GET['add_move_button'] == 1 ? true : false; $addMove = isset($_GET['add_move_button']) && $_GET['add_move_button'] == 1 ? true : false;
$showOnlyFolders = false;
if (isset($_GET['showOnlyFolders'])) {
$showOnlyFolders = (1 == (int) $_GET['showOnlyFolders']);
}
echo DocumentManager::get_document_preview( echo DocumentManager::get_document_preview(
$courseInfo, $courseInfo,
$lpId, $lpId,
@ -60,7 +63,7 @@ switch ($action) {
null, null,
$url, $url,
true, true,
true, $showOnlyFolders,
$folderId, $folderId,
false false
); );

@ -3650,8 +3650,9 @@ class DocumentManager
$return .= $writeResult; $return .= $writeResult;
$lpAjaxUrl = api_get_path(WEB_AJAX_PATH).'lp.ajax.php'; $lpAjaxUrl = api_get_path(WEB_AJAX_PATH).'lp.ajax.php';
$extraAjaxParams = ($showOnlyFolders ? '&showOnlyFolders='.(int) $showOnlyFolders : '');
if ($lp_id === false) { if ($lp_id === false) {
$url = $lpAjaxUrl.'?a=get_documents&lp_id=&cidReq='.$course_info['code']; $url = $lpAjaxUrl.'?a=get_documents&lp_id=&cidReq='.$course_info['code'].$extraAjaxParams;
$return .= "<script> $return .= "<script>
$(function() { $(function() {
$('.close_div').click(function() { $('.close_div').click(function() {
@ -3665,7 +3666,7 @@ class DocumentManager
</script>"; </script>";
} else { } else {
// For LPs // For LPs
$url = $lpAjaxUrl.'?a=get_documents&lp_id='.(int) $lp_id.'&'.api_get_cidreq(); $url = $lpAjaxUrl.'?a=get_documents&lp_id='.(int) $lp_id.'&'.api_get_cidreq().$extraAjaxParams;
} }
if (!empty($overwrite_url)) { if (!empty($overwrite_url)) {

Loading…
Cancel
Save