Обновленные файлы: - crm_extensions/nextcloud_api.php (2 места) - modules/Documents/actions/NcPrepareEdit.php - crm_extensions/nextcloud_editor/js/nextcloud-editor.js - crm_extensions/file_storage/api/get_edit_urls.php - crm_extensions/file_storage/api/simple_edit.php - crm_extensions/README.md - NEXTCLOUD_EDIT_BUTTON_IMPLEMENTATION.md - crm_extensions/docs/NEXTCLOUD_EDITOR.md - test_syntax_check.html - crm_extensions/tests/test_edit_button.html Все ссылки теперь указывают на новый сервер office.clientright.ru Backup файлы и тестовые директории не изменены
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=/crm2/CRM_Active_Files/Documents/' . $recordId . '&openfile=' . urlencode($fileName) . '&action=edit',
|
||
'openfile_only' => $baseUrl . '/apps/files/files/662?dir=/crm2/CRM_Active_Files/Documents/' . $recordId . '&openfile=' . urlencode($fileName),
|
||
'edit_true' => $baseUrl . '/apps/files/files/662?dir=/crm2/CRM_Active_Files/Documents/' . $recordId . '&openfile=' . urlencode($fileName) . '&edit=true',
|
||
'richdocuments' => $baseUrl . '/apps/richdocuments/open?path=/crm2/CRM_Active_Files/Documents/' . $recordId . '/' . urlencode($fileName),
|
||
'onlyoffice' => $baseUrl . '/apps/onlyoffice/open?path=/crm2/CRM_Active_Files/Documents/' . $recordId . '/' . urlencode($fileName),
|
||
'files_app' => $baseUrl . '/apps/files/?dir=/crm2/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()
|
||
]);
|
||
}
|
||
?>
|
||
|