Обновленные файлы: - crm_extensions/nextcloud_editor/js/nextcloud-editor.js (5 путей) - crm_extensions/file_storage/api/get_edit_urls.php (6 путей) - modules/Documents/actions/NcPrepareEdit.php (2 пути) - crm_extensions/file_storage/api/prepare_edit.php (1 путь) - crm_extensions/file_storage/NextcloudClient.php (1 путь) - data/CRMEntity.php (nc_path для новых файлов) Все пути теперь используют /crm/ вместо /crm2/ для соответствия новому External Storage на office.clientright.ru
54 lines
2.2 KiB
PHP
54 lines
2.2 KiB
PHP
<?php
|
||
/**
|
||
* API для получения различных вариантов URL для редактирования
|
||
*/
|
||
|
||
// Устанавливаем заголовки
|
||
header('Content-Type: application/json; charset=utf-8');
|
||
|
||
try {
|
||
// Получаем параметры
|
||
$recordId = $_GET['recordId'] ?? 'test';
|
||
$fileName = $_GET['fileName'] ?? 'test.docx';
|
||
|
||
// Декодируем URL-кодированное имя файла
|
||
if ($fileName) {
|
||
$fileName = urldecode($fileName);
|
||
}
|
||
|
||
// Используем хардкод базового URL для избежания проблем с конфигом
|
||
$baseUrl = 'https://office.clientright.ru';
|
||
|
||
// Отладочная информация
|
||
error_log("get_edit_urls.php: recordId=$recordId, fileName=$fileName");
|
||
|
||
// Создаем различные варианты URL
|
||
$urls = [
|
||
'direct_edit' => $baseUrl . '/apps/files/files/662?dir=/crm/CRM_Active_Files/Documents/' . $recordId . '&openfile=' . urlencode($fileName) . '&action=edit',
|
||
'openfile_only' => $baseUrl . '/apps/files/files/662?dir=/crm/CRM_Active_Files/Documents/' . $recordId . '&openfile=' . urlencode($fileName),
|
||
'edit_true' => $baseUrl . '/apps/files/files/662?dir=/crm/CRM_Active_Files/Documents/' . $recordId . '&openfile=' . urlencode($fileName) . '&edit=true',
|
||
'richdocuments' => $baseUrl . '/apps/richdocuments/open?path=/crm/CRM_Active_Files/Documents/' . $recordId . '/' . urlencode($fileName),
|
||
'onlyoffice' => $baseUrl . '/apps/onlyoffice/open?path=/crm/CRM_Active_Files/Documents/' . $recordId . '/' . urlencode($fileName),
|
||
'files_app' => $baseUrl . '/apps/files/?dir=/crm/CRM_Active_Files/Documents/' . $recordId . '&openfile=' . urlencode($fileName) . '&action=edit'
|
||
];
|
||
|
||
echo json_encode([
|
||
'success' => true,
|
||
'data' => [
|
||
'record_id' => $recordId,
|
||
'file_name' => $fileName,
|
||
'urls' => $urls,
|
||
'recommended' => 'direct_edit'
|
||
]
|
||
]);
|
||
|
||
} catch (Exception $e) {
|
||
http_response_code(500);
|
||
echo json_encode([
|
||
'success' => false,
|
||
'error' => $e->getMessage()
|
||
]);
|
||
}
|
||
?>
|
||
|