Files
crm.clientright.ru/crm_extensions/file_storage/api/simple_edit.php
Fedor 75d3f7942b feat: Обновлены все URL Nextcloud с office.klientprav.tech на office.clientright.ru
Обновленные файлы:
- 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 файлы и тестовые директории не изменены
2025-10-20 17:17:34 +03:00

45 lines
1.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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);
}