Обновленные файлы: - 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 файлы и тестовые директории не изменены
45 lines
1.5 KiB
PHP
45 lines
1.5 KiB
PHP
<?php
|
||
/**
|
||
* Simple Document Editor API
|
||
* Простой API для редактирования документов без сложной конфигурации
|
||
*/
|
||
|
||
header('Content-Type: application/json; charset=utf-8');
|
||
|
||
try {
|
||
$input = json_decode(file_get_contents('php://input'), true);
|
||
|
||
$recordId = $input['record_id'] ?? '';
|
||
$fileName = $input['file_name'] ?? '';
|
||
|
||
if (empty($recordId) || empty($fileName)) {
|
||
throw new Exception('Record ID and file name are required');
|
||
}
|
||
|
||
error_log("Simple Editor: Record $recordId, File $fileName");
|
||
|
||
// Простая версия - пока просто возвращаем ссылку на Nextcloud
|
||
$nextcloudUrl = "https://office.clientright.ru/apps/files/?dir=/CRM_Active_Files/Documents/" . $recordId;
|
||
|
||
// В будущем здесь будет:
|
||
// 1. Загрузка файла из vTiger в Nextcloud
|
||
// 2. Создание прямой ссылки на редактирование
|
||
// 3. Синхронизация изменений
|
||
|
||
echo json_encode([
|
||
'success' => true,
|
||
'edit_url' => $nextcloudUrl,
|
||
'message' => 'Файл будет доступен в папке Documents/' . $recordId,
|
||
'record_id' => $recordId,
|
||
'file_name' => $fileName
|
||
], JSON_UNESCAPED_UNICODE);
|
||
|
||
} catch (Exception $e) {
|
||
error_log("Simple Editor Error: " . $e->getMessage());
|
||
|
||
echo json_encode([
|
||
'success' => false,
|
||
'error' => $e->getMessage()
|
||
], JSON_UNESCAPED_UNICODE);
|
||
}
|