Проблема: Редакторы документов (OnlyOffice, Collabora) не установлены в Nextcloud Решение: Добавлены дополнительные варианты открытия файлов Изменения: - crm_extensions/nextcloud_editor/js/nextcloud-editor.js: * Убран параметр editing=false для Files App * Добавлены варианты: download_direct, view_only * Улучшена логика fallback при ошибках Добавлены тестовые страницы: - test_nc_open.html - тест разных редакторов - simple_test.html - простое модальное окно с вариантами Варианты открытия: 1. Files App (показать файл в менеджере) 2. Прямое скачивание через WebDAV 3. Просмотр (если поддерживается браузером) Теперь кнопка Nextcloud будет работать даже без установленных редакторов
81 lines
3.6 KiB
HTML
81 lines
3.6 KiB
HTML
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<title>Простой тест Nextcloud</title>
|
||
<style>
|
||
body { font-family: Arial, sans-serif; padding: 20px; }
|
||
.btn { padding: 10px 20px; margin: 10px; background: #007bff; color: white; border: none; cursor: pointer; }
|
||
.btn:hover { background: #0056b3; }
|
||
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); }
|
||
.modal-content { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: white; padding: 20px; border-radius: 5px; }
|
||
.close { float: right; cursor: pointer; }
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<h2>Простой тест открытия документа 395695</h2>
|
||
|
||
<button class="btn" onclick="showOptions()">Показать варианты открытия</button>
|
||
|
||
<div id="modal" class="modal">
|
||
<div class="modal-content">
|
||
<span class="close" onclick="closeModal()">×</span>
|
||
<h3>Варианты открытия файла zayavlenie_proekt.docx</h3>
|
||
|
||
<div style="margin: 20px 0;">
|
||
<button class="btn" onclick="openOption('files')">📁 Files App (показать файл)</button>
|
||
<button class="btn" onclick="openOption('download')">⬇️ Скачать файл</button>
|
||
<button class="btn" onclick="openOption('view')">👁️ Просмотр (если поддерживается)</button>
|
||
</div>
|
||
|
||
<div style="margin: 20px 0;">
|
||
<h4>Прямые ссылки:</h4>
|
||
<p><a href="https://office.clientright.ru/apps/files/?dir=/crm/crm2/CRM_Active_Files/Documents/395695&openfile=zayavlenie_proekt.docx" target="_blank">Files App</a></p>
|
||
<p><a href="https://office.clientright.ru/remote.php/dav/files/admin/crm/crm2/CRM_Active_Files/Documents/395695/zayavlenie_proekt.docx" target="_blank">Прямое скачивание</a></p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<script>
|
||
function showOptions() {
|
||
document.getElementById('modal').style.display = 'block';
|
||
}
|
||
|
||
function closeModal() {
|
||
document.getElementById('modal').style.display = 'none';
|
||
}
|
||
|
||
function openOption(type) {
|
||
const recordId = 395695;
|
||
const fileName = 'zayavlenie_proekt.docx';
|
||
const baseUrl = 'https://office.clientright.ru';
|
||
|
||
let url;
|
||
switch(type) {
|
||
case 'files':
|
||
url = `${baseUrl}/apps/files/?dir=/crm/crm2/CRM_Active_Files/Documents/${recordId}&openfile=${encodeURIComponent(fileName)}`;
|
||
break;
|
||
case 'download':
|
||
url = `${baseUrl}/remote.php/dav/files/admin/crm/crm2/CRM_Active_Files/Documents/${recordId}/${encodeURIComponent(fileName)}`;
|
||
break;
|
||
case 'view':
|
||
url = `${baseUrl}/apps/files/?dir=/crm/crm2/CRM_Active_Files/Documents/${recordId}&openfile=${encodeURIComponent(fileName)}&view=1`;
|
||
break;
|
||
}
|
||
|
||
window.open(url, 'nextcloud_editor', 'width=1200,height=800');
|
||
closeModal();
|
||
}
|
||
|
||
// Закрытие модального окна при клике вне его
|
||
window.onclick = function(event) {
|
||
const modal = document.getElementById('modal');
|
||
if (event.target == modal) {
|
||
closeModal();
|
||
}
|
||
}
|
||
</script>
|
||
</body>
|
||
</html>
|
||
|